I am working with a conjoint dataset and estimating multinomial logit models. To work with the mlogit
package I had to convert the data, which I did like this:
dat <- mlogit.data(dat, choice="Selection_dummy", shape="long", alt.var="Alt_id", id = "Resp_id")
After converting the data, estimating the MNL model works fine. However, when I want to estimate a latent class model this provides the error that there is no individual index:
lc2<- gmnl(Selection_dummy ~ aa + ab + ba + bb + bc + ca + cb + cc + da + db + ea + eb + None | 0 | 0 | 0 | 1, data = dat, model = 'lc', Q = 2, panel = TRUE, method = "NR")
Error in gmnl(Selection_dummy ~ aa + ab +
: No individual index
I think this might have to do with converting the dataset, because after converging it to work with the mlogit package, I cannot view the dataset anymore as it retrieves the following error:
View(dat)
Error in [.data.frame (x, start:min(NROW(x), start + len))
: undefined columns selected
Error in [.data.frame (x, start:min(NROW(x), start + len))
: undefined columns selected
I can't seem to find the issue, so does someone know what's going wrong here and how it can be solved?
Thanks a lot in advance!