Perform an experimental design on theoretical scanList

perform_exp(scan.list, exp.design = NULL, ...)

Arguments

scan.list

a scanList object. See objects returned by simunet()

exp.design

an expDesign object. See objects returned by design_exp(). If NULL, the inputted scan.list is returned as is.

...

additional expDesign object.

If not NULL, the different expDesign will be applied to scan.list in "parallel": the returned value will be a list of empirical scanList, i.e. a sLlist object

Value

an empirical scanList object representing the simulated theoretical scan on which the experimental manipulations have been applied. Such objects contain:

  • the 3 dimensional array representing adjacency matrices (first 2 dimensions) throughout the different scans (3rd dimension)

  • the same attrs attribute than the inputted scan.list (a list of attributes), in which scanList.type = "empirical"

  • a class empirical, which inherits from scanList

  • and other attributes might have been added to attrs or modifications depending on exp.design (e.g. sum_scans() returns an object of class sum, that inherits from classes empirical or theoretical, and further from scanList)

If more than one expDesign has been inputted via ..., returns a list of empirical scanList, i.e. a sLlist object

See also

Examples

set.seed(42) n <- 5L samp.effort <- 100L # Adjacency matrix import ## random directed adjacency matrix Adj <- sample(1:samp.effort,n * n) |> matrix(nrow = 5,dimnames = list(letters[1:n],letters[1:n])) Adj[lower.tri(Adj,diag = TRUE)] <- 0L Adj
#> a b c d e #> a 0 100 37 27 58 #> b 0 0 20 36 42 #> c 0 0 0 5 93 #> d 0 0 0 0 30 #> e 0 0 0 0 0
# Designing the experiments: ## setting a constant probability of not observing edges group.scan <- design_sampling(method = "group",sampling = 0.8) ## setting a biased focal sampling favoring central individual (node strength) focal.scan <- design_exp( design_sampling( method = "focal", sampling = function(Adj) Adj |> igraph::graph.adjacency("upper",weighted = TRUE) |> igraph::strength() ) ) ## Adding more scans, removing the most peripheral individual, before performing an even focal ## sampling focal.periRemoved <- design_exp( function(Adj) add_scans(Adj,42), # users can use anonymous function to specify arguments remove_mostPeripheral, # ... or pass functions as arguments directly design_sampling(method = "focal",sampling = "even") # design_sampling: special case # that returns sampling functions ) # Apply the experimental design ## on previously obtained theoretical scans sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "upper",n.scans = 120L) perform_exp(sL,group.scan)
#> #> scan: 1 #> a . 1 NA . 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> scan: 2 #> a . 1 . . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> ... ( 117 more scans) #> #> scan: 120 #> a . 1 . . 1 #> b . . 1 1 . #> c . . . . 1 #> d . . . . NA #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - obs.P - theoretical.scanList
perform_exp(sL,focal.periRemoved) |> sum_scans()
#> #> Weighted adjacency matrix #> a . 65 20 36 #> b . . 20 25 #> c . . . 58 #> e . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - focalList - theoretical.scanList - summed.scanList - sampled
## performing a list of experiments perform_exp(sL,group.scan,focal.scan)
#> [[1]] #> #> scan: 1 #> a . 1 NA NA NA #> b . . NA . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> scan: 2 #> a . NA . . NA #> b . . . . NA #> c . . . . NA #> d . . . . . #> e . . . . . #> #> ... ( 117 more scans) #> #> scan: 120 #> a . NA NA . 1 #> b . . NA 1 . #> c . . . NA 1 #> d . . . . 1 #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - obs.P - theoretical.scanList #> #> [[2]] #> #> scan: 1 #> a . 1 NA NA NA #> b . . . . . #> c . . . NA NA #> d . . . . NA #> e . . . . . #> #> scan: 2 #> a . NA NA NA . #> b . . NA NA 1 #> c . . . NA 1 #> d . . . . . #> e . . . . . #> #> ... ( 117 more scans) #> #> scan: 120 #> a . 1 . . 1 #> b . . NA NA NA #> c . . . NA NA #> d . . . . NA #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob - focalList - theoretical.scanList #> #> attr(,"class") #> [1] "sLlist"