MATH 6643 Summer 2012 Applications of Mixed Models/Students/smithce/Model3

From Wiki1

(Difference between revisions)
Jump to: navigation, search
Line 15: Line 15:
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}(ses_{ij} - ses.m_j) +{\color{Blue}\gamma_{11}}Sector_j(ses_{ij} - ses.m_j)</math>
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}(ses_{ij} - ses.m_j) +{\color{Blue}\gamma_{11}}Sector_j(ses_{ij} - ses.m_j)</math>
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}ses_{ij} - {\color{Blue}\gamma_{10}}ses.m_j + {\color{Blue}\gamma_{11}}Sector_j ses_{ij} - {\color{Blue}\gamma_{11}}Sector_j ses.m_j</math>
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}ses_{ij} - {\color{Blue}\gamma_{10}}ses.m_j + {\color{Blue}\gamma_{11}}Sector_j ses_{ij} - {\color{Blue}\gamma_{11}}Sector_j ses.m_j</math>
-
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + ({\color{Red}\gamma_{02}} - {\color{Blue}\gamma_{10}})ses.m_j + {\color{Blue}\gamma_{10}}ses_{ij} + {\color{Blue}\gamma_{11}}Sector_j ses_{ij} - {\color{Blue}\gamma_{11}}Sector_j ses.m_j</math>
+
:<math>{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + ({\color{Red}\gamma_{02}} - {\color{Blue}\gamma_{10}} - {\color{Blue}\gamma_{11}}Sector_j)ses.m_j + ({\color{Blue}\gamma_{10}} + {\color{Blue}\gamma_{11}}Sector_j)ses_{ij}</math>
Line 91: Line 91:
  L <- list( 'Effect of ses' = rbind(
  L <- list( 'Effect of ses' = rbind(
-
"Within-school" =  c( 0,1,0,0,0),
+
"Within-school" =  c( 0,1,0,0,0),
-
"Contextual"    =  c( 0,0,0,1,0),
+
"Contextual"    =  c( 0,-1,0,1,0),
-
"Compositional" =  c( 0,1,0,1,0)))
+
"Compositional" =  c( 0,0,0,1,0)))
-
  wald ( fitcd , L )
+
  wald( fitcd,L )
{| {{table}}
{| {{table}}
Line 107: Line 107:
| Within-school||1.485<font color=DarkOrange><sup>6</sup></font>||0.235||3602||6.321||<.00001||1.024||1.946
| Within-school||1.485<font color=DarkOrange><sup>6</sup></font>||0.235||3602||6.321||<.00001||1.024||1.946
|-
|-
-
|||5.354<font color=DarkOrange><sup>8</sup></font>||0.568||77||9.418||<.00001||4.222||6.486
+
| Contextual||3.869<font color=DarkOrange><sup>10</sup></font>||0.613||77||6.308||<.00001||2.648||5.090
|-
|-
-
|||6.839<font color=DarkOrange><sup>10</sup></font>||0.617||77||11.086||<.00001||5.611||8.068
+
| Compositional||5.354<font color=DarkOrange><sup>8</sup></font>||0.568||77||9.418||<.00001||4.222||6.486
|}
|}
-
 
<u><font color=DarkOrange>Notes</font></u>
<u><font color=DarkOrange>Notes</font></u>
Line 121: Line 120:
:6 <math>{\color{Blue}\gamma_{10}} = 1.485</math>  Within school effect of ses.d (student deviation from their school mean) for Catholic schools
:6 <math>{\color{Blue}\gamma_{10}} = 1.485</math>  Within school effect of ses.d (student deviation from their school mean) for Catholic schools
:7 <math>{\color{Red}\gamma_{01}} = -1.825</math> Change in Intercept for Public schools (e.g. Intercept for Public = 13.767 - 1.825 = 11.942)
:7 <math>{\color{Red}\gamma_{01}} = -1.825</math> Change in Intercept for Public schools (e.g. Intercept for Public = 13.767 - 1.825 = 11.942)
-
:8 <math>{\color{Red}\gamma_{02}} = 5.354</math>  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)
+
:8 <math>{\color{Red}\gamma_{02}} = 5.354</math>  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 <math>{\color{Blue}\gamma_{11}} = 1.422</math>  Change in within-school ses.d for Public schools (e.g. ses.d slope for Public = 1.485 + 1.422 = 2.907)
:9 <math>{\color{Blue}\gamma_{11}} = 1.422</math>  Change in within-school ses.d for Public schools (e.g. ses.d slope for Public = 1.485 + 1.422 = 2.907)
-
:10 <math>{\color{Blue}\gamma_{10}} + {\color{Red}\gamma_{02}} = 1.485 + 5.354 = 6.839 </math> 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)
+
: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, <math>{\color{Red}\gamma_{02}} - {\color{Blue}\gamma_{10}} = 5.354 -  1.485 = 3.869</math>

