Description Usage Arguments Details Value Note References Examples

Fits latent class models with covariate effects on underlying and measured variables. The measured variables are dichotomous or polytomous, all with the same number of categories.

1 2 3 |

`formula1` |
The formula where the dependent variables are the manifest variables, grouped by |

`formula2` |
The formula where the dependent variables are the manifest variables, grouped by |

`data` |
a dataframe containing all variables appearing in |

`nclass` |
the number of latent classes assumed in the model. |

`maxiter` |
the maximum number of iterations through which the estimation algorithm will cycle. |

`tol` |
A tolerance value for judging when convergence has been reached. When the one-iteration change in the estimated log-likelihood is less than |

`beta.start` |
a vector of parameters |

`alpha.start` |
an |

`gamma.start` |
an |

`beta.auto` |
logical, indicating whether |

`alpha.auto` |
logical, indicating whether |

`gamma.auto` |
logical, indicating whether |

`nrep` |
number of times the model is estimated, using different values of |

`verbose` |
logical, indicating wheter |

`calc.se` |
logical, indicating whether |

We denote individuals by *i* (*i=1,…,N*), manifest variables (items) by *Y_m* (*m=1,…,M*), levels of the manifest variables by *k* (*k=1,…,K* ), the latent variable by *S* (*S=j* and *j=1,…,J*).
There are two sets of covariates: those related with the latent class probabilities, *\mathbf{x_i}=(1,x_{i1},…,x_{iP})^T*, and those which can have a direct effect on the manifest variables, *\mathbf{z_i}=(\mathbf{z_{i1}},…,\mathbf{z_{iM}})* with *\mathbf{z_{im}}=(1,z_{im1},…,z_{imL})^T*, *m=1,…,M*.
The parameters of the model are the latent class probabilities *π_j(\mathbf{x}'_i\boldsymbol{β})=P(S_i=j;\mathbf{x}_i)* and the conditional probabilities *p_{mkj}(\boldsymbol{γ}_{mj}+\boldsymbol{z}'_{im}\boldsymbol{α}_m)=P(Y_{im}=k|S_i=j;\boldsymbol{z}_{im})*.

The model is

*P(\mathbf{Y_i}=\mathbf{y}|\mathbf{x}_i, \mathbf{z}_i)=P(Y_{i1}=y_{1},…,Y_{iM}=y_M|\mathbf{x}_i, \mathbf{z}_i)*

*=∑_{j=1}^{J} ≤ft\{π_j(\mathbf{x}'_i\boldsymbol{β}) ∏_{m=1}^{M} p_{mkj}^{y_{imk}}(\boldsymbol{γ}_{mj}+\boldsymbol{z}'_{im}\boldsymbol{α}_m)\right\}*

with

*\log≤ft(\frac{π_j(\mathbf{x}'_i\boldsymbol{β})}{π_J(\mathbf{x}'_i\boldsymbol{β})}\right)= \mathbf{x}'_i\boldsymbol{β}_j \qquad i=1,…,N ;\quad j=1,…,(J-1)*

and

*\log≤ft(\frac{p_{mkj}(\boldsymbol{γ}_{mj}+\mathbf{z}'_{im}\boldsymbol{α}_m)}{p_{mKj}(\boldsymbol{γ}_{mj}+\boldsymbol{z}'_{im}\boldsymbol{α}_m)}\right)=γ_{mkj}+\mathbf{z}'_{im}\boldsymbol{α}_{mk}*

The output of function `covLCA()`

is a list containing the following elements:

`llik` |
The log-likelihood value of the estimated model. |

`attempts` |
A vector containing the maximum loglikelihood values found in each of the |

`beta.start` |
A vector containing the initial values for parameters |

`alpha.start` |
A vector containing the initial values for parameters |

`gamma.start` |
A vector containing the initial values for parameters |

`beta.auto` |
Logical, indicating whether the user asked for “reasonable” initial estimates of parameters |

`alpha.auto` |
Logical, indicating whether the user asked for “reasonable” initial estimates of parameters |

`gamma.auto` |
Logical, indicating whether the user asked for “reasonable” initial estimates of parameters |

`beta.initAuto` |
A vector containing the initial values for parameters |

`alpha.initAuto` |
A vector containing the initial values for parameters |

`gamma.initAuto` |
A vector containing the initial values for parameters |

`probs` |
An |

`prior` |
An |

`posterior` |
An |

`predclass` |
A vector of length |

`P` |
The respective size of each latent class, equal to the mean of the priors. |

`numiter` |
The number of iterations required by the estimation algorithm to achieve convergence. |

`coeffBeta` |
An |

`param.se` |
A vector containing the standard error of each estimated parameter, in the following order: |

