In this homework assignment, you will work with the TALIS 2018 (PISA linked) to answer the following questions. Please show your work and provide the R code, model output, and relevant interpretations for your analyses.

  • Level-1 (teacher) variables
    • math (outcome variable): math achievement score
    • gender: teacher gender
    • motivation: teacher motivation, a composite score based on teacher’s responses on multiple items of Question 7 in the teacher questionnaire. The original scale of the survey item includes Not important at all, Of low importance, Of moderate importance, and Of high importance.
    • satisfaction: teacher job satisfaction, a composite score based on their responses on multiple items of Question 53 in the teacher questionnaire. The original scale of the survey item includes Strongly disagree, Disagree, Agree, and Strongly agree.
  • Level-2 (school) variables
    • public: whether the school is publicly- or privately-managed from Question 12 of the principal questionnaire.
    • climate: principal’s conception of school climate, a composite score based on principals’ responses on multiple items of Question 26 in the principal questionnaire. The original scale of the survey item includes Strongly disagree, Disagree, Agree, and Strongly agree.
  • Level-3 (country) variables

1 Two-level random coefficient model (9 pts)

1.1 The model (2pts)

We first ignore the level-3 units (country level) and just focus on teachers nested within schools. Fit a random intercept and random slope model with satisfaction as the level-1 dependent variable and motivation as a level-1 predictor (without centering). Show the summary output of the model. Provide the population model and the estimation model in separate levels or in a composite model form.

# R code here for intercept and slopes coefficents
head(TALIS, 8) %>%
  kbl(booktabs = T, digits = 1, linesep = " ") %>%
  kable_styling(bootstrap_options = c("striped", "hover"),
                latex_options = "hold_position")
countryID schID teacherID gender motivation satisfaction public climate
Colombia 17000125 700101 Female 2.3 2.4 Public 2.4
Colombia 17000125 700103 Male 1.9 2.1 Public 2.4
Colombia 17000125 700104 Male 1.9 2.5 Public 2.4
Colombia 17000125 700105 Male 2.4 2.8 Public 2.4
Colombia 17000125 700108 Male 2.1 3.0 Public 2.4
Colombia 17000125 700109 Female 1.6 2.6 Public 2.4
Colombia 17000125 700110 Female 2.3 3.0 Public 2.4
Colombia 17000125 700111 Male 1.9 2.2 Public 2.4
summary(TALIS)
##           countryID         schID         teacherID        gender         
##  Turkey        :2872   79200092:   29   700201 :    9   Length:12584      
##  Czech Republic:2258   79200021:   27   700202 :    9   Class :character  
##  Colombia      :1799   79200033:   27   700308 :    9   Mode  :character  
##  Australia     :1615   79200078:   27   700904 :    9                     
##  Viet Nam      :1152   79200008:   26   701901 :    9                     
##  Georgia       : 871   79200034:   26   704702 :    9                     
##  (Other)       :2017   (Other) :12422   (Other):12530                     
##    motivation     satisfaction      public             climate    
##  Min.   :0.000   Min.   :0.000   Length:12584       Min.   :0.00  
##  1st Qu.:1.857   1st Qu.:1.750   Class :character   1st Qu.:2.00  
##  Median :2.286   Median :2.125   Mode  :character   Median :2.20  
##  Mean   :2.185   Mean   :2.134                      Mean   :2.22  
##  3rd Qu.:2.571   3rd Qu.:2.500                      3rd Qu.:2.50  
##  Max.   :3.000   Max.   :3.000                      Max.   :3.00  
## 
psych::describe(TALIS[, c("gender", "motivation", "satisfaction")]) %>%
  dplyr::select(vars, n, mean, sd, min, max, se) %>%
  kbl(booktabs = T, digits = 3)%>%
  kable_styling(bootstrap_options = c("striped", "hover"),
                latex_options = "hold_position")
vars n mean sd min max se
gender* 1 12584 1.385 0.487 1 2 0.004
motivation 2 12584 2.185 0.553 0 3 0.005
satisfaction 3 12584 2.134 0.519 0 3 0.005
mod_1 <- lmer(satisfaction ~ motivation + ( 1 | schID), data = TALIS)
summary(mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ motivation + (1 | schID)
##    Data: TALIS
## 
## REML criterion at convergence: 18184.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3949 -0.6237 -0.0091  0.7177  2.5534 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  schID    (Intercept) 0.03867  0.1966  
##  Residual             0.22762  0.4771  
## Number of obs: 12584, groups:  schID, 978
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.905e+00  2.026e-02 8.939e+03   94.02   <2e-16 ***
## motivation  1.106e-01  8.566e-03 1.233e+04   12.91   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## motivation -0.923

For the level 1 predictor of motivation, the intercept for satisfaction is 1.905-e and for every increase of unit of motivation there is a predicted increase of 1.106-e increase in satisfaction.

The population model is Yij = Gamma00 + Gamma10Motivationij + u0j + u1jMotivationij +Rijk

The estimation model is Satisfactionij Hat = 1.905-e(00) + 1.106-e(10) + + .144tau0^2 + .014 Tau1^2 + .228(sigma^2)

\[ \hat{Y}_{ij} = \gamma_{00} + \gamma_{10} \cdot \text{Motivation}_{ij} \]

Response here:

1.2 Interpretation (2 pts)

Please report and interpret the intercept and slope coefficients.

#code ofr random slopes and correlation
mod_rsm_combo <- lmer(satisfaction ~ motivation + (motivation | schID), data = TALIS)
summary(mod_rsm_combo)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ motivation + (motivation | schID)
##    Data: TALIS
## 
## REML criterion at convergence: 18141.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4417 -0.6229 -0.0128  0.7199  2.7429 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  schID    (Intercept) 0.14409  0.3796        
##           motivation  0.01385  0.1177   -0.88
##  Residual             0.22418  0.4735        
## Number of obs: 12584, groups:  schID, 978
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)   1.90064    0.02351 764.34909   80.84   <2e-16 ***
## motivation    0.11107    0.00961 777.45447   11.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## motivation -0.945

1.3 Random slopes (2 pts)

Do the slopes vary from school to school? Please provide statistical evidence to support your conclusion.

Slopes vary from school to school based on the predicted variance of .01385, probably meaning that the effect of motivation on satisfaction for teachers varies across schools. This is because the slope is not zero.

Response here:

1.4 Correlation between random intercept and random slope (2 pts)

What is the correlation between the intercepts and slopes? Do schools with large intercepts (e.g., high job satisfaction) also have large slopes (e.g., strong relationship between motivation and job satisfaction)? Please provide statistical evidence to support your conclusion. HINT: How to test for the correlation between random intercept and random slope?

The correlation between the random intercept and the random slope is -0.88, meaning that there is a high negative correlation between school teacher satisfaction and school teacher motivation. This means that schools with higher teacher satisfaction rates have predicted weaker slopes for motivation.

# R code here for empirical bayes
coef(mod_rsm_combo)$schID %>%
  kbl(booktabs = T) %>%
  kable_styling(bootstrap_options = c("striped", "hover"),
                latex_options = "hold_position")
(Intercept) motivation
3200009 2.364110 0.0161977
3200011 2.093119 0.0959608
3200013 2.161271 0.0747837
3200016 2.171795 0.0529590
3200020 2.437207 0.0197293
3200029 2.136726 0.1046395
3200032 2.232924 0.0355927
3200034 2.081806 0.0779581
3200035 2.002598 0.0801574
3200060 1.828996 0.1253593
3200075 2.156916 0.0787794
3200086 2.085641 0.0814092
3200087 1.836029 0.1437401
3200095 2.079866 0.0855243
3200105 2.150896 0.0596999
3200111 2.180511 0.0614838
3200114 2.173239 0.0372956
3200118 2.075604 0.0865300
3200124 2.340485 -0.0157801
3200129 2.265138 0.0639673
3200131 2.078609 0.0495133
3200133 2.087210 0.0632373
3200134 2.127784 0.0896985
3200138 2.443820 -0.0004488
3200149 2.391776 0.0077585
3200152 2.172032 0.0356197
3200168 2.107062 0.0947727
3200170 2.155374 0.0893860
3200177 2.176806 0.0620930
3200184 2.619943 -0.0389525
3200207 2.401928 -0.0211110
3200214 2.249871 0.0379512
3200224 2.292438 0.0105698
3200236 2.036040 0.0884819
3200240 2.275566 0.0295031
3200241 2.202216 0.0693705
3200257 2.691642 -0.0652107
3200263 2.161603 0.0708719
3200268 2.221630 0.0089581
3200281 2.419061 -0.0091513
3200296 2.215920 0.0460894
3200297 2.256394 0.0125586
3200300 2.412996 0.0011245
3200301 2.262222 0.0703357
3200319 2.065250 0.0881763
3200338 2.102735 0.0364149
3200340 2.163556 -0.0217485
3200342 2.287591 0.0433953
3200355 2.184924 0.0470605
3200361 2.079302 0.0761503
3200363 2.415307 -0.0394060
3200374 2.012002 0.0601211
3200376 2.531168 -0.0311777
3200380 2.473515 0.0075492
3200382 2.301681 0.0243654
3200403 2.424476 -0.0130071
3200405 2.218313 0.0455693
3200407 2.516457 -0.0487721
3200415 2.204530 0.0484410
3200423 2.053450 0.0959698
3200428 1.984534 0.1012595
3200440 2.302497 0.0409412
3200452 2.261438 0.0236987
3200454 2.465144 -0.0250138
3200455 2.090345 0.0489787
3600001 1.898143 0.1183184
3600005 2.339067 -0.0328725
3600006 1.870946 0.1056740
3600013 2.041552 0.0395875
3600015 2.270627 0.0355675
3600019 2.184407 0.0411498
3600022 1.849201 0.1089593
3600026 2.301837 0.0034114
3600029 1.991925 0.0971101
3600044 1.781452 0.1953435
3600047 1.556943 0.1701777
3600051 2.329820 -0.0087239
3600057 1.729277 0.1262951
3600060 1.777015 0.1226759
3600062 1.763462 0.1215374
3600063 1.994378 0.1016476
3600064 1.776897 0.1151922
3600065 1.977226 0.1120375
3600073 1.549337 0.1457821
3600076 1.788740 0.1259559
3600082 2.241829 0.0742958
3600092 1.826054 0.1331127
3600093 1.949561 0.0869367
3600108 1.958173 0.0994734
3600109 1.731029 0.1330767
3600111 2.005473 0.0894547
3600116 2.220959 0.0455968
3600137 1.896525 0.1217982
3600142 1.889302 0.0942961
3600144 1.754499 0.1365522
3600149 1.953504 0.0947818
3600156 1.666982 0.1400214
3600166 1.739888 0.1351625
3600170 1.582737 0.1429152
3600171 1.880823 0.0924881
3600175 2.111631 0.1188364
3600191 1.579464 0.1640183
3600195 1.903065 0.0817323
3600209 1.675998 0.1587511
3600210 1.757452 0.0956487
3600211 1.688908 0.1405154
3600218 2.288172 0.0096948
3600223 2.306232 0.0442670
3600228 1.884888 0.0741787
3600229 1.927380 0.0777410
3600242 1.714129 0.1399887
3600245 1.987564 0.0922393
3600247 2.099468 0.0603652
3600251 1.537497 0.1831413
3600256 1.809142 0.1274508
3600262 1.879133 0.1288737
3600265 1.728980 0.1402660
3600266 2.151193 0.0914314
3600270 2.274452 0.0316135
3600278 1.633595 0.1528055
3600280 1.698971 0.1608769
3600283 1.728884 0.1034588
3600304 1.745956 0.1448324
3600308 2.027179 0.0805665
3600311 2.286716 0.0386574
3600312 2.026011 0.0776941
3600321 1.634438 0.1706639
3600323 1.721574 0.1654274
3600330 2.119772 0.0426160
3600344 2.314235 0.0048384
3600352 1.762247 0.1463329
3600357 2.039741 0.0662870
3600364 1.921203 0.0918450
3600367 1.909518 0.1053046
3600370 1.553687 0.1889732
3600375 1.912544 0.1143124
3600383 2.034573 0.0860791
3600391 2.090300 0.0686546
3600393 1.778961 0.1292142
3600400 1.847212 0.1396228
3600401 2.008592 0.0765216
3600408 2.155042 0.0444879
3600412 2.215785 0.0607554
3600426 1.916264 0.0827922
3600434 1.948517 0.0918372
3600437 1.720814 0.1842600
3600438 1.597354 0.1767749
3600450 1.882039 0.1358371
3600460 2.145348 0.1228853
3600473 2.124009 0.1078749
3600476 2.368166 0.0467296
3600488 1.710235 0.1698743
3600493 1.886342 0.0940046
3600499 1.797638 0.0911863
3600515 1.946960 0.0776819
3600518 2.114457 0.0227256
3600522 1.871260 0.1218040
3600528 1.913175 0.1297550
3600529 1.880059 0.1104848
3600532 1.829648 0.0896124
3600533 1.754973 0.1730004
3600540 2.166752 0.0729562
3600545 1.715524 0.1208083
3600549 1.671372 0.1521412
3600556 2.143350 -0.0073418
3600561 1.817082 0.1229783
3600562 1.967028 0.1010729
3600568 1.668978 0.1623430
3600569 1.860789 0.1261990
3600589 1.926233 0.1075793
3600593 1.821356 0.1464166
3600602 1.511919 0.1850528
3600604 1.847851 0.1064949
3600609 1.852436 0.1191940
3600612 2.060859 0.0741496
3600614 1.886527 0.1408520
3600620 1.812257 0.1292702
3600640 1.994608 0.0863751
3600642 1.607690 0.1751861
3600649 1.818108 0.1253437
3600654 2.208197 0.0691086
3600670 1.608702 0.1508938
3600671 2.270729 0.0283898
3600679 2.206085 0.0954553
3600684 1.712317 0.1409467
3600700 1.628859 0.1313072
3600731 2.191902 0.0636918
3600732 2.024337 0.1109579
3600737 1.918165 0.0955177
3600743 1.616426 0.1556244
3600744 1.799111 0.1266924
3600748 2.091324 0.0570386
17000007 1.864080 0.1018885
17000009 2.363697 -0.0053981
17000011 2.255624 0.0003512
17000012 1.849399 0.1394313
17000013 2.125230 0.0833886
17000016 1.745711 0.1464350
17000017 1.913273 0.1178639
17000018 2.099455 0.1376820
17000023 2.257347 0.0820309
17000025 1.825330 0.1169302
17000028 2.147507 0.0638859
17000029 2.286426 0.0525203
17000032 1.578476 0.2442451
17000034 2.042143 0.1019540
17000035 1.929648 0.0797929
17000037 1.997016 0.1001581
17000040 2.283354 0.0630685
17000041 1.938705 0.1468650
17000043 1.414997 0.2263755
17000045 2.233662 0.0482074
17000046 2.303401 0.0483063
17000048 2.102679 0.0891633
17000050 2.234188 0.0287862
17000051 2.549095 -0.0222058
17000053 1.918346 0.1061062
17000054 2.227256 0.0554550
17000055 2.286300 -0.0039430
17000057 2.335448 0.0134005
17000058 2.331435 0.0199172
17000060 1.975950 0.1071760
17000061 2.215914 0.0477805
17000064 1.947553 0.1374480
17000065 2.185867 0.0618137
17000066 1.798266 0.1559446
17000067 1.959612 0.0979000
17000070 2.233034 0.0447234
17000072 2.047230 0.1413534
17000073 1.796216 0.1843839
17000074 1.828743 0.1425918
17000075 1.996773 0.0509096
17000076 2.302334 0.0619781
17000077 1.897497 0.1383221
17000079 2.042317 0.0523407
17000080 2.436351 -0.0014829
17000081 2.095249 0.0580186
17000085 1.735192 0.1398497
17000086 2.109920 0.0887552
17000087 1.731031 0.1372684
17000088 2.088154 0.0875697
17000089 2.446333 -0.0011922
17000090 2.016400 0.1028609
17000091 2.134293 0.0876678
17000095 2.189661 0.0368019
17000096 1.845715 0.1509786
17000097 2.269614 0.0983172
17000098 1.984849 0.1045447
17000099 2.404655 0.0770152
17000102 2.221678 0.0592962
17000103 2.128768 0.0809195
17000104 2.144691 0.0702415
17000112 2.321874 0.0304434
17000113 2.154546 0.0867861
17000115 1.978762 0.0834277
17000116 2.234133 0.0616098
17000118 2.401662 0.0403048
17000120 2.299835 0.0502851
17000121 2.197454 0.0921965
17000124 1.939662 0.1250016
17000125 2.204800 0.0647511
17000126 1.919055 0.1380837
17000127 2.215577 0.0533428
17000128 2.345242 0.0550615
17000129 2.312346 0.0384464
17000131 1.710114 0.1359669
17000133 2.009480 0.0522949
17000134 1.984941 0.1082877
17000135 2.217113 0.0303151
17000136 2.339623 0.0128509
17000137 1.966161 0.1114241
17000139 2.049712 0.0894426
17000141 1.904756 0.1262244
17000142 2.302123 0.0358343
17000144 2.404104 0.0295858
17000147 2.227831 0.0858771
17000148 1.984857 0.0920604
17000151 1.962884 0.1180379
17000152 2.053104 0.0917731
17000153 2.093836 0.0748145
17000158 2.193169 0.1060068
17000159 2.228501 0.0477960
17000161 2.134612 0.0786891
17000162 2.039388 0.1010011
17000164 1.991920 0.1151333
17000165 2.057944 0.1007083
17000167 1.984091 0.1541446
17000168 2.212265 0.0734138
17000169 2.098089 0.0922654
17000171 1.984318 0.1060303
17000172 2.266638 0.0658022
17000177 2.353636 -0.0216412
17000178 2.011066 0.0967732
17000181 2.003250 0.1359886
17000184 2.165928 0.0949682
17000186 1.992939 0.0849424
17000188 2.168415 0.0778002
17000190 2.341983 0.0736509
17000191 2.144667 0.0984026
17000194 2.459422 0.0000234
17000195 2.043793 0.1430610
17000196 2.279250 0.0203550
17000198 2.177945 0.0866806
17000200 2.264973 0.0345243
17000201 1.988503 0.1198606
17000203 1.973712 0.1632327
17000204 2.093039 0.0491186
17000206 2.143513 0.0516639
17000207 2.348740 0.0459009
17000210 1.835883 0.1540999
17000213 2.309662 0.0126415
17000215 2.122716 0.0851435
17000216 2.076626 0.0559671
17000217 2.169802 0.0761464
17000219 2.156620 0.0767155
17000220 2.436278 0.0374594
17000221 1.947352 0.0948077
17000225 2.137140 0.0625480
17000226 2.428912 0.0280121
17000227 1.978529 0.1402423
17000228 2.220792 0.0983612
17000230 2.174893 0.0664266
17000231 2.227694 0.0128124
17000232 2.110810 0.0945513
17000234 2.031231 0.0987963
17000237 2.330886 0.0576838
17000238 2.047924 0.0931852
17000240 2.093629 0.0907763
17000242 1.966270 0.1144191
17000244 1.751791 0.1409022
17000245 1.928492 0.1323078
17000248 2.333102 0.0139264
17000250 2.017900 0.1104402
17000251 2.528834 0.0231670
20300004 1.369057 0.2373532
20300005 2.147752 0.0636085
20300007 1.630427 0.1562109
20300008 1.621137 0.1861175
20300009 1.769913 0.1488415
20300011 1.562052 0.1878905
20300012 1.991778 0.1048301
20300014 1.850861 0.1263648
20300015 1.991765 0.0732498
20300016 1.805662 0.1331440
20300017 2.087316 0.0713117
20300018 1.590003 0.1886573
20300021 1.872130 0.0968845
20300023 2.104236 0.0337380
20300025 1.951180 0.1187159
20300026 2.010925 0.0962209
20300030 1.500676 0.2000490
20300031 1.849575 0.1011878
20300033 1.624420 0.1587315
20300034 2.010710 0.0965284
20300037 2.338506 0.0298879
20300039 1.885244 0.1364187
20300040 1.835182 0.0874352
20300041 1.377158 0.2116450
20300048 2.009910 0.1006287
20300049 1.611431 0.1690386
20300052 1.731566 0.1537820
20300056 1.615727 0.1758268
20300058 1.735618 0.1595824
20300061 1.994303 0.0842342
20300062 1.453967 0.2102102
20300065 1.859926 0.0905090
20300066 1.954381 0.0723044
20300068 1.799522 0.1436613
20300069 1.789209 0.1233060
20300072 1.939759 0.0743145
20300073 1.408385 0.2357406
20300074 2.079623 0.0674499
20300081 1.946227 0.0924872
20300084 1.822146 0.1190305
20300085 1.693664 0.1380691
20300086 1.832241 0.1262288
20300087 1.804168 0.1209175
20300097 1.830271 0.1294993
20300099 2.078023 0.0948912
20300103 1.873733 0.1365790
20300104 1.886765 0.1287561
20300106 2.138168 0.0832346
20300107 1.769081 0.1419239
20300108 1.593315 0.1894588
20300110 2.268299 0.0253450
20300112 2.007309 0.0908256
20300115 2.083143 0.0555473
20300116 1.631611 0.1541900
20300117 1.660856 0.1679129
20300122 1.820765 0.1611439
20300123 1.669065 0.1689591
20300126 1.760825 0.1207707
20300127 1.831703 0.1075686
20300129 2.412501 -0.0061034
20300130 1.642574 0.2135160
20300131 1.753984 0.1030738
20300136 2.010140 0.0936401
20300140 1.723145 0.1480416
20300141 2.199611 0.0138548
20300144 1.535151 0.1906039
20300145 1.732490 0.1428416
20300147 1.979553 0.1000179
20300148 1.628436 0.1786365
20300151 1.573048 0.1714181
20300152 1.700172 0.1685867
20300153 1.919008 0.0999044
20300156 2.240072 0.0399037
20300158 1.656381 0.2066268
20300160 1.855375 0.1169822
20300162 1.569682 0.2061626
20300163 1.286681 0.1989353
20300165 1.748953 0.1382507
20300166 2.059085 0.0818993
20300169 1.939695 0.1057490
20300171 1.745726 0.1547955
20300173 1.832636 0.1242628
20300174 1.457712 0.2170117
20300176 1.944629 0.1235983
20300180 1.964705 0.1070974
20300181 2.029920 0.0926866
20300182 2.210499 0.0597694
20300183 1.697365 0.1525281
20300184 1.971307 0.0957353
20300185 1.870963 0.0947317
20300186 2.010923 0.1083109
20300187 1.621240 0.1512832
20300190 1.961112 0.0930817
20300191 1.854418 0.1445013
20300193 1.582688 0.1796463
20300194 1.764902 0.1223922
20300195 1.783326 0.1308345
20300197 1.800057 0.1354129
20300200 1.845250 0.1016274
20300201 2.032714 0.0733965
20300204 1.603525 0.2156203
20300205 2.092723 0.0462134
20300206 2.016769 0.0922694
20300207 1.489509 0.2451654
20300208 1.911192 0.1040882
20300209 1.838656 0.1077132
20300215 1.939466 0.0951738
20300218 1.847029 0.0870867
20300219 1.937819 0.1365363
20300221 1.669812 0.1611665
20300226 1.981238 0.0999753
20300227 1.673668 0.1895568
20300228 1.503857 0.2110549
20300231 1.816196 0.1433338
20300236 1.571724 0.1756500
20300237 1.925920 0.1095878
20300240 1.802592 0.1029625
20300241 1.507342 0.2307074
20300244 1.881058 0.1288979
20300245 1.795521 0.1530613
20300246 1.935085 0.1175203
20300248 1.695643 0.1640511
20300249 1.982064 0.0850346
20300250 1.920378 0.1117800
20300251 1.979022 0.0714787
20300252 1.190182 0.2730127
20300255 1.781329 0.1239113
20300258 1.770886 0.1509770
20300260 1.902907 0.1020284
20300261 1.798475 0.1594852
20300263 1.723158 0.1553659
20300267 2.336623 0.0275887
20300270 1.832088 0.1150704
20300273 1.851682 0.1070682
20300274 1.872767 0.1348338
20300276 1.902053 0.0905590
20300278 1.990181 0.0748202
20300283 2.088184 0.1005749
20300284 1.959413 0.1106519
20300285 1.781096 0.1363015
20300286 1.460896 0.2028088
20300289 1.729867 0.1456526
20300291 1.750610 0.1359668
20300292 1.623983 0.1804793
20300293 1.811696 0.1010050
20300295 1.517336 0.1934735
20300296 1.911802 0.1462244
20300298 1.380217 0.2443279
20300300 1.911229 0.0820845
20300302 1.897536 0.1459352
20300303 1.832175 0.1816646
20300305 1.911690 0.1345751
20300306 1.990455 0.0860679
20300309 2.053405 0.0967255
20300310 1.557972 0.1480824
20300311 1.601263 0.1964543
20300312 1.515262 0.2370497
20300313 2.333651 -0.0147164
20300314 2.093525 0.0605698
20300317 1.638501 0.1614876
20300320 1.844632 0.1296711
20300322 1.613187 0.1601563
20300323 1.988978 0.0805923
20300327 2.431218 -0.0050933
20300331 2.293109 0.0290372
20300332 1.762933 0.1987329
20300333 1.716706 0.1702409
20800003 1.557782 0.2075492
20800007 1.665558 0.1500922
20800008 1.952536 0.1088827
20800011 1.891208 0.1367568
20800019 2.015838 0.0808242
20800026 2.100826 0.0519046
20800031 2.294227 0.0223845
20800033 2.225776 0.0337378
20800043 2.510196 -0.0366366
20800044 1.815535 0.1481981
20800047 1.990213 0.0898783
20800048 1.624818 0.1650796
20800054 1.842160 0.1479386
20800066 1.926219 0.1390298
20800080 1.857469 0.1044112
20800087 1.903002 0.0903314
20800091 1.839816 0.0979575
20800097 1.882181 0.1246446
20800102 1.843511 0.1189912
20800104 2.127503 0.0633567
20800109 2.213481 0.0522275
20800111 1.968262 0.0905532
20800114 2.022965 0.0833236
20800116 2.111496 0.0739029
20800117 2.249174 0.0328344
20800123 2.247687 0.0481474
20800126 2.104032 0.0657701
20800132 2.014573 0.0731096
20800137 2.141346 0.0851753
20800138 1.831851 0.1304305
20800141 2.089144 0.0943562
20800142 1.940602 0.0817282
20800145 2.348923 -0.0108721
20800146 2.410117 0.0038012
20800149 1.754150 0.1610321
20800156 1.926989 0.1030686
20800165 2.323118 0.0229273
20800176 1.914289 0.0857823
20800195 2.222870 0.0399992
20800200 2.288443 0.0244757
20800208 1.839828 0.1011780
20800210 1.671375 0.1593412
20800213 2.208626 0.0736228
20800222 1.905621 0.0756204
20800223 1.828140 0.1245569
20800241 2.510280 -0.0013316
20800245 2.194422 0.0355352
20800251 1.739532 0.1115902
20800259 2.174833 0.0313885
20800265 2.354497 0.0066322
20800276 2.015872 0.0731043
20800277 1.918286 0.1087115
20800282 1.929407 0.0616957
20800285 1.866871 0.1048598
20800286 1.999477 0.0840857
20800293 2.120770 0.0673705
20800294 1.830206 0.1253205
20800300 1.582039 0.1826210
20800305 2.429338 0.0160144
20800315 2.317015 0.0094957
20800321 2.082543 0.1065560
20800324 1.648923 0.1558892
20800326 2.320258 -0.0387234
20800333 2.050153 0.0382389
20800339 1.916579 0.1216862
20800342 2.131495 0.0559191
20800343 1.930669 0.1221352
20800345 1.536113 0.1816047
20800353 1.749411 0.1299984
20800356 1.963414 0.1118975
20800362 1.859371 0.1157665
20800364 1.770595 0.1049165
20800366 1.750513 0.1399954
20800367 1.965636 0.1150016
20800370 1.549510 0.1282107
26800002 1.930759 0.1108405
26800003 1.876764 0.1226431
26800005 1.813185 0.1062819
26800007 1.964152 0.1182860
26800010 1.653137 0.1249904
26800013 1.995973 0.0915266
26800015 1.931095 0.1020564
26800016 1.514423 0.1935529
26800023 2.021972 0.1019218
26800024 1.782648 0.0698136
26800025 1.877663 0.1028072
26800026 1.997133 0.0586289
26800027 1.881654 0.1216202
26800030 2.117586 0.0775346
26800031 1.684117 0.1146042
26800035 1.807337 0.1053410
26800036 2.050487 0.0355497
26800037 1.797863 0.1286896
26800041 1.763899 0.1286453
26800043 2.069477 0.0898662
26800045 1.837646 0.1352910
26800046 1.617958 0.1573036
26800048 1.745988 0.1678906
26800051 1.771094 0.1114988
26800053 1.941790 0.1102001
26800054 1.956576 0.1162778
26800060 2.129199 0.0886421
26800061 1.824791 0.1137351
26800064 1.850120 0.1021397
26800066 2.004416 0.1157715
26800068 1.601076 0.1849815
26800073 1.895358 0.1147373
26800077 1.826910 0.1184237
26800078 1.714307 0.1451412
26800079 1.767063 0.1233851
26800081 1.576397 0.1704037
26800083 2.069319 0.0882694
26800087 2.014382 0.0809577
26800093 1.812438 0.1160121
26800094 1.768834 0.1121036
26800097 1.882179 0.1236845
26800106 1.892533 0.1152777
26800107 1.560704 0.1175320
26800115 1.778752 0.1265180
26800116 1.996642 0.0925336
26800121 1.788904 0.1149231
26800125 1.618146 0.1614785
26800129 1.920760 0.1264069
26800136 1.647875 0.1442512
26800137 1.955103 0.1117601
26800140 1.904162 0.1074503
26800142 1.858417 0.1421140
26800145 1.557536 0.1361926
26800147 2.035808 0.0859947
26800153 1.904610 0.1095136
26800158 2.029176 0.1282263
26800166 1.813997 0.1387086
26800167 1.965314 0.0625341
26800170 1.857794 0.1056837
26800175 2.023175 0.1061410
26800177 1.953317 0.0972686
26800178 1.902268 0.1339723
26800180 1.961862 0.0918897
26800182 1.879057 0.0933684
26800183 1.713150 0.1307145
26800188 1.845322 0.1176470
26800190 2.083742 0.0967292
26800191 1.851541 0.1223674
26800194 2.018042 0.0730227
26800198 1.986561 0.1120495
26800200 1.980074 0.1072086
26800212 1.721051 0.1270272
26800214 1.899280 0.1474327
26800220 2.093414 0.0731139
26800222 1.784224 0.1511715
26800227 1.812559 0.1485994
26800229 1.867830 0.1297662
26800232 1.890132 0.1246161
26800233 1.835133 0.1078624
26800238 2.076057 0.0690683
26800245 1.597514 0.1582834
26800246 1.985302 0.0797456
26800252 1.819970 0.1437142
26800254 2.221439 0.0405847
26800255 1.954268 0.0998681
26800256 1.871744 0.1418955
26800261 2.001818 0.0950423
26800264 1.727018 0.1371362
26800265 1.946821 0.1286590
26800269 1.891674 0.1052218
26800270 1.977965 0.0950780
26800273 1.981966 0.1152847
26800274 2.052659 0.0894994
26800278 1.833627 0.1223586
26800281 1.791278 0.1065917
26800282 1.694579 0.1258947
26800287 1.633492 0.1346778
26800290 2.009722 0.1034888
26800291 2.008826 0.1002697
26800293 1.776169 0.1154808
26800295 1.796537 0.1124286
26800297 1.966411 0.0992396
26800303 1.826422 0.1304702
26800305 1.950601 0.0888565
26800307 2.154446 0.0738738
26800311 1.786104 0.1198165
26800315 2.023076 0.1183439
26800316 1.661926 0.1460233
26800320 1.883086 0.0803210
26800324 1.901200 0.0998111
26800325 1.909047 0.1049000
47000001 1.797555 0.1191791
47000002 2.085674 0.0595766
47000004 1.604101 0.1905788
47000005 1.528226 0.1728567
47000006 1.859890 0.0893319
47000007 1.584379 0.1520171
47000008 1.862455 0.1151637
47000009 1.777488 0.1736228
47000010 1.538159 0.1719805
47000011 1.874805 0.1472378
47000013 1.451994 0.2372396
47000014 2.108763 0.0624031
47000015 1.484666 0.1499268
47000016 1.946500 0.0747429
47000017 1.761022 0.1453044
47000018 1.621272 0.1895125
47000019 1.529569 0.1096971
47000020 1.864273 0.1026736
47000022 1.657381 0.1997883
47000023 1.907755 0.0759447
47000024 1.487387 0.1724951
47000025 1.540493 0.1500692
47000027 1.805624 0.1374187
47000028 1.877714 0.1279229
47000029 1.520476 0.1858173
47000032 1.573580 0.1646211
47000035 1.780215 0.1145011
47000036 1.672065 0.1641233
47000038 1.565369 0.1760400
47000039 1.868283 0.0741084
47000040 1.806826 0.1219969
47000041 1.945809 0.1198987
47000042 1.689401 0.1294865
47000044 1.618188 0.2019388
47000045 1.998123 0.0527552
47000047 1.746061 0.1398904
47000048 1.752017 0.1301119
47000049 1.350187 0.2343551
47000050 2.186413 0.0320183
47000051 1.901689 0.1171337
70400001 1.659761 0.1514788
70400004 1.749051 0.1395611
70400005 2.129242 0.0710271
70400006 1.780965 0.1218339
70400007 1.805662 0.1472486
70400008 1.973610 0.1146900
70400010 1.999017 0.1211931
70400011 1.994027 0.0960642
70400012 1.624443 0.1511585
70400013 1.756208 0.1480078
70400014 1.979658 0.1040154
70400019 1.966111 0.0999845
70400020 1.869037 0.1103998
70400021 1.936660 0.0925270
70400024 1.988867 0.0835660
70400025 1.918130 0.1066883
70400027 1.842176 0.1390938
70400028 1.992526 0.1051808
70400030 1.935081 0.1124078
70400031 2.041536 0.0798762
70400032 2.047382 0.0894545
70400034 1.845376 0.1235731
70400036 1.715012 0.1493955
70400037 1.761802 0.1375097
70400038 1.932562 0.0998374
70400040 1.997330 0.1130885
70400041 1.934221 0.0891907
70400042 1.942772 0.1130800
70400043 1.673219 0.1419949
70400044 1.709107 0.1993053
70400046 2.241805 0.1055167
70400047 2.343679 0.0467123
70400048 1.801261 0.1244638
70400049 2.076893 0.1016318
70400050 1.891079 0.1130887
70400052 1.765017 0.1410370
70400053 1.759081 0.1217667
70400055 1.855407 0.1375172
70400056 1.876389 0.1239689
70400058 1.727898 0.1498060
70400059 1.721779 0.1491821
70400060 1.839892 0.1233729
70400061 2.128489 0.0718731
70400062 1.854822 0.1178719
70400063 1.988546 0.1421725
70400065 1.958774 0.1150830
70400067 1.889151 0.1152572
70400068 1.669335 0.1291551
70400070 1.770656 0.1151785
70400071 1.674618 0.1505933
70400073 1.943647 0.1029457
70400074 1.820020 0.1020817
70400075 1.993103 0.0983498
70400076 1.759997 0.1556086
70400077 1.700180 0.1486354
70400079 1.933042 0.0990394
70400080 1.856653 0.1116561
70400081 2.093898 0.0827683
70400082 1.902953 0.1270173
70400084 1.584111 0.1503752
70400086 1.775557 0.1289541
70400087 1.912049 0.1212215
70400092 1.925384 0.0953387
70400093 1.852220 0.1225936
70400094 1.979780 0.1120255
70400095 1.911003 0.1143367
70400096 1.899635 0.1103544
70400097 1.927324 0.1010517
70400099 2.133516 0.0399548
70400100 1.682003 0.1475974
70400101 1.845965 0.1195012
70400102 2.029779 0.0844516
70400105 2.033006 0.0950591
70400106 2.022631 0.0831205
70400108 1.987456 0.0717411
70400109 1.874529 0.1093875
70400110 1.526624 0.1805685
70400111 1.731457 0.1359551
70400112 1.836931 0.1189271
70400115 1.691301 0.1520625
70400116 1.678791 0.1411410
70400117 1.610819 0.1336932
70400118 2.036909 0.0848013
70400120 1.819756 0.0850311
70400121 1.731028 0.1418466
70400123 1.778762 0.1023116
70400124 1.715551 0.1249037
70400127 1.948104 0.1038703
70400128 1.847772 0.1133656
70400129 1.881489 0.1280728
70400130 1.811670 0.1470961
70400132 1.993462 0.0969772
70400133 1.861920 0.0932457
70400134 2.198903 0.0338134
70400135 1.848212 0.1059470
70400137 1.510412 0.1952049
70400138 1.719119 0.1365839
70400139 1.884586 0.1300015
70400140 1.918425 0.1085579
70400141 1.570379 0.1491165
70400142 1.987856 0.0960276
70400143 1.676743 0.1369819
70400144 1.806793 0.1418415
70400145 1.673726 0.1424704
70400146 2.035923 0.1344003
70400147 1.934943 0.1214711
70400148 1.721305 0.1591199
70400149 2.032561 0.1126565
70400151 1.549895 0.1615543
70400152 1.615300 0.1567078
79200001 1.961270 0.0124924
79200002 1.990183 0.1155663
79200003 1.713697 0.1856032
79200004 1.796058 0.1162965
79200005 1.423713 0.2572355
79200006 1.539154 0.2498412
79200007 1.380320 0.1819930
79200008 1.513471 0.1906366
79200009 1.964834 0.1100190
79200010 1.874317 0.0932474
79200012 1.436060 0.2075876
79200013 2.153581 0.0050716
79200014 1.748335 0.1143294
79200015 1.361278 0.2110462
79200016 1.628404 0.1298818
79200017 1.911464 0.1414468
79200018 1.433945 0.1933245
79200021 1.533868 0.1671411
79200022 1.539860 0.1478451
79200023 2.134691 0.1052276
79200024 1.510717 0.1858292
79200026 1.724372 0.1251691
79200027 1.991155 0.0593796
79200028 1.937602 0.0680053
79200030 1.868175 0.1218496
79200033 1.750092 0.1548247
79200034 2.194246 0.0288494
79200035 1.468829 0.1413083
79200036 1.574531 0.1741631
79200037 1.962479 0.0002095
79200038 1.505105 0.2179381
79200040 1.439251 0.2013055
79200041 1.472606 0.1058898
79200043 1.271781 0.2457959
79200044 1.421747 0.2230666
79200046 1.533181 0.1261561
79200048 1.271107 0.2690510
79200049 1.982716 0.1196213
79200051 1.232381 0.2426476
79200052 1.598394 0.1830097
79200053 1.826355 0.1357563
79200056 1.244401 0.1500572
79200057 1.193475 0.2176815
79200058 1.761680 0.1147797
79200059 1.664888 0.1237269
79200060 2.149056 0.1210909
79200061 1.991916 0.0439991
79200064 1.513177 0.2174788
79200065 1.669208 0.1845714
79200067 1.582287 0.1619708
79200069 1.976666 0.0634032
79200071 1.781789 0.1380098
79200072 1.647553 0.1644116
79200077 2.055569 0.1109993
79200078 1.965897 0.0872996
79200080 1.747330 0.1097701
79200081 1.429463 0.2546015
79200082 1.761857 0.1324316
79200083 1.615394 0.1480896
79200084 1.633912 0.1560592
79200085 1.609993 0.1355659
79200086 1.791584 0.0889259
79200087 1.843893 0.1208998
79200089 1.612633 0.1479050
79200090 1.752323 0.0704878
79200091 1.328391 0.2038342
79200092 1.441451 0.2124034
79200094 1.625696 0.1085496
79200095 1.226408 0.2544926
79200097 1.799502 0.1644347
79200098 1.908148 0.1120751
79200099 1.529089 0.1635277
79200102 1.649201 0.1597787
79200103 2.152052 0.0575613
79200104 1.563614 0.1899085
79200105 1.319456 0.2926959
79200106 1.447412 0.2301923
79200107 1.641683 0.1620439
79200108 1.667164 0.1276343
79200109 1.638706 0.1846715
79200111 1.349577 0.2409677
79200112 2.016323 0.0735799
79200113 1.662209 0.1229101
79200114 1.427240 0.2033803
79200116 1.610807 0.2256889
79200117 1.474252 0.2586217
79200118 1.429569 0.1898561
79200119 1.565931 0.1714164
79200121 1.995902 0.1189376
79200122 1.744383 0.1729743
79200123 1.955266 0.0861780
79200124 1.628290 0.1366600
79200125 1.512643 0.2152392
79200126 1.288312 0.2713939
79200127 2.398902 -0.0243934
79200129 1.685511 0.1301672
79200130 1.955985 0.1037338
79200132 1.600153 0.1837437
79200133 1.817659 0.1517466
79200135 1.778000 0.1291792
79200136 1.811934 0.1189688
79200139 1.656699 0.1411255
79200140 1.691350 0.1346657
79200141 1.867189 0.1778892
79200142 1.309501 0.1909318
79200143 1.455956 0.1559460
79200144 1.243521 0.2486893
79200145 2.061470 0.0337069
79200146 1.655995 0.1387458
79200147 1.945562 0.0532753
79200148 1.868294 0.1172422
79200149 1.855775 0.1630573
79200150 1.862693 0.1151168
79200151 1.651670 0.1441694
79200153 1.778194 0.1450429
79200154 1.689980 0.1517552
79200155 1.536053 0.1574281
79200157 1.069851 0.2553948
79200158 1.832144 0.1627441
79200159 1.178757 0.2847159
79200161 1.549083 0.1696378
79200162 1.544871 0.1451498
79200163 1.417697 0.2178172
79200164 1.611437 0.1498001
79200165 1.543933 0.1371138
79200169 2.087134 0.0901811
79200170 1.456454 0.1755094
79200171 1.981341 0.0583243
79200172 1.720183 0.1518963
79200173 2.128694 0.0452401
79200174 1.240160 0.2967374
79200175 1.955370 0.1321964
79200177 1.833360 0.1155398
79200179 1.529016 0.2384238
79200180 1.812145 0.1792011
79200181 1.535567 0.1751603
79200182 1.370352 0.2003055
79200183 1.440776 0.1393419
79200184 1.391412 0.2210140
79200186 1.549858 0.1570000
79200188 1.668386 0.1710634
school_coef <- coef(mod_rsm_combo)$schID

