user3731653 - 1 year ago 182

R Question

I am using poLCA to generate posterior latent class membership probabilities. I need to assign each of 477 participants to one of three classes. The process is a bit tedious, as I am having to look at each of three probabilities for every case. Is there a way to have R generate a dummy variable for latent class membership based on the posterior estimations? Said another way, is there a code that will generate latent class membership assignments based on the optimal probability of membership?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Look at `predclass`

, the vector of predicted class memberships by modal assignment, as indicated on the `poLCA`

help page. For example, if you do

```
data(values)
two.class.model = poLCA(cbind(A,B,C,D)~1,values,nclass=2)
```

then `two.class.model$predclass`

displays the assignment of each record to one of two classes.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**