Announcement

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

  • Random slope and random intercept mixed linear model

    Dear Stata users,

    Can anyone please help with the following?

    I have a rather small but complex dataset consisting having these variables of interest
    Var1 = A continuous variable from 0 to approximately 7
    Var2 = A categorical variable from 1 to 3, where 1 acts as the reference for the value 2 and 3
    Var3 = A continuous variable from 5 to approximately 45
    Var4 = ID of the included patients goes from 1 to 10

    It is a paired and little unbalanced dataset without any missing data.


    Can anyone please inform me
    • how to recode the xtmixed so I can have both random slope and intercept in the model in which var2 is nested within var4?
    • how to calculate the mixed linear regression equation with 95 % confidence interval for the slope and the corresponding p-value for these three equations (I know the random effects are not listed in equations but it is rather because I don’t know how to calculate them)?
      • Var1 = intercept + var3 if var2 == 1
      • Var1 = intercept + var3 if var2 == 2
      • Var1 = intercept + var3 if var2 == 3
    • how to interpret the random effects parameters box?
    The output is as following:

    xtmixed c.var1 c.var3 i.var2|| var4: || var2:

    Performing EM optimization:

    Performing gradient-based optimization:

    Iteration 0: log likelihood = -186.78944
    Iteration 1: log likelihood = -186.29506
    Iteration 2: log likelihood = -186.29315
    Iteration 3: log likelihood = -186.29313

    Computing standard errors:

    Mixed-effects ML regression Number of obs = 109

    -------------------------------------------------------------
    | No. of Observations per Group
    Group Variable | Groups Minimum Average Maximum
    ----------------+--------------------------------------------
    Var4 | 10 5 10.9 19
    Var2 | 28 1 3.9 8
    -------------------------------------------------------------

    Wald chi2(3) = 100.09
    Log likelihood = -186.29313 Prob > chi2 = 0.0000

    ------------------------------------------------------------------------------
    Var1 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    Var3 | .0451614 .014722 3.07 0.002 .0163068 .074016
    |
    Var2 |
    2 | -1.765215 .3077596 -5.74 0.000 -2.368413 -1.162018
    3 | -2.999844 .3132985 -9.58 0.000 -3.613898 -2.38579
    |
    _cons | 4.157045 .3764994 11.04 0.000 3.41912 4.894971
    ------------------------------------------------------------------------------

    ------------------------------------------------------------------------------
    Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    Var4: Identity |
    sd(_cons) | .1781771 .248025 .0116404 2.727322
    -----------------------------+------------------------------------------------
    Var2: Identity |
    sd(_cons) | 1.67e-06 7.87e-06 1.62e-10 .0171642
    -----------------------------+------------------------------------------------
    sd(Residual) | 1.325808 .0939577 1.153871 1.523364
    ------------------------------------------------------------------------------
    LR test vs. linear model: chi2(2) = 0.16 Prob > chi2 = 0.9226

    Note: LR test is conservative and provided only for reference.


Working...
X