I want to transform my data to a mlogit.data and I did this
a<- mlogit.data(Fit.Train.KNN, choice ="Vote",
shape = c("wide"),
alt.levels = c( "Scioli","Macri",
"Massa", "Carrio", "Sanz ","Stolbizer", "Indecisos", "Voto en blanco"))
When I did this the data was cool, have chid and alt and in the choice put True when a man vote for a candidate and false for the other options.
But when I want to do the model of mlogit:
Model.mulnom<- mlogit("Vote " ~ "Gender" , shape = c("long"), id="id",
alt.levels = c( "Scioli","Macri",
"Massa", "Carrio",
"Sanz ","Stolbizer", "Indecisos",
"Voto en blanco") ,
reflevel= "Scioli",choice = "Vote", data= a
)
I get the following error message. I thought that the code was right and I don't know where the problem is.
**Error in solve.default(H, g[!fixed]) :
Lapack routine dgesv: system is exactly singular: U[2,2] = 0**