MATH 6643 Summer 2012 Applications of Mixed Models/Students/smithce/Model3
From Wiki1
Model 3 Centered Within Group and Contextual Variable
We can easily create a new variable, ses.d, which we assign how far the student deviates in ses from his or her school's mean ses:
dd$ses.d <- with( dd, dvar(ses,id))
Or equivalently:
dd$ses.d <- dd$ses - dd$ses.m
Combined Model
Fixed Portion of the Model
Random Portion of the Model
fitcd <- lme( mathach ~ ses.d*Sector + ses.m, dd,random = ~ 1 + ses | id ) # Note that id refers to schools not students!
Linear mixed-effects model fit by REML
Data: dd
AIC | BIC | logLik |
23891.45 | 23947.34 | -11936.73 |
Random effects:
Formula: ~1 + ses | id
Structure: General positive-definite, Log-Cholesky parametrization
StdDev | Corr | |
(Intercept) | 1.756^{1} | (Intr) |
ses | 0.352^{2} | 0.555^{3} |
Residual | 6.075^{4} |
Fixed effects: mathach ~ ses.d * Sector + ses.m
Value | Std.Error | DF | t-value | p-value | |
(Intercept) | 13.767^{5} | 0.330 | 3602 | 41.721 | 0.00E+00 |
ses.d | 1.485^{6} | 0.235 | 3602 | 6.321 | 0.00E+00 |
SectorPublic | -1.825^{7} | 0.458 | 77 | -3.983 | 2.00E-04 |
ses.m | 5.354^{8} | 0.568 | 77 | 9.418 | 0.00E+00 |
ses.d:SectorPublic | 1.422^{9} | 0.316 | 3602 | 4.504 | 0.00E+00 |
Correlation:
(Intr) | ses.d | SctrPb | ses.m | |
ses.d | 0.125 | |||
SectorPublic | -0.736 | -0.089 | ||
ses.m | -0.085 | 0.008 | 0.247 | |
ses.d:SectorPublic | -0.093 | -0.744 | 0.118 | -0.002 |
Standardized Within-Group Residuals:
Min | Q1 | Med | Q3 | Max |
-3.095 | -0.733 | 0.026 | 0.748 | 2.829 |
Number of Observations: 3684
Number of Groups: 80
L <- list( 'Effect of ses' = rbind( "Within-school" = c( 0,1,0,0,0), "Contextual" = c( 0,-1,0,1,0), "Compositional" = c( 0,0,0,1,0))) wald( fitcd,L )
numDF | denDF | F.value | p.value | |
Effect of ses | 2 | 77 | 63.84225 | <.00001 |
Estimate | Std.Error | DF | t-value | p-value | Lower 0.95 | Upper 0.95 | |
Within-school | 1.485^{6} | 0.235 | 3602 | 6.321 | <.00001 | 1.024 | 1.946 |
Contextual | 3.869^{10} | 0.613 | 77 | 6.308 | <.00001 | 2.648 | 5.090 |
Compositional | 5.354^{8} | 0.568 | 77 | 9.418 | <.00001 | 4.222 | 6.486 |
Notes
- 1.
- 2.
- 3.
- 4.
- 5 Intercept for Catholic schools
- 6 Within school effect of ses.d (student deviation from their school mean) for Catholic schools
- 7 Change in Intercept for Public schools (e.g. Intercept for Public = 13.767 - 1.825 = 11.942)
- 8 Increase in mathach associated with 1 unit increase in school mean ses holding the student's school relative position constant (e.g. increase in mathach from a student 1 unit below his school mean of X compared to a student 1 unit below a school mean of X + 1). This is the between school effect for Catholic schools (e.g. This is the difference going from a student with ses = X in a school with mean ses = Y to a student with ses = X + 1 in a school with mean ses = Y + 1)!
- 9 Change in within-school ses.d for Public schools (e.g. ses.d slope for Public = 1.485 + 1.422 = 2.907)
- 10 To compute the contextual effect (taking a student with a constant ses and shifting them to a school with ses.m + 1) we need to take the compositional effect and subtract the within school effect,