Search code examples
rprobabilitylogistic-regressionpredictmultinomial

multinom() in R: can I use for prediction on other dataset?


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.


Solution

  • 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")