summary_RSM_combo <- data.frame(
  variable = colnames(school_coef),
  mean = apply(school_coef, 2, mean),
  median = apply(school_coef, 2, median),
  sd = apply(school_coef, 2, sd),
  min = apply(school_coef, 2, min),
  max = apply(school_coef, 2, max)
)
summary(summary_RSM_combo)
##    variable              mean            median             sd         
##  Length:2           Min.   :0.1111   Min.   :0.1118   Min.   :0.05532  
##  Class :character   1st Qu.:0.5585   1st Qu.:0.5595   1st Qu.:0.10553  
##  Mode  :character   Median :1.0059   Median :1.0072   Median :0.15574  
##                     Mean   :1.0059   Mean   :1.0072   Mean   :0.15574  
##                     3rd Qu.:1.4532   3rd Qu.:1.4549   3rd Qu.:0.20595  
##                     Max.   :1.9006   Max.   :1.9026   Max.   :0.25616  
##       min                max        
##  Min.   :-0.06521   Min.   :0.2967  
##  1st Qu.: 0.21855   1st Qu.:0.8955  
##  Median : 0.50232   Median :1.4942  
##  Mean   : 0.50232   Mean   :1.4942  
##  3rd Qu.: 0.78609   3rd Qu.:2.0929  
##  Max.   : 1.06985   Max.   :2.6916

