0

I am trying to run a multinomial regression create a multinomial model for my discrete choice experiment regarding the recreational fishing permit system in South Africa. I keep receiving an error.

My data is as follows: All column heads after choice are alternative levels.

structure(list(Respondent = c(1, 1, 1, 1, 1, 1), ID = c(1, 2, 
3, 4, 5, 6), ChoiceSet = c(1, 1, 2, 2, 3, 3), Alternative = c(1, 
2, 1, 2, 1, 2), Choice = c(1, 0, 1, 0, 0, 1), ML = c(1, 0, 0, 
1, 0, 1), L = c(0, 0, 0, 0, 0, 0), S = c(0, 0, 0, 0, 0, 0), M = c(0, 
1, 0, 0, 1, 0), MM = c(0, 0, 1, 0, 0, 0), AZ = c(1, 0, 0, 0, 
1, 0), NCR = c(0, 0, 0, 1, 0, 1), NR = c(0, 0, 1, 0, 0, 0), NNZ = c(0, 
1, 0, 0, 0, 0), P = c(1, 0, 0, 0, 1, 0), LC = c(0, 0, 1, 0, 0, 
1), D = c(0, 1, 0, 1, 0, 0), DC = c(0, 0, 0, 1, 1, 0), NC = c(0, 
1, 0, 0, 0, 1), I = c(0, 0, 0, 0, 0, 0)), row.names = c(NA, -6L
), class = c("tbl_df", "tbl", "data.frame"))

When I run the code, this runs okay:

DCE <- transform(dcdata, ML=as.integer(ML), L=as.integer(L), S=as.integer(S),   M=as.integer(M), MM=as.integer(MM), AZ=as.integer(AZ),  NCR=as.integer(NCR), NR=as.integer(NR), NNZ=as.integer(NNZ), P=as.integer(P), LC=as.integer(LC), D=as.integer(D),DC=as.integer(DC), NC=as.integer(NC), I=as.integer(I), Choice=as.logical(Choice))

Permitdata <- mlogit.data(data=DCE, choice = "Choice", shape = "long", alt.var = "Alternative", id.var = "ID")

But this leads to an error:

Permitmodel <- mlogit(Choice ~ ML+L+S+M+MM+AZ++NCR+NR+NNZ+P+LC+D+DC+NC+I| 0, Permitdata)
Error in solve.default(H, g[!fixed]) : 
  Lapack routine dgesv: system is exactly singular: U[15,15] = 0

I am not sure how to fix this. Thank you in advance for your assistance

Andrea M
  • 2,314
  • 1
  • 9
  • 27
  • Does this answer your question? [R solve:system is exactly singular](https://stackoverflow.com/questions/6572119/r-solvesystem-is-exactly-singular) – langtang Aug 12 '22 at 13:56
  • Not quite but thank you for your input, I changed my data format and now it is working – Aidan du Preez Aug 16 '22 at 07:02

0 Answers0