[R] Mixed Logit model mlogit error

FJProenza francisco.proenza at upf.edu
Fri Aug 12 06:15:54 CEST 2011


I am new to R but I have managed to use mlogit to run multivariate logit
models successfully. My data violates the Independence of Irrelevant
Alternatives assumption and now I would like to run a mixed logit model. It
is a "wide" data set with 9 independent (individual) variables and three
choices (variable Y). The database is in a cvs file called CAU.

This is the code I have run successfully up to now. 

CAU$Y<- as.factor(CAU$Y)

mldata<-mlogit.data(CAU, varying=NULL, choice="Y", shape="wide")

mlogit.model<-mlogit(Y~1|Gender+Age+Net+CompT+Hrs+Motivado+Visits+StudyT+HrsVis,data=mldata,reflevel="1")

I am having problems running the mixed logit model. I have changed (only)
the mlogit command, as follows  

mlogit.model<-mlogit(Y~1|Gender+Age+Net+CompT+Hrs+Motivado+Visits+StudyT+HrsVis,
data=mldata,reflevel="1",rpar=c(Gender="u",Age="u",Lower="u",Mid="u",Net="u",CompT="u",Hrs="u",StudyT="u",HrsVis="u"),
correlation=TRUE, drop.index=FALSE, R=500, halton = NA)

When I try to run this command, I get the following error messages:

Error: object of type 'symbol' is not subsettable
In addition: Warning messages:
1: In if (shape == "long") { :
  the condition has length > 1 and only the first element will be used
2: In if (shape == "wide") { :
  the condition has length > 1 and only the first element will be used

Any help you can give me will be much appreciated.


--
View this message in context: http://r.789695.n4.nabble.com/Mixed-Logit-model-mlogit-error-tp3737893p3737893.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list