Revision as of 09:24, 29 May 2012

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

mathach_{ij} = \underbrace{{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}Sector_j} + {\color{Red}\gamma_{02}ses.m_j} + {\color{Blue}\gamma_{10}}ses.d_{ij} + {\color{Blue}\gamma_{11}Sector_j}ses.d_{ij}}_{Fixed} + \underbrace{{\color{Red}u_{0j}} + {\color{Blue}u_{1j}}ses_{ij} + r_{ij}}_{Random}

Fixed Portion of the Model

{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}ses.d_{ij} + {\color{Blue}\gamma_{11}}Sector_jses.d_{ij}
{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}(ses_{ij} - ses.m_j) +{\color{Blue}\gamma_{11}}Sector_j(ses_{ij} - ses.m_j)
{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + {\color{Red}\gamma_{02}}ses.m_j + {\color{Blue}\gamma_{10}}ses_{ij} - {\color{Blue}\gamma_{10}}ses.m_j + {\color{Blue}\gamma_{11}}Sector_j ses_{ij} - {\color{Blue}\gamma_{11}}Sector_j ses.m_j
{\color{Red}\gamma_{00}} + {\color{Red}\gamma_{01}}Sector_j + ({\color{Red}\gamma_{02}} - {\color{Blue}\gamma_{10}} - {\color{Blue}\gamma_{11}}Sector_j)ses.m_j + ({\color{Blue}\gamma_{10}} + {\color{Blue}\gamma_{11}}Sector_j)ses_{ij}


Random Portion of the Model

{\color{Red}u_{0j}} + {\color{Blue}u_{1j}}ses_{ij} + r_{ij}


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

AICBIClogLik
23891.4523947.34-11936.73


Random effects:
Formula: ~1 + ses | id
Structure: General positive-definite, Log-Cholesky parametrization

StdDevCorr
(Intercept)1.7561(Intr)
ses0.35220.5553
Residual6.0754


Fixed effects: mathach ~ ses.d * Sector + ses.m

ValueStd.ErrorDFt-valuep-value
(Intercept)13.76750.330360241.7210.00E+00
ses.d1.48560.23536026.3210.00E+00
SectorPublic-1.82570.45877-3.9832.00E-04
ses.m5.35480.568779.4180.00E+00
ses.d:SectorPublic1.42290.31636024.5040.00E+00


Correlation:

(Intr)ses.dSctrPbses.m
ses.d0.125
SectorPublic-0.736-0.089
ses.m-0.0850.0080.247
ses.d:SectorPublic-0.093-0.7440.118-0.002


Standardized Within-Group Residuals:

MinQ1MedQ3Max
-3.095-0.7330.0260.7482.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 )
numDFdenDFF.valuep.value
Effect of ses27763.84225<.00001
EstimateStd.ErrorDFt-valuep-valueLower 0.95Upper 0.95
Within-school1.48560.23536026.321<.000011.0241.946
Contextual3.869100.613776.308<.000012.6485.090
Compositional5.35480.568779.418<.000014.2226.486

Notes

1. Var({\color{Red}u_{0}}) = 1.756^2
2. Var({\color{Blue}u_{1}}) = 0.352^2
3. Cov({\color{Red}u_{0}},{\color{Blue}u_{1}}) = 0.555
4. Var({\color{Black}r_{ij}}) = 6.075^2
5 {\color{Red}\gamma_{00}} = 13.767 Intercept for Catholic schools
6 {\color{Blue}\gamma_{10}} = 1.485 Within school effect of ses.d (student deviation from their school mean) for Catholic schools
7 {\color{Red}\gamma_{01}} = -1.825 Change in Intercept for Public schools (e.g. Intercept for Public = 13.767 - 1.825 = 11.942)
8 {\color{Red}\gamma_{02}} = 5.354 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 {\color{Blue}\gamma_{11}} = 1.422 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, {\color{Red}\gamma_{02}} - {\color{Blue}\gamma_{10}} = 5.354 -  1.485 = 3.869
Personal tools