Search code examples
matlablogistic-regressionmultinomial

MATLAB Multinomial Logistic Regression Inputs


This is my first time attempting to use multinomial logistic regression, and I'm having a hard time getting started. I currently have a dataset of 203 observations with 22 independent variables and 1 dependent variable, all of which are numerical and continuous. My goal is to use MATLAB mnrfit function to predict the probabilities of future observations having a dependent variable falling into one of three intervals (y<0, 0<y<5, and 5<y).

How would I input my data into the mnrfit function to get these results? I believe that I would have to use this function to get the coefficients and then use the mnrval function to determine the probabilities for future observations. Thanks for the help!


Solution

  • Given http://se.mathworks.com/help/stats/mnrfit.html

    It seems all you have to do is turn your Y variable to an integer array, something like

    say Yord = (Y>0) + (Y>5) + 1

    then call B = mnrfit(X, Yord)

    where X is the matrix of predictors/features

    reshape B in the way suggested in the example on the link above and finally call mnrval(B, X) to get the probabilites of being less than zero, between zero and five or above zero