## What’s this about?

We believe that there are groups in our population and that individuals in these groups behave differently. But we don’t have a variable that identifies the groups.

The groups may be consumers with different buying preferences, adolescents with different patterns of behavior, or health status classifications.

LCA lets us identify and understand these unobserved groups. It lets us know who is likely to be in a group and how that group’s characteristics differ from other groups.

In latent class models, we use a latent variable that is categorical to represent the groups, and we refer to the groups as classes.

Latent class models contain two parts. One fits the probabilities of who belongs to which class.

The other describes the relationship between the classes and the observed variables.

The LCA models that Stata can fit include the classic models:

- probability of class membership
- binary items

And extensions:

- covariates determining the probability of class membership
- items that are binary, ordinal, continous, or even any of the other types that Stata’s
**gsem**can fit - SEM path models that vary across latent classes

## Let’s see it work

Let’s work with a classic model using an example of teen behavior (but on fictional data).

We have a set of observed variables that indicate whether adolescents have consumed alcohol (**alcohol**), have more than 10 unexcused absences from school (**truant**), have used a weapon in a fight (**weapon**), have engaged in vandalism (**vandalism**), and have stolen objects worth more than $25 (**theft**). We will use these items to fit a latent class model with three unobserved behavior classes. We type

.gsem (alcohol truant weapon theft vandalism <-), logit lclass(C 3)

We will not show the output of this command. If we had included predictors of the class probabilities or fit a latent profile model with continuous outcomes or fit a path model, the results would be more interesting. In this classic model, however, the reported coefficients are not very informative.

Instead, we will use the **estat lcprob** and **estat lcmean** commands to estimate statistics that we can interpret easily.

**estat lcprob** reports the probabilities of class membership

These are the expected proportions of the population in each class.

**estat lcmean** reports the estimated mean for each item in each class.

The results are the probabilities of **alcohol**, **truant**, etc., for each class. Our items are binary events. Had **alcohol** been the amount of alcohol consumed per day, **estat lcmean** would have reported average alcohol consumption for each class.

Let’s summarize the results from **estat lcprob** and **estat lcmean**.

The table reveals that

1) 16%, 80%, and 4% percent of our students are predicted to be in class 1, class 2, and class 3, respectively.

2) Class 2 is best behaved judging by the probabilities of **alcohol**, **truant**, …, and **vandalism**.

3) Class 1 is the next best behaved.

4) Class 3 is the worst behaved.

We can use **margins** and **marginsplot** to visually compare the probabilities of participating in these activities across classes.

## Extensions

We fit our classic LCA model by typing

.gsem (alcohol truant weapon theft vandalism <-), logit lclass(C 3)

If we believe class membership depends on parents’ income, we can include it in the model for **C** by typing

.gsem (alcohol truant weapon theft vandalism <-, logit) (C <- income), lclass(C 3)

We moved **logit** inside the parentheses for the five behavior items. This means it applies only to those equations. We don’t need to say that the model for **C** is multinomial logit; that is automatic.

We are not limited to **logit** models for our items. If the behavior items are instead continuous, we can type

.gsem (alcohol truant weapon theft vandalism <-, gaussian), lclass(C 3)

If they are ordinal, we can type

.gsem (alcohol truant weapon theft vandalism <-, ologit), lclass(C 3)

And if the behavior items are of differing types, we can even type

.gsem (alcohol <-, gaussian) (truant <-, poisson) (weapon <-, logit) (theft <-, ologit) (vandalism <-, logit), lclass(C 3)

Still, this just scratches the surface of what we can do with **gsem**‘s new latent class features. For instance, **gsem** fits path models such as

.gsem (y1 <- y2 x1 x2) (y2 <- y3 x1 x3) (y3 <- x2 x3 x4)

and we can allow them to vary across classes,

.gsem (y1 <- y2 x1 x2) (y2 <- y3 x1 x3) (y3 <- x2 x3 x4), lclass(C 2)

You can also view our services or contact us to assist you run analysis.

## oprolevorter