mlVARsample: Simulator function given an mlVAR object

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/mlVARsamplesize.R

Description

Simulates data based on an mlVAR object, estimates the mlVAR network model based on the simulated data and compares the estimated network to the mlVAR object network.

Usage

1
2
3
4
5
mlVARsample(object, nTime = c(25,50,100,200), nSample = 100, pMissing = 0, 
  nReps = 100, nCores = 1, ...)

## S3 method for class 'mlVARsample'
summary(object, ...)

Arguments

object

mlVAR object, or mlVARsample object in the summary method

nTime

Vector with number of time points to test.

nSample

Number of individuals in the dataset. It is possible to decrease the number of individuals compared to the individuals in the mlVAR object. However, it is not possible to have more individuals than there are in the mlVAR object.

pMissing

Percentage of missing data to be simulated.

nReps

Number of repetitions for each condition.

nCores

Number of cores to use.

...

Arguments sent to mlVAR.

Details

This function simulates data based on the mlVAR object. The individual networks (random effects) are used to simulate data using the graphicalVARsim function from the graphicalVAR package (Epskamp, 2020). The individual data is combined into one dataset. This dataset is used to estimate the mlVAR network.

For every condition, the function returns four values per network comparison measure (correlation, sensitivity, specificity, bias, and precision): one for the fixed temporal effects, one for the fixed contemporaneous effects, the mean comparison value of the random temporal effects, and the mean comparison value of the random contemporaneous effects.

Author(s)

Sacha Epskamp <mail@sachaepskamp.com>

References

Sacha Epskamp (2020). graphicalVAR: Graphical VAR for Experience Sampling Data. R package version 0.2.3. https://CRAN.R-project.org/package=graphicalVAR

See Also

mlVARsim, mlVAR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
### Small example ###
# Simulate data:
Model <- mlVARsim(nPerson = 100, nNode = 3, nTime = 50, lag=1)

# Estimate using correlated random effects:
fit <- mlVAR(Model$Data, vars = Model$vars, 
             idvar = Model$idvar, lags = 1, 
             temporal = "correlated")

# Sample from fitted model: 
samples <- mlVARsample(fit, nTime = 50, nSample = 50, pMissing = 0.1,
                       nReps = 5, nCores = 1)

# Summarize results:
summary(samples)

## End(Not run) 

mlVAR documentation built on Oct. 25, 2021, 5:07 p.m.

Related to mlVARsample in mlVAR...