Two-way table with Latent Class variable

Hi. I have modelled four latent classes out of a dataset about videogamers. I would like to see the gender distribution in the four different classes. That is, I would like to make a two-way table with gender as the first variable and the four classes as the other variable. I have tried to give an example below. Can anyone help me?

          class 1    class 2       class 3        class 4

male 12% 43 % 35 % 73 %
female 88 % 57 % 65 % 27 %

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Hi

Thanks for your response. Here is a reprex:

install.packages("poLCA")
library(poLCA)

data("values")

f.values<-cbind(A, B, C) ~ 1
M1 <- poLCA(f.values, data = values, nclass= 2, graphs = TRUE, na.rm = TRUE)

Based on the latent class modelling i decide on a two-class model as the best fit. Now I would like to generate a discrete variable out of the latent class model, where the respondents in the first class in the latent class model gets the value 1 and the respondents in the second class gets the value 2. We can call the variable 'valueclass'. Then i would like to make a two-way table with 'D' as the first variable and 'valueclass' as the other variable. Can you help?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.