Announcement

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

  • STATA Code Needed for Mixed Model

    My model is in the pic. Also, I attached another pic of my data and how it looks. I am using a scenario-based method (Also known as factorial survey method). I have 4 independent variables. (X1, X2, X3, and X4) My independent variables are binary, either 0 or 1. My dependent variable is based on 5-likert scale (In my model I created three different scenarios to measure the DV). Moreover, I have 2 moderators (M1 =1, M2 =2, No moderator =0). Based on my model, I created 144 scenarios. In my data collection I asked my respondents to randomly answer three different scenarios that are randomly assigned to them (Yes, I needed a large sample size). My model is in the pic. Also, I attached another pic of my data and how it looks. I am using mixed model in STATA to do my analysis however I am skeptical about my code and I need help. Here is my code:
    mixed dependantvariable X1##Moderator X2##Moderator X3##Moderator X4##Moderator || ID:
    Attached Files

  • #2
    You code does not match the pictured model. In the model you pictured, M1 only moderates the effects of X1 and X2 on the outcome, and M2 only moderates the effects of X3 and X4. In your code, you have a three-valued moderator variable which moderates the effects of all four X variables.

    To fix this, you need to reorganize your data a bit. You cannot do this with a single moderator variable taking three values. You need two separate moderator variables, both of which have 0/1 values.
    Code:
    gen M1 = 1.Moderator
    gen M2 = 2.Moderator
    mixed y i.M1##(i.X1 i.X2) i.M2##(i.X3 i.X4) || ID:

    Comment


    • #3
      Thank you for your reply and help. You are right, I did not depict my model correctly. I attached the correct one. Let's consider I have one moderator, M1 and it has three levels. Also, let consider I have some control variables (age and experience), then my code should be like the following:
      mixed y age experience i.M1##(i.X1 i.X2 i.X3 i.X4) || ID: Again, thank you.
      Click image for larger version

Name:	ModelExample1.JPG
Views:	1
Size:	31.5 KB
ID:	1702343

      Comment


      • #4
        Yes, in #3, the command properly reflects the diagram.

        Comment


        • #5
          Clyde Schechter, thank you for your help.

          Comment

          Working...
          X