简体   繁体   中英

Error in s + x[[i]] : non-conformable arrays in R - gmnl package for Latent Class Analysis

I am running a latent class analysis for choice modeling by using gmnl package. After getting my data in the right format (mlogit.data), I met the error "Error in s + x[[i]] : non-conformable arrays" when running the gmnl model.

The code of running the models is:

 lc <- gmnl(choice ~ v1 + v2 + v3 + v4 
            + v5| 0 | 0 | 0 | 1, 
           data = car, 
           model = "lc",
           Q = 3,method = 'bhhh')

The sample of my data looks like:

数据样本

I have searched similar issues that other people met, I found this and this are quite related but neither of them has been addressed. Any help and hint will be highly appreciated.

Also, I would like to hear about any other useful packages that work well with latent class analysis, either a package from R or Python is fantastic! Thank you in advance.

I think the problem is that the number of alternatives isn't equal for all choicesets. That is not a problem when you use mlogit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM