View source: R/Estimate_clcm.R
clcm | R Documentation |
Estimate confirmatory latent class model
clcm( dat, item.type = NULL, item.names = NULL, Q = NULL, lc.con = NULL, lat.reg = NULL, sv = NULL, post.true = NULL, initial.lprior = NULL, initial.post = NULL, max.diff = 1e-04, max.it = 1000, verbose = T )
dat |
data frame containing item responses. If the data contains more than
one timepoint, it must be specified by a variable named |
item.type |
character vector specifying the type of item to be modeled. The item type options are as follows:
|
item.names |
specify the item names; the dataframe column names containing item responses |
Q |
optional pass the Q-matrix, default is K=1, two latent classes. This is a confirmatory latent class model, hence the need for the specifcation. Note that only dichotomous attributes (factors) are supported. Only the conjunctive condensation rule is supported. All condensation rules are equivalent for items that evaluate a single attriute (factor). |
lc.con |
optional list of constraints on each latent class at each timepoint, where
|
lat.reg |
optional pass variables to regress latent class on
For example, regress the latent classes at timepoint 2 onto the Group variable:
|
sv |
optional list of the starting values for item parameter estimation |
initial.lprior |
optional matrix of the initial log-prior distribution. This is important for the 2-stage estimation routine. |
initial.post |
optional matrix of the initial posterior distribution |
max.diff |
convergence tolerance of item param estimation; default is 1e-04 |
max.it |
maximum number of iterations in EM estimation procedure; default is 1e3 |
verbose |
logical; should the function print the estimation progress? Default is TRUE, recommend set to FALSE for simulations. |
Returns the estimated confirmatory latent class model
## Not run: set.seed(3112021) sim.dat <- simulate_clcm(N=200, number.timepoints = 1, item.type = rep('Ordinal', 5), categories.j = rep(4, 5), lc.prop = list('Time_1' = c(0.5, 0.5)) ) mod <- clcm(dat = sim.dat$dat, item.type = sim.dat$item.type, item.names = sim.dat$item.names, Q = sim.dat$Q) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.