Response here:

1.5 Empirical Bayes (1 pt)

Obtain the Empirical Bayes’ estimates of the random school effects, including the EB for the random intercepts and the slopes. Please report the summary statistics of these estimates, such as mean, median, sd, min, and max.

# R code here.

Response here:

1.6 Extra credit (1 pt)

In this random coefficient model, calculate and report the correlation between two randomly selected teachers from a randomly selected school, one teacher with motivation of 0 and another teacher with motivation of 1. HINT: Follow the definition, find the covariance in the satisfaction between an individual with motivation of 0 and an individual with motivation of 1, find the variance of satisfaction for an individual with motivation of 0 and an individual with motivation of 1, then calculate the correlation.

# R code here.

Response here:

2 Three-level models (3 points)

Fit a three-level random intercept model with satisfaction as outcome variable, motivation as level-1 predictor variable, climate and public as level-2 predictors. Please report and interpret the slope coefficients. Compute the expected correlation between teachers from the same school and the expected correlation between teachers from the same country.

# R code here.
mod_empty <- lmer(satisfaction ~ 1 + ( 1 | countryID / schID), data = TALIS)
mod_empty <- lmer(satisfaction ~ 1 + ( 1 | countryID) + (1 | schID), data = TALIS)
summary(mod_empty)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ 1 + (1 | countryID) + (1 | schID)
##    Data: TALIS
## 
## REML criterion at convergence: 17991
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2876 -0.6299 -0.0151  0.7141  2.4628 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  schID     (Intercept) 0.01826  0.1351  
##  countryID (Intercept) 0.02060  0.1435  
##  Residual              0.23136  0.4810  
## Number of obs: 12584, groups:  schID, 978; countryID, 9
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)  2.15346    0.04834 7.98784   44.55 7.32e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#checking that climate and public are school level variables
TALIS %>%
  group_by(schID) %>%
  summarize(n = n_distinct(climate), m = n_distinct(public)) %>%
  summarize(max_n = max(n), max_m = max(m))
