Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Here's what I want to do, but there seem to be no predict method for the mlogit. Any ideas?

library(mlogit)
data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")

Fish_fit<-Fish[-1,]
Fish_test<-Fish[1,]
m <- mlogit(mode ~price+ catch | income, data = Fish_fit)
predict(m,newdata=Fish_test)
share|improve this question
2  
Did you read the accompagnying vignette, Estimation of multinomial logit models in R : The mlogit Packages? It seems to me you just have to apply the fitted coefficients on new data, isn't it? – chl Jan 30 '11 at 10:14
@chl that's what I need to do, yes, but I was hoping I wouldn't have to re-invent the wheel. – Zach Feb 15 '11 at 17:50

2 Answers

up vote 0 down vote accepted

To answer my own question, I've moved over to using the 'glmnet' package to fit my multinomial logits, which has the added advantage of using the lasso or elastic net to regularize my independent variables. glmnet seems to be a much more 'finished' packaged than mlogit, complete with a 'predict' function.

share|improve this answer

I'm pretty sure this is easily done with the given mlogit package by using the fitted function and then the standard R predict function. As chl pointed out, although I haven't done it myself yet (at least not the predict), is exampled in the package vignettes here on pg 29.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.