Dear all,
I have data from a Discrete Choice Experiment that I have converted from a wide format to a long format. Please find below example data (my actual dataset has 1800 cells).
More information about the experimental design: There are 12 choice sets, with 2 alternatives (A and P) and an opt-out option (W). Tuition and Duration are modified for each of the choicesets. Q1 to Q12 are questions about the respondent.
After converting my wide format to a long format, I would like to estimate it with a mixed logit and nested logit. However, I keep getting the following error: Error in solve.default(H, g[!fixed]) : system is computationally singular: reciprocal condition number = 1.96095e-16
realdata=read_excel("Wide dataset real.xlsx")
realdata$index <- 1:nrow(exampledata)
elec = dfidx(realdata, idx = list(c("index", "id")),
choice="RChoice", varying =15:20, sep = "_")
View(elec)
index(elec)
my_mixed_logit = mlogit(data = elec,
RChoice~ Duration+Tuition|Q1+Q2+Q3+Q4+Q5,
rpar = c(Duration="n", Tuition="n"),
# R is the number of simulation draws
R = 100,
correlation = T,
# This data is from a panel
panel = TRUE)
mixedlogit2=mlogit(RChoice~Duration + Tuition|Q1+Q2+Q3+Q4+Q5+Q6+ Q7+Q8, halton=NA, correlation=T, rpar=c(Duration="n", Tuition="n"), panel = TRUE, data=elec)
Would you be so kind as to help me with this problem?
Thank you in advance!
Update: It appears that I'm encountering difficulties with the variables Q1 and Q5 in my analysis, as they involve rare observations. Interestingly, when I exclude these observations, the model functions properly. However, I do want to incorporate these observations into the analysis. Can anyone provide suggestions or tips on how to handle this situation?