This function simulates data after a multistage design. The subjects are drawn from a normal distribution with specified mean and standard deviation (default N (0,1)). As an additional argument, a seed can also be passed.

tmt_sim(mstdesign = NULL, items = NULL, persons = NULL, mean = 0,
  sd = 1, ...)

Arguments

mstdesign

definition of desired multistage design

items

vector of difficulty parameters for each items

persons

amount of persons per starting module

mean

optional mean for person parameter; default = 0

sd

optional sd for person parameter; default = 1

...

further optional arguments like set.seed

Value

List with following entries

data

Matrix with item responses

data_mst

Data frame with item responses and additional a vector of used modules per person

persons

Generated and used person parameters

mstdesign

Submitted multistage design

Examples

############################################################################# # translate multistage model 1 ############################################################################# mstdesign <- " M1 =~ c(i1, i2, i3, i4, i5) M2 =~ c(i6, i7, i8, i9, i10) M3 =~ c(i11, i12, i13, i14, i15) # define starting module Start == M2 # define branches p1 := Start(0,2) + M1 p2 := Start(3,5) + M3 " items <- seq(-3,3,length.out = 15) names(items) <- paste0("i",1:15) persons = 500 set.seed(1111) data_1 <- tmt_sim(mstdesign = mstdesign, items = items, persons = persons, mean = 0, sd = 1) ############################################################################# # translate multistage model 2 ############################################################################# mstdesign <- " M1 =~ c(i1, i2, i3, i4, i5) M2 =~ c(i6, i7, i8, i9, i10) M3 =~ c(i11, i12, i13, i14, i15) M4 =~ c(i16, i17, i18, i19, i20) M5 =~ c(i21, i22, i23, i24, i25) M6 =~ c(i26, i27, i28, i29, i30) # define starting module Start == M4 # define branches p1 := Start(0,2) + M2(0,2) + M1 p2 := Start(0,2) + M2(3,5) + M3 p3 := Start(3,5) + M5(0,2) + M3 p4 := Start(3,5) + M5(3,5) + M6 " items <- seq(-3,3,length.out = 30) names(items) <- paste0("i",1:30) persons = 500 set.seed(1111) data_2 <- tmt_sim(mstdesign = mstdesign, items = items, persons = persons, mean = 0, sd = 1)