View source: R/Simulate_clcm.R
simulate_clcm | R Documentation |
Simulate data for the CLCM
simulate_clcm( N, number.timepoints, Q = NULL, item.type = NULL, categories.j = NULL, transition.matrix = NULL, lc.prop = NULL, post = NULL, param = NULL, item.names = NULL )
N |
integer specifying the sample size |
number.timepoints |
integer specify the number of timepoints, 1 or 2 |
Q |
the Q-matrix, a matrix of 1s and 0s specifying the factor loading structure. The default is 1 factor (K=1), which forms two latent classes |
item.type |
character vector specifying the type of item to be modeled
|
categories.j |
numeric vector specifying the number of categories of each item. For 'Normal' or 'Beta' item types, the value should be NA |
transition.matrix |
a 2^K by 2^K numeric matrix that specifies the transition probabilities. This is used in conjunction with the lc.prop at timepoint 1. See Vignettes for a detailed example. |
lc.prop |
list of the latent class proportions at each timepoint.
For example, |
post |
a matrix of the true posterior distributions - long data format. Generate the posterior distributions according to user-preference, then pass posterior distributions to the function. This is the preferred way to specify the latent class proportions and transition probabilities because it offers maximum control and flexibility. See Vignettes for detailed examples on generating posterior distributions. |
param |
list of item parameters, default is to use the values in the function |
item.names |
character vector of item names |
Returns simulated item responses and posterior distributions.
## Not run: set.seed(3112021) simulate_clcm(N=50, number.timepoints = 1, item.type = rep('Ordinal', 5), categories.j = rep(4, 5), lc.prop = list('Time_1' = c(0.5, 0.5)) ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.