init.norm {LCAextend} | R Documentation |
computes initial values for the EM algorithm in the case of continuous measurements
Description
computes initial values of means and variance-covariance matrices for the EM algorithm in the case of continuous measurements and multinormal model.
Usage
init.norm(y, K, x = NULL, var.list = NULL)
Arguments
y |
a |
K |
number of latent classes of the model, |
x |
a matrix of covariates if any, default is |
var.list |
a list of integers indicating which covariates (taken from |
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
#data
data(ped.cont)
status <- ped.cont[,6]
y <- ped.cont[status==2,7:ncol(ped.cont)]
#the function
init.norm(y,K=3)