0

I have run a multinom() model, then how can I use these model on other dataset? For example I want to fit this model to another dataset and generate predicted probabilities for that dataset, like mnrval() did in Matlab--- it takes the model estimated by mnrfit() and apply it to outside data to generate predicted probability. I'm currently constrained with R so can't use Matlab. Thanks.

Jenny Shu
  • 47
  • 2
  • 4
  • 12
  • 1
    You posted several question on multinom. Did you checkout the answers (e.g. http://stackoverflow.com/questions/34731460/how-does-multinom-treat-na-values-by-default) e.g. using the predict which would have lead you to the answer for this question. – fishtank Jan 12 '16 at 20:04
  • If this was not a duplicate of the earlier question with an apparently on-target answer (in R), then you need to post a dataset and your efforts at coding. – IRTFM Jan 12 '16 at 21:28

1 Answers1

0

See example in ?multinom:

mymultinommodel <- multinom(low ~ ., bwt)
predict(mymultinommodel,new.data=newdata)

To get probabilities instead of predicted class:

predict(mymultinommodel,new.data=newdata, type="probs")
fishtank
  • 3,718
  • 1
  • 14
  • 16
  • but this is not giving me probabilities but rather it gives me one category for each obs. For example if my categories are cat1, cat2, cat3, then if I use predict() it's giving me a vector like "cat1 cat3 cat2 cat1". This is not the probabilities I want. What I want is something similar to what fitted() function returns (i.e. probabilities for each category), but using another dataset. Thanks. – Jenny Shu Jan 12 '16 at 20:55
  • I think it should be newdata instead of new.data, but it worked. Thanks. – Jenny Shu Jan 13 '16 at 15:21