madeleine
madeleine

Reputation: 1

DCE mlogit R error: system is computationally singular

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

example data

This is my code:

realdata=read_excel("Example Data.xlsx")

realdata$index <- 1:nrow(realdata)
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)
mixed logit 2=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)

text Would you be so kind as to help me with this problem?

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?

Upvotes: 0

Views: 59

Answers (0)

Related Questions