## # A tibble: 1 × 2
##   max_n max_m
##   <int> <int>
## 1     1     1
#confirmed

mod_lvl1 <- lmer(satisfaction ~ motivation + ( 1 | countryID / schID), data = TALIS)
summary(mod_lvl1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ motivation + (1 | countryID/schID)
##    Data: TALIS
## 
## REML criterion at convergence: 17791.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3989 -0.6312 -0.0114  0.7220  2.5314 
## 
## Random effects:
##  Groups          Name        Variance Std.Dev.
##  schID:countryID (Intercept) 0.0179   0.1338  
##  countryID       (Intercept) 0.0254   0.1594  
##  Residual                    0.2276   0.4771  
## Number of obs: 12584, groups:  schID:countryID, 978; countryID, 9
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.878e+00  5.687e-02 1.011e+01   33.01 1.24e-11 ***
## motivation  1.279e-01  8.853e-03 1.245e+04   14.44  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## motivation -0.336
mod_lvl1 <- lmer(satisfaction ~ motivation + (1 | countryID) + ( 1 | schID), data = TALIS)
summary(mod_lvl1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ motivation + (1 | countryID) + (1 | schID)
##    Data: TALIS
## 
## REML criterion at convergence: 17791.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3989 -0.6312 -0.0114  0.7220  2.5314 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  schID     (Intercept) 0.0179   0.1338  
##  countryID (Intercept) 0.0254   0.1594  
##  Residual              0.2276   0.4771  
## Number of obs: 12584, groups:  schID, 978; countryID, 9
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.878e+00  5.687e-02 1.011e+01   33.01 1.24e-11 ***
## motivation  1.279e-01  8.853e-03 1.245e+04   14.44  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## motivation -0.336
mod_lvl2 <- lmer(satisfaction ~ motivation + climate + public + (1 |countryID) + (1 | schID), data = TALIS)
summary(mod_lvl2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: satisfaction ~ motivation + climate + public + (1 | countryID) +  
##     (1 | schID)
##    Data: TALIS
## 
## REML criterion at convergence: 17772.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4178 -0.6314 -0.0082  0.7199  2.5429 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  schID     (Intercept) 0.01664  0.1290  
##  countryID (Intercept) 0.02502  0.1582  
##  Residual              0.22768  0.4772  
## Number of obs: 12584, groups:  schID, 978; countryID, 9
## 
## Fixed effects:
##                Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)   1.732e+00  6.874e-02  2.209e+01  25.190  < 2e-16 ***
## motivation    1.285e-01  8.852e-03  1.245e+04  14.512  < 2e-16 ***
## climate       8.131e-02  1.688e-02  8.926e+02   4.818 1.71e-06 ***
## publicPublic -4.748e-02  1.651e-02  1.005e+03  -2.876  0.00412 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) motvtn climat
## motivation  -0.267              
## climate     -0.545 -0.009       
## publicPublc -0.183 -0.035  0.030
VarCorr(mod_lvl2)
##  Groups    Name        Std.Dev.
##  schID     (Intercept) 0.12898 
##  countryID (Intercept) 0.15818 
##  Residual              0.47715
var_comps <- VarCorr(mod_lvl2)
tau_sq <- as.numeric(var_comps)[2]
omega_sq <- as.numeric(var_comps)[1]
sigma_sq <- attr(var_comps, "sc")^2

tau_sq / (tau_sq + omega_sq + sigma_sq) #between-country variance
## [1] 0.09290113
#countries have a 9.29% variance of teacher satisfaction, depending on the country.

omega_sq / (tau_sq + omega_sq + sigma_sq) #between school variance
## [1] 0.06177129
#schools have a 6.18% variance from school to school for teacher satisfaction depending on the school

sigma_sq / (tau_sq + omega_sq + sigma_sq) #residual variance (within school)
## [1] 0.8453276
#the withhin school variance is 84.53% for individual teacher satisfaction

Response here:

The intercept for the 3 level model with predictors for teacher satisfaction is 1.73166 and for every unit increase of motivation teacher satisfaction is predicted to increase by .12846 when holding climate constant and school type constant. The slope for climate for the 3 level model means that when climate increases by one unit then the teacher satisfaction increases by .08131 when holding school type constant. When schools have 0 motivation, 0 climate, and the school is private the predicted intercept for teacher satisfaction is 1.73166

Countries have a 9.29% variance of teacher satisfaction, depending on the country. Schools have a 6.18% variance from school to school for teacher satisfaction depending on the school The withhin school variance is 84.53% for individual teacher satisfaction

3 Introduction of the project (3 pts)

  • Describe the context and motivation for your class project.
  • Explain the research question(s) that your project investigates.
  • Provide a few key references.