permute.class {lcca}R Documentation

Reorder classes in a latent-class model

Description

The generic method permute.class reorders the latent classes in the result of a call to the modeling functions lca, lcacov or lcca.

Usage



permute.class(x, ...)


## S3 method for class 'lca'
permute.class(x, perm = (x$nclass:1), ...)


## S3 method for class 'lcacov'
permute.class(x, perm = (x$nclass:1), ...)


## S3 method for class 'lcca'
permute.class(x, perm = (x$nclass:1), ...)


## Default S3 method:
permute.class(x, ...)

Arguments

x

an object used to select a method. Should be an object of class "lca", "lcacov", or "lcca" containing the results from a latent-class model fit.

perm

a permutation of the integers 1,...,nclass, where nclass is the number of latent classes in the model. By default, the order of classes is reversed.

...

additional arguments to be passed to the methods.

Details

The likelihood function for a latent-class model is invariant to permutations of the class labels. The order of the classes as they appear in the result of a call to lca, lcacov or lcca will depend on the starting values for the parameters. The generic method permute.class will change the order of the classes in the components of these objects, and in the printed summaries produced when the summary method is applied to them.

Value

An object of the same class as a containing the results from a latent-class model, with classes arranged in a new order.

Author(s)

Joe Schafer

Send questions to mchelpdesk@psu.edu

See Also

lca, lcacov, lcca

Examples

### fit a two-class model to the HIV test data
data(hivtest)
set.seed(123)
fit <- lca( cbind(A,B,C,D)~1, data=hivtest, freq=COUNT )
summary(fit)

### now reverse the order of the classes
fit <- permute.class(fit, c(2,1) )
summary(fit)

[Package lcca version 2.0.0 Index]