Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mixed effects model with random slopes for several factor variables

    Dear all,

    I’m using STATA 14.

    As far as I understand, I can’t run the command mixed with random slopes for several factor variables. I can run something like:

    Code:
    mixed decision i.profit i.feedback || id: R.profit
    where decision captures some behavior from my sample of participants,
    profit is a factor variable that captures three profit levels (e.g., low, medium, high),
    feedback is a factor variable that captures three feedback types (e.g., simple, normal, complex),
    and id identifies my participants.

    But I can’t run something like:

    Code:
    mixed decision i.profit i.feedback || id: R.profit R.feedback
    An error like the following would appear when running the previous command:

    R.profit R.feedback invalid level specification
    r(198);

    Among the stuff I have read, I saw a suggestion about creating indicator variables to bypass this problem. Based on that, and using the command xi, I create them, something like:

    Code:
    xi i.profit
    xi i.feedback
    I’m not really sure about how I should run the mixed effects model. This is my try:

    Code:
    xi: mixed decision i.profit i.feedback || id: i.profit i.feedback
    It runs, but I don’t know if it makes sense. Is this approach correct?

    Thanks!

  • #2
    Yes, that does it. Unfortunately, you will not be able to avail yourself of -margins- afterward.

    Comment


    • #3
      Thanks Clyde!

      Sorry, I have to ask because I'm not a STATA expert... What are -margins-? What are they useful for?

      Comment


      • #4
        The -margins- command is one of Stata's best features. Following any Stata estimation command, if you have used factor-variable notation, it allows you to calculate adjusted predicted values and marginal effects in groups defined by levels of your variables (or combinations of those). I think the best introduction to -margins- is the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf. It displays the commonest simple applications of -margins-, with examples and descriptions.

        The command is capable of far more complicated calculations of post-estimation results, and for those you can read about it in the PDF documentation that comes with your Stata installation. (Run -help margins- and then click on the link to the PDF documentation near the top of the screen.) The PDF documentation is lengthy and extensive, but is very well written and has many worked examples.

        Comment


        • #5
          Thanks for the info!

          Comment

          Working...
          X