scanList
or sLlist
(list of scanList
) objects.R/expDesign_building.blocks.R
sum_scans.Rd
Sum list of binary scans into a weighted adjacency matrix
Written as a S3 method to be applied to scanList
or sLlist
(list of scanList
) objects.
sum_scans(scan.list, ...)
scan.list | a |
---|---|
... | additional arguments to be passed.
|
a weightedAdj
object, or list of such, consisting mainly on a weighted adjacency matrix
where each edge weight is equal to the sum of all binary edges. Inherits from the previous
scanList
class (theoretical or empirical, inheriting from scanList
), and keeps track of the
scan.list
's list of attributes attrs
.
Also adds these attributes to attrs
:
summed.scanList
: the original scanList
(3D array) that has been summed
sampled
: an integer matrix representing how many time each edge has been sampled (i.e. was
not NA
). Determined via count_nonNA()
set.seed(42) n <- 5L samp.effort <- 241L # Adjacency matrix import ## random directed adjacency matrix Adj <- matrix(sample(1:samp.effort,n * n),nrow = 5,dimnames = list(letters[1:n],letters[1:n])) diag(Adj) <- 0L Adj#> a b c d e #> a 0 228 47 165 111 #> b 229 0 24 110 131 #> c 65 122 0 20 41 #> d 153 241 100 0 227 #> e 74 128 89 114 0# social network simulations ## theoretical scans sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "directed",n.scans = 120L) sL#> #> scan: 1 #> a . 1 . 1 . #> b 1 . . . . #> c . . . . . #> d . 1 1 . 1 #> e . . 1 . . #> #> scan: 2 #> a . 1 . . . #> b 1 . . 1 . #> c 1 1 . . . #> d . 1 . . 1 #> e . . 1 1 . #> #> ... ( 117 more scans) #> #> scan: 120 #> a . 1 . 1 1 #> b 1 . . 1 . #> c . 1 . . . #> d 1 1 . . 1 #> e . 1 1 . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.ProbsL |> sum_scans()#> #> Weighted adjacency matrix #> a . 115 36 63 48 #> b 112 . 11 48 64 #> c 36 60 . 14 17 #> d 71 120 45 . 115 #> e 29 60 47 54 . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - summed.scanList - sampled#> #> Weighted adjacency matrix #> a . 67 17 37 23 #> b 65 . 5 25 37 #> c 26 27 . 8 9 #> d 50 63 22 . 76 #> e 15 34 29 35 . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - obs.P - theoretical.scanList - summed.scanList - sampled## comparing group-scan and focal sampling sL |> perform_exp(design_sampling("group",.6), design_sampling("focal","even") ) |> sum_scans()#> [[1]] #> #> Weighted adjacency matrix #> a . 71 29 41 39 #> b 70 . 5 30 32 #> c 22 31 . 8 13 #> d 40 65 25 . 69 #> e 17 34 30 34 . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - obs.P - theoretical.scanList - summed.scanList - sampled #> #> [[2]] #> #> Weighted adjacency matrix #> a . 46 17 31 20 #> b 42 . 5 18 21 #> c 15 25 . 7 4 #> d 29 48 19 . 48 #> e 9 28 16 21 . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - focalList - theoretical.scanList - summed.scanList - sampled #> #> attr(,"class") #> [1] "sLlist"