View source: R/mlVARsamplesize.R

mlVARsample | R Documentation |

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.

```
mlVARsample(object, nTime = c(25,50,100,200), nSample = 100, pMissing = 0,
nReps = 100, nCores = 1, ...)
## S3 method for class 'mlVARsample'
summary(object, ...)
```

`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. |

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.

Sacha Epskamp <mail@sachaepskamp.com>

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

`mlVARsim`

, `mlVAR`

```
## 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)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.