Multinomial logistic regression with mlogit (R)

I have been trying to use the mlogit package from R and it is really difficult. I pass here some notes to make it easier the next time:

  • The formula expression has 3 parts what it is really strange at first. The best explanation is here:

,in chapter 2.4. Actually the different parts are a way to distribute the variables between variables that vary with the subject (the person or thing that does the choose) or variables that varies with the chooser plus the alternative value choosen.

  • Before using the training data you have to pass it through the function to transform it in a long format
  • You have to pass also the test data through the function and you have to make sure that you have a column for the variable that you want to predict (the value is indiferent), you have to say also the possible alternative values using alt.val
  • The result is given in probability matrix format for which you have to choose the value with highest probability

References:    ,for reference to the theory