title: Reshaping the data for a multinomial regression
body: <p>I am currently learning about the multinomial logit estimator and I want to use it to estimate a model in <code>R</code> with the <code>mlogit</code> package. After reading extensively on the subject, it was clear that an important step in the process is the reshaping of the data using the <code>mlogit.data()</code> function. My data frame contains the following information:</p>
  
  <ol>
  <li><code>satisfaction</code>: which is a categorical variable from 1 (very dissatisfied) to 5 (very satisfied.</li>
  <li><code>education</code>: which is the number of years of education of the individual</li>
  <li><code>country</code>: which is the country of origin of the individual</li>
  <li><code>average_income</code>: which is the average income in the country</li>
  </ol>
  
  <p>Here is a visual represention of the data frame:</p>
  
  <pre><code>&gt; dat
     country satisfaction education income
  1        1            3        12    750
  2        1            5        13    750
  3        1            2        10    750
  4        3            4        13    675
  5        3            5        14    675
  6        3            4        11    675
  7        3            1        14    675
  8        2            1        11    820
  9        2            5        14    820
  10       2            3        12    820
  </code></pre>
  
  <p>The <code>mlogit()</code> function does not seem to like it in this form. I am trying to estimate the model with <code>satisfaction</code> as the dependent variable and <code>education</code> as the independent variable.</p>
  
  <p>How can I reshape it to make it work?</p>