Dear colleagues,
I am struggling mightily with the mlogit package.  First, the reason that I am 
using mlogit as opposed to multinom() in nnet is because my data is ranked, not 
just ordinal.  So, I’m really trying to fit an exploded logit or rank-ordered 
model.  All of the covariates of interest are individual-specific, none are 
alternative specific.  The code below produces a model with my covariates of 
interest, so that is good. But, I cannot get predict.mlogit or effects.mlogit 
to work *at all*.  The help package is quite unclear as to how to format the 
sample data that is fed to either of those two functions.
Can any one help in that regard?  Failing that, can anyone provide a suggestion 
for an alternative way of modelling ranked categorical data? I’m aware of the 
pmr and Rankcluster packages. The former however is also poorly documented and 
the latter is computationally intense to select clusters.  
I’m trying to do this as simply as possible while remaining loyal to the ranked 
structure of the data. 

Thanks, Simon Kiss

#Loadpackages 
library(RCurl)
library(mlogit)
library(tidyr)
library(dplyr)
#URL where data is stored
dat.url<-      
'https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv'
#Get data
dat<-read.csv(dat.url)
#Complete cases only as it seems mlogit cannot handle missing values or tied 
data which in this case you might get because of median imputation
dat<-dat[complete.cases(dat),]
#Tidy data to get it into long format
dat.out<-dat %>%
  gather(Open, Rank, -c(1,9:12)) %>%
  arrange(X, Open, Rank)
#Create mlogit object
mlogit.out<-mlogit.data(dat.out, shape='long',alt.var='Open',choice='Rank', 
ranked=TRUE,chid.var='X')
#Fit Model
mod1<-mlogit(Rank~1|gender+age+economic+Job,data=mlogit.out)

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to