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

Description Usage Arguments Details Value Examples

View source: R/init.norm.R

Description

computes initial values of means and variance-covariance matrices for the EM algorithm in the case of continuous measurements and multinormal model.

Usage

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

Arguments

y

a n times d matrix of continuous measurements, where n is the number of indivduals 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

a 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 by a simple clustering of the data and evaluates the means and variance-covariance matrices of measurements in each class. Treatment of covariates is not yet implemented, and any provided covariate value will be ignored.

Value

The function returns a list of 2 elements mu and sigma of length K each, mu[k] is the means vector (of length d) of measurements in class k and sigma[k] is the variances-covariances matrix (of dimension d times d) of measurements in class k.

Examples

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

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