`param.V` |
The covariance matrix of the coefficient estimates (in the same order as in |

`coeffGamma` |
An |

`coeffAlpha` |
An |

`meanProbs` |
An |

`eflag` |
Logical, error flag. |

`npar` |
The number of estimated parameters. |

`aic` |
Value of the AIC criterion for the estimated model. |

`bic` |
Value of the BIC criterion for the estimated model. |

`Nobs` |
Number of fully observed cases. |

`x` |
A dataframe containing the covariates for the latent class probabilities. |

`z` |
A dataframe containing the covariates for the conditional probabilities. |

`y` |
A dataframe containing the manifest variables. |

`identifiability` |
A list containing the eigenvalues and the inverse condition number of the matrices involved in conditions (iii') and (iv') of Theorem 1 (Local Identifiability) in Huang and Bandeen-Roche (2004). |

`maxiter` |
The maximum number of iterations of the estimation algorithm. |

`resid.df` |
The number of residual degrees of freedom, equal to the lesser of |

`time` |
Computation time of model estimation. |

This function is an extension of the source code of the R package `poLCA`

(Linzer and Lewis, 2011) to the methodology proposed by Huang and Bandeen-Roche (2004).

Bertrand, A., Hafner, C.M. (2011) On heterogeneous latent class models with applications to the analysis of rating scores. Louvain-la-Neuve: Universite catholique de Louvain, Institute of Statistics, Biostatistics and Actuarial Sciences. Discussion paper 2011/28. Available at: http://uclouvain.be/cps/ucl/doc/stat/documents/ISBADP2011-28_On_heterogeneous_latent_class_models...pdf

Huang, G.-H., Bandeen-Roche K. (2004) Building an identifiable latent class model with covariate effects on underlying and measured variables. *Psychometrika*, **69**(1), 5–32.

Linzer, D.A., Lewis J. (2011) poLCA: Polytomous Variable Latent Class Analysis. R package version 1.3.1.

Linzer, D.A., Lewis J. (2011) poLCA: an R Package for Polytomous Variable Latent Class Analysis. *Journal of Statistical Software*, **42**(10), 1–29. http://www.jstatsoft.org/v42/i10

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ```
## 2 models for a subset of dataset election in package poLCA
library("poLCA")
data("election",package="poLCA")
election$GENDER <- factor(election$GENDER)
elec <- election[,c(1:3,7:12,16:17)]
elec <- na.omit(elec)
elec <- elec[1:200,]
## Model 1: 3 classes, 1 covariate for modelling latent class membership
fm1 <- cbind(MORALG,CARESG,KNOWG,MORALB,CARESB,
KNOWB)~PARTY
poLCA1 <- poLCA(formula=fm1,data=elec,nclass=3,nrep=10)
## Model 2: 3 classes, 1 covariate in the model for latent class membership,
## 1 covariate in the model for the manifest variables probabilities
fm2 <- cbind(MORALG,CARESG,KNOWG,MORALB,CARESB,
KNOWB)~1+PARTY
fm3 <- cbind(MORALG,CARESG,KNOWG,MORALB,CARESB,
KNOWB)~1+GENDER
covLCA1 <- covLCA(formula1=fm2,formula2=fm3,data=elec,nclass=3,
beta.auto=TRUE,gamma.auto=TRUE,alpha.auto=TRUE,maxit=10000)
## Not run: ## 2 models for dataset election in package poLCA
library("poLCA")
data("election",package="poLCA")
election$GENDER <- factor(election$GENDER)
elec <- election[,c(1:12,16:17)]
elec <- na.omit(elec)
## Model 1: 3 classes, 1 covariate for modelling latent class membership
fm1 <- cbind(MORALG,CARESG,KNOWG,LEADG,DISHONG,INTELG,MORALB,CARESB,
KNOWB,LEADB,DISHONB,INTELB)~PARTY
poLCA1 <- poLCA(formula=fm1,data=elec,nclass=3,nrep=10)
## Model 2: 3 classes, 1 covariate in the model for latent class membership,
## 1 covariate in the model for the manifest variables probabilities
fm2 <- cbind(MORALG,CARESG,KNOWG,LEADG,DISHONG,INTELG,MORALB,CARESB,
KNOWB,LEADB,DISHONB,INTELB)~1+PARTY
fm3 <- cbind(MORALG,CARESG,KNOWG,LEADG,DISHONG,INTELG,MORALB,CARESB,
KNOWB,LEADB,DISHONB,INTELB)~1+GENDER
covLCA1 <- covLCA(formula1=fm2,formula2=fm3,data=elec,nclass=3,
beta.auto=TRUE,gamma.auto=TRUE,alpha.auto=TRUE,maxit=10000)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.