load(url(„https://github.com/alexanderrobitzsch/sirt/blob/master/data/data.ratings3.rda?raw=true“))

# jitter first, so the upper/lower panels are symmetric

data.ratings3 <- transform(data.ratings3,

c2=jitter(crit2), c3=jitter(crit3),

c4=jitter(crit4), c6=jitter(crit6))

library(corrgram)

panel.raters <- function (x, y, corr = NULL, col.regions, cor.method, …) {

if (!is.null(corr))

return()

plot.xy(xy.coords(x, y), type = "p", …)

abline(lm(y ~ x))

box(col = "lightgray")

}

corrgram(data.ratings3[,7:10], diag=panel.density, lower.panel=panel.raters, upper.panel=panel.conf)

Thanks for saving me some time trying to find a way to do it with poLCA. I appreciate your help and timely response. Again, great post for novices. Keep up the good work!

KW ]]>

thanks for your kind words ☺️ . I should do a remake of that blogpost, because the code can be made much better ;). Your question isn‘t silly at all! I had the same question and as you say, many other tools that can do LCA provide this test. The problem is: poLCA doesn‘t. I‘m not sure if there is any other R-package that can do it. Mplus and latent Gold certainly provide the test. poLCA isn‘t developed any further, so if you don‘t code the test yourself with help from a statistics textbook, i‘m afraid you have to switch. ]]>

This is a great page and your assistance above is generous and helpful to all of us that are new to this. The automation of the results is especially awesome.

I apologize if this is silly question, but I am a novice at LCA and have been asked to present Lo-Mendell-Rubin likelihood ratio tests. I didn’t see a reference to them on your page, Is it possible to obtain these results from poLCA? Or is there a computation I can do using the obtained results? I see a lot of resources to compute these LR tests in MPLus, but was hoping to use what I learned from you above.

Thanks for any input/advice.

Best,

Kevin ]]>

f <- cbind(mv1,mv2,mv3,mv4)~1. This works, but I think that the first variable has more value to the segmentation than the last variable. Is there a way to increase or decrease value to the seperate variables? For example: mv1*5 or mv4*0.5. Thanks in advance! ]]>

for(i in 2:50){

lc <- poLCA(f, data, nclass=i, maxiter=500,

tol=1e-5, na.rm=FALSE,

nrep=10, verbose=TRUE, calc.se=TRUE)

if(lc$bic < min_bic){

min_bic <- lc$bic

LCA_best_model LCA_best_model

and the last model output is:

Fit for 35 latent classes:

number of observations: 36036

number of estimated parameters: 2029

residual degrees of freedom: 34007

maximum log-likelihood: -482547.1

AIC(35): 969152.2

BIC(35): 986383

G^2(35): 233626.8 (Likelihood ratio/deviance statistic)

X^2(35): 906572555 (Chi-square goodness of fit)

ALERT: iterations finished, MAXIMUM LIKELIHOOD NOT FOUND

]]>for(i in 2:50){

lc <- poLCA(f, data, nclass=i, maxiter=500,

tol=1e-5, na.rm=FALSE,

nrep=10, verbose=TRUE, calc.se=TRUE)

if(lc$bic < min_bic){

min_bic <- lc$bic

LCA_best_model LCA_best_model

and the last model output:

Hi Niels, I am doing LCA analysis with PoLCA, but the analysis not resulted since three days (it did not find the best model yet) and occasionally it gives the following error: „ALERT: iterations finished, MAXIMUM LIKELIHOOD NOT FOUND“. So i cancelled the process at 35 latent class. I am analyzing 16 variables (all of them categorical) and 36036 rows of data. When I test the variable importance for 16 variables in Boruta package, all the 16 variables resulted as important, so i used all 16 variables in LCA analysis with poLCA. Which path should i follow? Should I use another clustering method such as k-modes for clustering categorical variables in this dataset? I use the parameters with 500 iterations and nrep=10 model estimation number. The R script i use to find the best model in LCA and one of the outputs is as follows:

for(i in 2:50){

lc <- poLCA(f, data, nclass=i, maxiter=500,

tol=1e-5, na.rm=FALSE,

nrep=10, verbose=TRUE, calc.se=TRUE)

if(lc$bic < min_bic){

min_bic <- lc$bic

LCA_best_model LCA_best_model

and the last model output:

Hi Niels, I am doing LCA analysis with PoLCA, but the analysis not resulted since three days (it did not find the best model yet) and occasionally it gives the following error: „ALERT: iterations finished, MAXIMUM LIKELIHOOD NOT FOUND“. So i cancelled the process at 35 latent class. I am analyzing 16 variables (all of them categorical) and 36036 rows of data. When I test the variable importance for 16 variables in Boruta package, all the 16 variables resulted as important, so i used all 16 variables in LCA analysis with poLCA. Which path should i follow? Should I use another clustering method such as k-modes for clustering categorical variables in this dataset? I use the parameters with 500 iterations and nrep=10 model estimation number for up to 50 classes. The R script i use to find the best model in LCA and one of the outputs is as follows:

for(i in 2:50){

lc <- poLCA(f, data, nclass=i, maxiter=500,

tol=1e-5, na.rm=FALSE,

nrep=10, verbose=TRUE, calc.se=TRUE)

if(lc$bic < min_bic){

min_bic <- lc$bic

LCA_best_model LCA_best_model

and the last model output is:

Fit for 35 latent classes:

number of observations: 36036

number of estimated parameters: 2029

residual degrees of freedom: 34007

maximum log-likelihood: -482547.1

AIC(35): 969152.2

BIC(35): 986383

G^2(35): 233626.8 (Likelihood ratio/deviance statistic)

X^2(35): 906572555 (Chi-square goodness of fit)

ALERT: iterations finished, MAXIMUM LIKELIHOOD NOT FOUND

]]>Möchte auch mal wieder ein neues Projekt starten.

Beste Grüße,

Manuel ]]>