MATH 6643 Summer 2012 Applications of Mixed Models/Students/smithce/Model2
From Wiki1
(Difference between revisions)
(Created page with "=== Model 2 with Contextual Variable === We can easily create a new variable, ses.m, which we assign the mean ses for the particular school the student is comes from: dd$ses.m ...") |
|||
Line 113: | Line 113: | ||
|- | |- | ||
| Compositional||4.608<font color=DarkOrange><sup>10</sup></font>||0.593||77||7.776||<.00001||3.428||5.788 | | Compositional||4.608<font color=DarkOrange><sup>10</sup></font>||0.593||77||7.776||<.00001||3.428||5.788 | ||
+ | |} | ||
+ | |||
+ | |||
+ | L <- list( "Within school effect of ses" = | ||
+ | rbind( "Catholic" = c(0,1,0,0,0), | ||
+ | "Public" = c(0,1,0,0,1), | ||
+ | "Pub-Cath" = c(0,0,0,0,1)) | ||
+ | ) | ||
+ | |||
+ | |||
+ | {| {{table}} | ||
+ | | ||numDF||denDF||F.value||p.value | ||
+ | |- | ||
+ | | Within school effect of ses||2||3602||114.536||<.00001 | ||
+ | |} | ||
+ | |||
+ | {| {{table}} | ||
+ | | ||Estimate||Std.Error||DF||t-value||p-value||Lower 0.95||Upper 0.95 | ||
+ | |- | ||
+ | | Catholic||1.517||0.231||3602||6.564||<.00001||1.064||1.970 | ||
+ | |- | ||
+ | | Public||2.883||0.208||3602||13.855||<.00001||2.475||3.291 | ||
+ | |- | ||
+ | | Pub-Cath||1.366||0.306||3602||4.469||1.00E-05||0.767||1.965 | ||
|} | |} | ||
Revision as of 13:27, 29 May 2012
Model 2 with Contextual Variable
We can easily create a new variable, ses.m, which we assign the mean ses for the particular school the student is comes from:
dd$ses.m <- with( dd, cvar( ses, id))
Level 1 Model
Level 2 Model (Between School Model)
Combined Model (by substitution)
Fixed Portion of the Model
Random Portion of the Model
fitc <- lme( mathach ~ ses * 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.85 | 23947.74 | -11936.92 |
Random effects:
Formula: ~1 + ses | id
Structure: General positive-definite, Log-Cholesky parametrization
StdDev | Corr | |
(Intercept) | 1.776^{1} | (Intr) |
ses | 0.365^{2} | 0.651^{3} |
Residual | 6.074^{4} |
Fixed effects: mathach ~ ses * Sector + cvar(ses, id)
Value | Std.Error | DF | t-value | p-value | |
(Intercept) | 13.809^{5} | 0.332 | 3602 | 41.592 | 0.00E+00 |
ses | 1.517^{6} | 0.231 | 3602 | 6.564 | 0.00E+00 |
SectorPublic | -1.779^{7} | 0.464 | 77 | -3.836 | 3.00E-04 |
ses.m | 3.091^{8} | 0.590 | 77 | 5.241 | 0.00E+00 |
ses:SectorPublic | 1.366^{9} | 0.3057 | 3602 | 4.469 | 0.00E+00 |
Correlation:
(Intr) | ses | SctrPb | cv(,i) | |
ses | 0.134 | |||
SectorPublic | -0.733 | -0.126 | ||
ses.m | -0.1 | -0.183 | 0.238 | |
ses:SectorPublic | -0.088 | -0.733 | 0.172 | 0.011 |
Standardized Within-Group Residuals:
Min | Q1 | Med | Q3 | Max |
-3.08703974 | -0.7342756 | 0.02854529 | 0.74982231 | 2.85516252 |
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,0,0,1,0), "Compositional" = c( 0,1,0,1,0))) wald ( fitc , L )
numDF | denDF | F.value | p.value | |
Effect of ses | 2 | 77 | 43.03857 | <.00001 |
Estimate | Std.Error | DF | t-value | p-value | Lower 0.95 | Upper 0.95 | |
Within-school | 1.517^{6} | 0.231 | 3602 | 6.564 | <.00001 | 1.064 | 1.970 |
Contextual | 3.091^{8} | 0.590 | 77 | 5.241 | <.00001 | 1.917 | 4.265 |
Compositional | 4.608^{10} | 0.593 | 77 | 7.776 | <.00001 | 3.428 | 5.788 |
L <- list( "Within school effect of ses" = rbind( "Catholic" = c(0,1,0,0,0), "Public" = c(0,1,0,0,1), "Pub-Cath" = c(0,0,0,0,1)) )
numDF | denDF | F.value | p.value | |
Within school effect of ses | 2 | 3602 | 114.536 | <.00001 |
Estimate | Std.Error | DF | t-value | p-value | Lower 0.95 | Upper 0.95 | |
Catholic | 1.517 | 0.231 | 3602 | 6.564 | <.00001 | 1.064 | 1.970 |
Public | 2.883 | 0.208 | 3602 | 13.855 | <.00001 | 2.475 | 3.291 |
Pub-Cath | 1.366 | 0.306 | 3602 | 4.469 | 1.00E-05 | 0.767 | 1.965 |
Notes
- 1.
- 2.
- 3.
- 4.
- 5 Intercept for Catholic schools
- 6 Within school effect of ses for Catholic schools
- 7 Change in Intercept for Public schools (e.g. Intercept for Public = 13.809 -1.779 = 12.03)
- 8 Increase in mathach associated with 1 unit increase in school mean ses - Contextual effect
- 9 Change in within-school effect for Public schools (e.g. ses slope for Public = 1.517 + 1.366 = 2.883)
- 10 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)