Description Usage Arguments Value See Also Examples
View source: R/expDesign_tools.R
Perform an experimental design on theoretical scanList
1 | perform_exp(scan.list, exp.design = NULL, ...)
|
scan.list |
a |
exp.design |
an |
... |
additional If not |
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
design_exp()
, simunet()
, design_sampling()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 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
# 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)
perform_exp(sL,focal.periRemoved) |> sum_scans()
## performing a list of experiments
perform_exp(sL,group.scan,focal.scan)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.