init.ordi: computes the initial values for EM algorithm in the case of...

Description Usage Arguments Details Value See Also Examples

View source: R/init.ordi.R

Description

computes the initial values of cumulative logistic coefficients alpha for the EM algorithm in the case of ordinal measurements and a product multinomial model.

Usage

1
init.ordi(y, K, x = NULL, var.list = NULL)

Arguments

y

a n times d matrix of ordinal (or discrete) measurements, where n is the number of individuals and d is the number of measurements. All entries must be finite, if not an error is produced,

K

number of latent classes of the model,

x

a matrix of covariates if any, default is NULL (no covariates),

var.list

list of integers indicating which covariates (taken from x) are used for a given measurement (a column of y).

Details

The function allocates every individual to a class and evaluates the cumulative logistic coefficients for each measurement and each class. Regression coefficients for the covariates are set to 0.

Value

The function returns a list of one element alpha which is a list of d elements, each element alpha[[j]] is a K times S-1 matrix, where S is the number of values of the measurement y[,j], a row alpha[[j]][k,] gives the the cumulative logistic coefficients of class k and measurement j using alpha.compute.

See Also

alpha.compute

Examples

1
2
3
4
5
6
#data
data(ped.ordi)
status <- ped.ordi[,6]
y <- ped.ordi[,7:ncol(ped.ordi)]
#the function
init.ordi(y[status==2,],K=3)

abureau/LCAextend documentation built on May 3, 2019, 9:41 p.m.