Dear Specialists,
I have tried the lclogit2 for each class (2,3 and 4), I could receive results from Stata, but it would not respond if the number of classes is more than 4.
This is the command I used: lclogit2 choice, rand(price A1 A2 A3 A4) group(task) nclasses(4) id(qid) membership(X1 X2 X3 X4 X5)
I was trying to find the optimal class by the following command and hope that the best class would be 4, but Stata responded nothing, hence I can not determine the optimal classes for my model. Is there an error with the command below? and what is your advice for me?
forvalues c = 2/7 {
quietly lclogit2 choice, rand(price A1 A2 A3 A4) group(task) id(qid) nclasses(`c') membership(X1 X2 X3 X4 X5)
matrix b = e(b)
matrix ic = nullmat(ic) \ `e(nclasses)', `e(ll)',`=colsof(b)', `e(aic)', `e(caic)', `e(bic)'
}
matrix colnames ic = "Classes" "LLF" "Nparam" "AIC" "CAIC" "BIC"
matlist ic, name(columns)
Best,
Anna
Related Posts with Latent Class Model: problem with choosing the number of classes
Renaming Matrix Rows With SpacesSuppose I wish to rename the rows of a matrix. Code: clear * cls matrix A = (2,1\3,2) cls loc rn …
Extracting All Strings After a Word within a Variable NameI have a dataset representing a treated unit (GDP), a series of estimated counterfactuals, (cf) and …
Assigning value from one variable to another if condition is metI have a data manipulation question: I have a dataset with the variables "id_1", "year", and "id_2."…
Is it possible that log mis-calculates it or create weird ".b" when the workload is too heavy?I use Stata 17 (24 cores). I am sorry that I cannot provide the reproducible example because this p…
Is it possible that log mis-calculates it or create weird ".b" when the workload is too heavy?I use Stata 17 (24 cores). I am sorry that I cannot provide the reproducible example because this p…
Subscribe to:
Post Comments (Atom)
0 Response to Latent Class Model: problem with choosing the number of classes
Post a Comment