sim_ICED: simulates data based on ICED model structure and list of...

View source: R/sim_ICED.R

sim_ICEDR Documentation

simulates data based on ICED model structure and list of variances

Description

sim_ICED simulates n x p data frame based on ICED model structure, selected variance components, and specified n

Usage

sim_ICED(structure, variances, n, check_recovery = FALSE)

Arguments

structure

data.frame describing the structure of the data, with each variable covering a design aspect - see example. Note: currently the first variable must be time and include a different value for each repeated measure.

variances

list of variances corresponding to each latent variable specified in strucutre

n

number of participants to simulate

check_recovery

runs run_ICED to extract variance components in order to check the variance parameter recovery

Value

list including simulated data

Examples

# compare recovery of variance parameters

# ICED structure
struc <- data.frame(time = c("T1", "T2", "T3", "T4"),
day = c("day1","day1","day2","day2"),
session = c("ses1", "ses1","ses2", "ses3"))

sim_ICED(struc,
variances = list(time = 10,
                 day = 2,
                 session = 1,
                 error = 3),
n = 20,
check_recovery = TRUE)

sim_ICED(struc,
         variances = list(time = 10,
                          day = 2,
                          session = 1,
                          error = 3),
         n = 2000,
         check_recovery = TRUE)



ICED documentation built on Aug. 18, 2022, 9:06 a.m.