Random intercept and slope model

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Random intercept and slope model

E. Bernardo
Dear SPSS users/experts,

Below is a syntax for random intercept and slope model. It works and the results show that both intercept and slope are significant. 
Next, is to test if the variability of slope and intercept can be predicted using some other variables such as GENDER, AGE, EDUC and GENDER*EDUC. Can someone know how the GENDER, AGE, EDUC and GENDER*EDUC can be incorporated in the syntax below?

Mixed Y with Time
/fixed INTERCEPT TIME
/RANDOM INTERCEPT TIME | SUBJECT(ID) COVTYPE(UN)
/PRINT SOLUTION TESTCOV.

Thank you.
Eins
Reply | Threaded
Open this post in threaded view
|

Re: Random intercept and slope model

Maguin, Eugene

Think of how you (have/will) set up your dataset. One row for each time point; multiple rows per person. Within person, what changes from row to row? The time value, right. What changes from person to person? Well, their values on gender, education, age. So all rows for a person get the same values for gender, education, age.  A useful book to look at is Singer and Willett. Bruce likes a book by Twisk, I believe it is. But there are others too.

 

Perhaps you already know this but you have to think of your level 1 and level 2 equations.

Your level 1 equation is

Y(i,j) = B0(i) + B1(i)*Time(j) + e(i,j). where i is the person and j is the time point.

 

Because you have specified Time on the random subcommand you are allowing its coefficient, B1, to have a variance, that is, to be random. Because of that you have two level 2 equations, one for the B0 coefficient, the intercept, and one for the B1 coefficient, the Time slope.

 

B0(i) = G10 + G11*Gender + G12*Age + G13*Educ + G14*Gender by Educ + r11(i).

B1(i) = G20 + G21*Gender + G22*Age + G23*Educ + G24*Gender by Educ + r21(i).

Note. I’m assuming that both age and educ are dichotomous variables so that a single coefficient is enough to represent the effect. Most likely, they aren’t and therefore there will be a set of contrast coefficients for each variable and their interaction.

 

However, the level 2 equations could simpler. Suppose you think that only Gender affects the slope. Then:

B1(i) = G20 + G21*Gender + r21(i).

 

 

The next part is an open invitation to make mistakes in the command syntax. Either in your head or on paper, you need to substitute the Level 2 equations into the level 1 equation and write out the total equation. To wit:

 

Y(I,j) = [G10 + G11*Gender + G12*Age + G13*Educ + G14*Gender by Educ + r11(i)] +

              Time*[G20 + G21*Gender + G22*Age + G23*Educ + G24*Gender by Educ + r21(i)] +

              e(i,j).

 

Note that since you have allowed the time coefficient to be random, you now have interactions between Time and each of your level 2 (person) factors. (Example 8 in the CSR shows this.) So now your model statement is

 

Mixed Y with Time by GENDER, AGE, EDUC
/fixed INTERCEPT TIME GENDER, AGE, EDUC GENDER*EDUC

Time*GENDER, Time*AGE, Time*EDUC Time*GENDER*EDUC
/RANDOM INTERCEPT TIME | SUBJECT(ID) COVTYPE(UN)
/PRINT SOLUTION TESTCOV.

 

Or, using the other level 2 equation for B1

 

Mixed Y with Time by GENDER, AGE, EDUC
/fixed INTERCEPT TIME GENDER, AGE, EDUC GENDER*EDUC

Time*GENDER
/RANDOM INTERCEPT TIME | SUBJECT(ID) COVTYPE(UN)
/PRINT SOLUTION TESTCOV.

 

Gene Maguin

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of E. Bernardo
Sent: Tuesday, December 11, 2012 1:35 AM
To: [hidden email]
Subject: Random intercept and slope model

 

Dear SPSS users/experts,

 

Below is a syntax for random intercept and slope model. It works and the results show that both intercept and slope are significant. 

Next, is to test if the variability of slope and intercept can be predicted using some other variables such as GENDER, AGE, EDUC and GENDER*EDUC. Can someone know how the GENDER, AGE, EDUC and GENDER*EDUC can be incorporated in the syntax below?

 

Mixed Y with Time
/fixed INTERCEPT TIME
/RANDOM INTERCEPT TIME | SUBJECT(ID) COVTYPE(UN)
/PRINT SOLUTION TESTCOV.

 

Thank you.

Eins

Reply | Threaded
Open this post in threaded view
|

Re: Random intercept and slope model

Ryan
In reply to this post by E. Bernardo

Eins,

I just saw that Gene responded to you. I haven't read his post, but since I have finished writing a response which adds one variable (gender) to the model, I will provide it...

Level 1 Equation:

y = B0J + B1J*time + eij

Level 2 Equations:

B0J = Gamma00 + Gamma01*gender + u0j
B1J = Gamma10 + Gamma11*gender + u1j

Full Equation:

y = Gamma00
    + Gamma01*gender
    + Gamma10*time
    + Gamma11*gender*time 
    + ( u1j*time + u0j + eij )

SPSS code that conforms to the equation above would be:

mixed y by gender with time
 /fixed= gender time gender*time | sstype(3)
 /print= g solution
 /random=intercept time | subject(subject) covtype(<specify structure>).

Ryan
 

On Tue, Dec 11, 2012 at 1:35 AM, E. Bernardo <[hidden email]> wrote:

Dear SPSS users/experts,

Below is a syntax for random intercept and slope model. It works and the results show that both intercept and slope are significant. 
Next, is to test if the variability of slope and intercept can be predicted using some other variables such as GENDER, AGE, EDUC and GENDER*EDUC. Can someone know how the GENDER, AGE, EDUC and GENDER*EDUC can be incorporated in the syntax below?

Mixed Y with Time
/fixed INTERCEPT TIME
/RANDOM INTERCEPT TIME | SUBJECT(ID) COVTYPE(UN)
/PRINT SOLUTION TESTCOV.

Thank you.
Eins