rlcm {lca}R Documentation

Generate Data from a Latent Class Model

Description

Generates independent random instances of a Latent Class Model with given parameters.

Usage

rlcm(n, theta, eta, varnames = NULL, lc = TRUE)

Arguments

n number of independent observations to generate.
theta numeric vector of latent class proportions.
eta other parameters in array of class lcm.params
varnames optional character vector containing names of the items.
lc logical - should output include information on latent class membership?

Details

The n individual responses are independent observations from a latent class model, with H latent classes; H is infered from the length of theta. Each individual is randomly assigned a latent class h with probability theta[h].

Then for each individual, conditional on their membership of class h, the probability of responding k to item j is eta[h,j,k], independently of their other responses.

rlcm tabulates the results.

Value

An object of class freq.table containing the results. The first J columns contain the item response pattern; if lc = TRUE the next column will contain the latent class. The last column contains the counts.

Author(s)

Robin Evans

References

Goodman, L.A. (1974) - Exploratory Latent Structure Analysis Using Both Identifiable and Unidentifiable Models, Biometrika, Vol. 61 (2), pp 215-331.

Examples

theta = c(0.4, 0.6)
eta = c(0.9,0.2,0.9,0.2,0.9,0.2)
eta = array(c(eta,1-eta), c(2,3,2))

set.seed(123)
rlcm(1000, theta, eta, lc=FALSE)

[Package lca version 0.2 Index]