Hi all, I have noticed that linear mixed modeling is quite
rarely discussed on SPSS-L [relative to other lists of which I am a member], and usually when it is discussed, random slopes are not
considered. As a result, I thought some might find it interesting to see a
random coefficient model employed using the MIXED procedure. Specifically, I generate data from a linear mixed
model with a random intercept and slope which are a function of fixed
intercept, fixed slope, and error terms. The random slope term suggests that
the linear effect of "time" varies across subjects. Moreover, a positive
correlation between the random intercept and slope terms suggests that higher
subject-specific (t0) intercepts (means) tend to have a greater rate of change than lower subject-specific (t0) intercepts (means). Of note, I have provided standard linear mixed model notation in the code, so we do not lose sight of how the model is built from the ground up. The next question might be to try to explain the correlation between the random intercept and slope by incorporating a 2nd-level predictor (a true multilevel model).
Although I employ the MIXED
procedure to fit this model, it is entirely possible to fit the same model
using AMOS.
Best, Ryan -- /*Generate Data*/. /*seed for random generator*/.
set seed 987879546. new file. input program. compute subject_ID = -99. compute Gamma00 = -99. compute Gamma10 = -99. compute V11 = -.99. compute V22 = -99. compute rho = -99. compute V21 = -99. compute a11 = -99. compute a21 = -99. compute a22 = -99. compute x0j = -99. compute x1j = -99. compute u0j = -99. compute u1j = -99. compute B0J = -99. compute B1J = -99. compute eij = -99. compute time = -99. leave subject_ID to time. /*1000 subjects*/. loop subject_ID = 1 to 10000. /*fixed intercept*/. compute Gamma00 = 0.50. /*fixed slope*/. compute Gamma10 = 0.30. /*random intercept var*/. compute V11 = 0.80. /*random slope var*/. compute V22 = 0.50. /*random intercept and slope corr*/. compute rho = 0.35. /*random intercept and slope cov*/. compute V21 = rho*sqrt(V11*V22). compute a11 = sqrt(V11). compute a21 = V21/a11. compute a22 = sqrt(V22 - a21*a21). /*norm. dist r.v.*/.
compute x0j = rv.normal(0,1). /*norm. dist r.v.*/. compute x1j = rv.normal(0,1). /*random intercept error term*/. compute u0j = a11*x0j. /*random slope error term*/. compute u1j = a21*x0j + a22*x1j. /*random intercept term*/. compute B0J = Gamma00 + u0j. /*random slope term*/. compute B1J = Gamma10 + u1j. /*5 time points*/. loop time = 0 to 4. /*error term*/. compute eij = rv.normal(0,1). /*full equation*/. compute y = B0J + B1J*time + eij. end case. end loop. end loop. end file. end input program. execute. MIXED y WITH time /FIXED=time | SSTYPE(3) /METHOD=REML /PRINT=SOLUTION G /RANDOM=INTERCEPT time | SUBJECT(subject_ID) COVTYPE(UNR). |
One minor correction to the initial paragraph. Where I stated that one would be interested in incorporating a second-level predictor, I should have said the purpose of incorporating a second-level predictor would be to explain the random components (random intercept and slope). I can provide a more thorough explanation at a later date. Also, st some point in the future, I may simulate data from a real-world example I have encountered either in my work or someone else's work that has been published to demonstrate incorporating a second-level predictor. There are obviously assumptions to this model, such as linearity, to name one, that should be evaluated. Finally, although I have not tried it, I think the MANOVA procedure should be capable of fitting this model as well. Again, no time to evaluate this point. That about covers my thoughts on the matter.
Best, Ryan On Fri, May 3, 2013 at 11:16 PM, Ryan Black <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |