I am running multinomial logit model using mlogit in R. The model includes 3 alternatives as the dependent variable and 4 individual specific predictors. The three of them are factors while the other predictor is in class numeric.I have two questions.
Question 1: When I run model with four predictors as described above, it returns the following error in R.
mlogit_model<-mlogit(y ~ 1| x1+x2+x3+x4, data=dat_long, reflevel = "3")
Error in solve.default(H, g[!fixed]) :
system is computationally singular: reciprocal condition number = 8.31637e-17
However, when it includes only three predictors of class factor only it runs.
Question 2: How could the marginal effects of explanatory variables be computed when there are factor predictors. I found the following way for numeric variables. But it does not work for class factor variables.
z<-with (dat_long, data.frame(x1 = tapply(x1, index(mlogit_model)$alt,mean),x2=tapply(x2,index(mlogit_model)$alt,mean), x3=tapply(x3, index(mlogit_model)$alt,mean)))
effects(mlogit_model,covariate = "x1", data=z)
Any help would be much appreciated.