After successfully running the mlogit model in R, I get an error trying to obtain marginal effects that says:
"Error in predict.mlogit(object, data) : the number of rows of the data.frame should be a multiple of the number of alternatives"
I have even tried to change line number 16 in the source code as explained in a different post and still get the same error. Any help would be appreciated. All my variables are NOT alternative specific. I have 4 alternatives.
#**model:**(ran successfully)
m<-summary(mlogit(TypOfCr~1|OneOrTwoVeh|1,data=mnldata,reflevel="PDO"))
#**means:**(ran successfully)
z <- with(mnldata, data.frame(OneOrTwoVeh=mean(OneOrTwoVeh)))
#**effects**: effects(m,covariate="OneOrTwoVeh",data=z)
effects(m,covariate="OneOrTwoVeh",data=z)
Error in predict.mlogit(object, data) :
the number of rows of the data.frame should be a multiple of the number of alternatives
The following is a link to a similar question posted on the web but I am having hard time with the solution posted there. marginal effects of mlogit in R Thanks in advance