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
)
Arguments
| 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
Ordinal - Ordinal model, 1 slope parameter, C-1 intercept parameters,
where C is the number of categories. The slope parameter distinguishes the latent classes.
Nominal - Nominal or Multinomial model, 2*(C-1) parameters. The slope parameters
distinguish the latent classes.
Poisson - Poisson model, 2 parameters.
The model is paramterized using lambda.
See ?rpois for details.
The lambda parameter is stratified on the latent classes.
The slope parameter distinguishes the latent classes.
Neg_Binom - Negative Binomial model, 3 parameters.
The model is parameterized using mu and size.
See ?rnbinom for details on parameters.
The mu parameter is stratified on the latent classes; the size parameter is common to
all latent classes.
The slope parameter distinguishes the latent classes.
ZINB - Zero-Inflated Negative Binomial model, 4 parameters.
The model is parameterized as mu, size, and zi (zero inflation parameter).
The mu parameter is stratified on the latent classes;
the size and zi parameters are common to all latent classes.
The slope parameter distinguishes the latent classes.
ZIP- Zero-Inflated Poisson model, 3 parameters.
The model is parameterized using lambda and zi (zero inflation parameter).
The lambda parameter is stratified on latent classes.
The zi parameter is common to all latent classes.
The slope parameter distinguishes the latent classes.
Normal - Normal distribution model, 2 parameters.
The model is parameterized using a mean and variance
The mean is stratified on latent classes.
The variance is common to all latent classes (pooled across latent classes)
The slope parameter distinguishes the latent classes.
Beta - Beta distribution model, 3 parameters.
Support ranges from 0 to 1.
The model is parameterized using shape1 and shape2 paramters.
See ?rbeta for details
The shape1 parameter is stratified on latent classes
The shape 2 parameter is common to all latent classes
The slope parameter distinguishes the latent classes.
|
| 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, lc.prop = list(c('Time_1' = c(0, 1), 'Time_2' = c(0.6, 0.4))
specifies that at timepoint 1 all subjects are in latent class 2,
and at timepoint 2, 40% are in latent class 2, with the remainder in latent class 1 |
| 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 |
Value
Returns simulated item responses and posterior distributions.
Examples