perform_exp: Perform an experimental design on theoretical 'scanList'

Description Usage Arguments Value See Also Examples

View source: R/expDesign_tools.R

Description

Perform an experimental design on theoretical scanList

Usage

1
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:

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

See Also

design_exp(), simunet(), design_sampling().

Examples

 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)

R-KenK/SimuNet documentation built on Oct. 22, 2021, 1:27 a.m.