latentFactor: Latent Factor

View source: R/coarsened.R

latentFactorR Documentation

Latent Factor

Description

A latent factor is a categorical variable whose values are entirely missing. The function latentFactor provides a convenient way to create a latent factor with a given number of base levels, which is useful for latent-class modeling with cvam.

Usage

latentFactor( n, levels = 2L )

is.latentFactor(x)

Arguments

n

length of the factor

levels

either an integer specifying the number of base levels, or a character vector containing labels for the base levels

x

an object to be tested

Value

For latentFactor, a latent coarsened factor of length n; for is.latentFactor, TRUE or FALSE.

Author(s)

Joe Schafer Joseph.L.Schafer@census.gov

References

For more information, refer to the package vignettes Understanding Coarsened Factors in cvam and Log-Linear Modeling with Missing and Coarsened Values Using the cvam Package.

See Also

cvam, coarsened, baseLevels, is.naCoarsened

Examples

# fit latent class model to hivtest data
hivtest$L <- latentFactor( NROW(hivtest), 2 )
set.seed(125)
fit <- cvam( ~ L*A + L*B + L*C + L*D, data=hivtest, freq=COUNT,
   control=list(startValJitter=.1) )
cvamEstimate( list( ~L, ~A|L, ~B|L, ~C|L, ~D|L ), fit )

cvam documentation built on March 7, 2023, 5:29 p.m.