1 Introduction

Note. A long version of this report was presented in class, which covered models and graphs with more details,
for more information, please refer to Final project01.Rmd. Thanks

  • Multilevel mixed effects models are widely used in education and relevant disciplines,
    to account for the correlated responses within clusters.
  • the present study is an illustration of mixed effects model using the PISA 2012 data.
  • The Program for International Student Assessment (PISA) is an international assessment that measures 15-year-old students’ reading, mathematics, and science literacy every three years.
  • PISA was launched by the OECD in 1997, first administered in 2000 and now covers over 80 countries.
  • PISA focuses on the application of skills and knowledge and presents problems in real-world contexts. It is intended to provide a measure of students’ overall preparedness for the future, not just their academic achievement.
  • the literacy score was estimated using 3PL-IRT

2 Research variables:

DV: Math literacy
Random effect(School): (1| School)

Fixed effect(Students): Gender, problem-solving style, motivation, Anxiety

Problem-solving style(Approach/Avoidance):
1. Approach
2. Combo
3. No preference

Motivation:
1. Extrinsic
2. Intrinsic
3. Combo
4. Neither

Anxiety: Composite score

##   StIDStd School   AGE LMINS Gender  ESCS Grade Mathlevel Anxiety Anxiety2
## 1      30      1 16.00  9997      1 -0.24    10         2      15      225
## 2      12      1 15.75  9997      1 -0.45    10         3      13      169
## 3      25      1 15.75  9997      1  0.10    10         4      13      169
## 4      23      1 16.17  9997      1  0.26    10         4      14      196
## 5       8      1 15.58  9997      1  0.71    10         5      15      225
## 6      24      1 16.25  9997      1 -0.31    10         5      20      400
##   Anxiety3 Anxiety_Group Math_Group     Math Grand_Math PS Motivation Remedial
## 1     3375      13.08333   623.0734 434.6549 -125.39966  3          1        0
## 2     2197      13.08333   623.0734 501.0983  -58.95630  3          1        0
## 3     2197      13.08333   623.0734 548.5356  -11.51902  3          4        0
## 4     2744      13.08333   623.0734 585.7688   25.71420  2          1        0
## 5     3375      13.08333   623.0734 666.6225  106.56794  3          1        0
## 6     8000      13.08333   623.0734 624.1704   64.11582  3          1        0
##   low Excellence level_3 allmethod approach nopreference avoidance Intrinsic
## 1   1          0       1         1        0            0         0         0
## 2   0          0       2         1        0            0         0         0
## 3   0          0       2         1        0            0         0         0
## 4   0          0       2         0        1            0         0         0
## 5   0          0       3         1        0            0         0         0
## 6   0          0       3         1        0            0         0         0
##   extrinsic combo NoMotivation Dicipline Q79_5 Q83_2 Q83_1 Q79_4 Q79_10 Q80_1
## 1         0     0            1         8     1     3     3     2      2     2
## 2         0     0            1         8     2     4     4     3      1     4
## 3         1     0            0         7     1     3     3     2      2     3
## 4         0     0            1        10     1     3     2     1      2     2
## 5         0     0            1         4     1     2     3     3      2     1
## 6         0     0            1         7     1     2     3     2      2     2
##   Q80_4 Q82_2
## 1     3     4
## 2     2     4
## 3     3     4
## 4     3     3
## 5     2     3
## 6     2     3
## 'data.frame':    1897 obs. of  38 variables:
##  $ StIDStd      : int  30 12 25 23 8 24 1 32 22 6 ...
##  $ School       : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ AGE          : num  16 15.8 15.8 16.2 15.6 ...
##  $ LMINS        : int  9997 9997 9997 9997 9997 9997 9997 9997 9997 9997 ...
##  $ Gender       : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ ESCS         : num  -0.24 -0.45 0.1 0.26 0.71 -0.31 0.22 0.67 -0.41 -1.73 ...
##  $ Grade        : int  10 10 10 10 10 10 10 10 10 10 ...
##  $ Mathlevel    : int  2 3 4 4 5 5 5 5 6 6 ...
##  $ Anxiety      : int  15 13 13 14 15 20 12 14 9 15 ...
##  $ Anxiety2     : int  225 169 169 196 225 400 144 196 81 225 ...
##  $ Anxiety3     : int  3375 2197 2197 2744 3375 8000 1728 2744 729 3375 ...
##  $ Anxiety_Group: num  13.1 13.1 13.1 13.1 13.1 ...
##  $ Math_Group   : num  623 623 623 623 623 ...
##  $ Math         : num  435 501 549 586 667 ...
##  $ Grand_Math   : num  -125.4 -59 -11.5 25.7 106.6 ...
##  $ PS           : int  3 3 3 2 3 3 3 3 3 3 ...
##  $ Motivation   : int  1 1 4 1 1 1 4 3 4 3 ...
##  $ Remedial     : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ low          : int  1 0 0 0 0 0 0 0 0 0 ...
##  $ Excellence   : int  0 0 0 0 0 0 0 0 1 1 ...
##  $ level_3      : int  1 2 2 2 3 3 3 3 3 3 ...
##  $ allmethod    : int  1 1 1 0 1 1 1 1 1 1 ...
##  $ approach     : int  0 0 0 1 0 0 0 0 0 0 ...
##  $ nopreference : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ avoidance    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Intrinsic    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ extrinsic    : int  0 0 1 0 0 0 1 0 1 0 ...
##  $ combo        : int  0 0 0 0 0 0 0 1 0 1 ...
##  $ NoMotivation : int  1 1 0 1 1 1 0 0 0 0 ...
##  $ Dicipline    : int  8 8 7 10 4 7 8 11 5 5 ...
##  $ Q79_5        : int  1 2 1 1 1 1 2 4 1 1 ...
##  $ Q83_2        : int  3 4 3 3 2 2 3 4 2 3 ...
##  $ Q83_1        : int  3 4 3 2 3 3 3 4 3 3 ...
##  $ Q79_4        : int  2 3 2 1 3 2 2 2 1 1 ...
##  $ Q79_10       : int  2 1 2 2 2 2 2 1 2 1 ...
##  $ Q80_1        : int  2 4 3 2 1 2 3 4 2 3 ...
##  $ Q80_4        : int  3 2 3 3 2 2 3 2 2 2 ...
##  $ Q82_2        : int  4 4 4 3 3 3 3 4 2 3 ...

3 Gender Difference in Math

m20<-lme4::lmer(Math ~ Gender+ (1| School), data=dta_project)
sjPlot::tab_model(m20, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 551.73 539.23 – 564.23 <0.001
Gender [Male] 12.92 4.65 – 21.19 0.002
Random Effects
σ2 6619.57
τ00 School 5315.91
ICC 0.45
N School 163
Observations 1897
summary(m20)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ Gender + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22439.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4313 -0.5925  0.0672  0.6664  3.1227 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 5316     72.91   
##  Residual             6620     81.36   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  551.730      6.377  86.525
## GenderMale    12.923      4.220   3.063
## 
## Correlation of Fixed Effects:
##            (Intr)
## GenderMale -0.331

3.1 Gender Difference in Anxiety

m21<-lme4::lmer(Anxiety ~ Gender+(1| School), data=dta_project)
sjPlot::tab_model(m21, show.p=TRUE, show.r2 = FALSE )
  Anxiety
Predictors Estimates CI p
(Intercept) 13.72 13.51 – 13.92 <0.001
Gender [Male] -1.15 -1.43 – -0.87 <0.001
Random Effects
σ2 9.55
τ00 School 0.15
ICC 0.02
N School 163
Observations 1897
summary(m21)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Anxiety ~ Gender + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 9694.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8519 -0.5738 -0.1053  0.6457  2.4611 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 0.150    0.3873  
##  Residual             9.548    3.0900  
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  13.7158     0.1056 129.846
## GenderMale   -1.1489     0.1446  -7.944
## 
## Correlation of Fixed Effects:
##            (Intr)
## GenderMale -0.682

4 PS MO and Anxiety with Math (Models with Random intercept)

4.1 PS

m22<-lme4::lmer(Math ~ PS+(1| School), data=dta_project)
sjPlot::tab_model(m22, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 505.06 484.12 – 525.99 <0.001
PS [Approach] 66.44 41.72 – 91.17 <0.001
PS [Combo] 55.14 36.84 – 73.44 <0.001
Random Effects
σ2 6539.56
τ00 School 5126.35
ICC 0.44
N School 163
Observations 1897
summary(m22)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ PS + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22404.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3919 -0.5905  0.0591  0.6690  3.0377 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 5126     71.60   
##  Residual             6540     80.87   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  505.055     10.683  47.277
## PSApproach    66.443     12.613   5.268
## PSCombo       55.140      9.337   5.905
## 
## Correlation of Fixed Effects:
##            (Intr) PSAppr
## PSApproach -0.617       
## PSCombo    -0.832  0.706

4.2 MO

m22<-lme4::lmer(Math ~ Motivation+(1| School), data=dta_project)
sjPlot::tab_model(m22, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 528.66 516.22 – 541.11 <0.001
Motivation [Intrinsic] 58.77 45.36 – 72.18 <0.001
Motivation [Both] 60.63 50.87 – 70.39 <0.001
Motivation [Extrinsic] 24.42 15.17 – 33.66 <0.001
Random Effects
σ2 6106.12
τ00 School 4792.00
ICC 0.44
N School 163
Observations 1897
summary(m22)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ Motivation + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22270.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7568 -0.5943  0.0505  0.6716  2.7790 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 4792     69.22   
##  Residual             6106     78.14   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##                     Estimate Std. Error t value
## (Intercept)          528.662      6.350  83.251
## MotivationIntrinsic   58.770      6.840   8.592
## MotivationBoth        60.627      4.979  12.176
## MotivationExtrinsic   24.415      4.717   5.176
## 
## Correlation of Fixed Effects:
##             (Intr) MtvtnI MtvtnB
## MtvtnIntrns -0.256              
## MotivatnBth -0.358  0.335       
## MtvtnExtrns -0.373  0.348  0.487

4.3 Anxiety and Math

m15<- lme4::lmer(Math ~ Anxiety+ (1| School), data=dta_project)
sjPlot::tab_model(m15, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 663.71 644.62 – 682.80 <0.001
Anxiety -8.03 -9.19 – -6.86 <0.001
Random Effects
σ2 6052.94
τ00 School 5008.32
ICC 0.45
N School 163
Observations 1897
summary(m15)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ Anxiety + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22278.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7688 -0.5768  0.0999  0.6635  2.7423 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 5008     70.77   
##  Residual             6053     77.80   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 663.7082     9.7398   68.14
## Anxiety      -8.0280     0.5935  -13.53
## 
## Correlation of Fixed Effects:
##         (Intr)
## Anxiety -0.801

5 Question 3-1: the interactive relationship between anxiety and PS

5.1 lm

m19<-lm(Math ~ Gender+ PS*Anxiety, data=dta_project)
sjPlot::tab_model(m19, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 491.09 396.68 – 585.49 <0.001
Gender [Male] 2.02 -7.44 – 11.48 0.675
PS [Approach] 157.95 32.88 – 283.02 0.013
PS [Combo] 207.62 111.53 – 303.71 <0.001
Anxiety -1.14 -8.21 – 5.94 0.752
PS [Approach] * Anxiety -5.21 -14.93 – 4.50 0.293
PS [Combo] * Anxiety -9.07 -16.30 – -1.84 0.014
Observations 1897
summary(m19)
## 
## Call:
## lm(formula = Math ~ Gender + PS * Anxiety, data = dta_project)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -355.89  -66.91    5.92   73.68  300.27 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         491.087     48.135  10.202  < 2e-16 ***
## GenderMale            2.021      4.825   0.419   0.6754    
## PSApproach          157.948     63.770   2.477   0.0133 *  
## PSCombo             207.622     48.995   4.238 2.37e-05 ***
## Anxiety              -1.138      3.607  -0.315   0.7524    
## PSApproach:Anxiety   -5.215      4.956  -1.052   0.2928    
## PSCombo:Anxiety      -9.065      3.686  -2.459   0.0140 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 103.1 on 1890 degrees of freedom
## Multiple R-squared:   0.11,  Adjusted R-squared:  0.1072 
## F-statistic: 38.93 on 6 and 1890 DF,  p-value: < 2.2e-16

5.2 lmm

m18<- lme4::lmer(Math ~ Gender+ PS*Anxiety+ (1| School), data=dta_project)
sjPlot::tab_model(m18, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 546.80 472.54 – 621.05 <0.001
Gender [Male] 5.72 -2.24 – 13.68 0.159
PS [Approach] 95.93 -1.44 – 193.29 0.053
PS [Combo] 119.32 44.66 – 193.99 0.002
Anxiety -3.44 -8.94 – 2.05 0.219
PS [Approach] * Anxiety -2.73 -10.28 – 4.83 0.479
PS [Combo] * Anxiety -4.79 -10.40 – 0.82 0.095
Random Effects
σ2 5934.41
τ00 School 4809.07
ICC 0.45
N School 163
Observations 1897
summary(m18)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ Gender + PS * Anxiety + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22208.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5802 -0.5672  0.0814  0.6663  2.7211 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 4809     69.35   
##  Residual             5934     77.04   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##                    Estimate Std. Error t value
## (Intercept)         546.795     37.884  14.433
## GenderMale            5.718      4.061   1.408
## PSApproach           95.928     49.677   1.931
## PSCombo             119.324     38.097   3.132
## Anxiety              -3.444      2.804  -1.228
## PSApproach:Anxiety   -2.728      3.855  -0.708
## PSCombo:Anxiety      -4.786      2.863  -1.672
## 
## Correlation of Fixed Effects:
##             (Intr) GndrMl PSAppr PSComb Anxity PSAp:A
## GenderMale  -0.125                                   
## PSApproach  -0.744  0.043                            
## PSCombo     -0.962  0.038  0.734                     
## Anxiety     -0.960  0.060  0.733  0.948              
## PSApprch:An  0.701 -0.032 -0.970 -0.693 -0.731       
## PSCmb:Anxty  0.935 -0.024 -0.714 -0.972 -0.976  0.713

6 Question 3-2: the 2-way interactive relationship between anxiety and Motivation for different Gender

6.1 lm

m20<-lm(Math ~ Gender+ Motivation*Anxiety, data=dta_project)
summary(m20)
## 
## Call:
## lm(formula = Math ~ Gender + Motivation * Anxiety, data = dta_project)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -334.29  -68.21    4.55   71.13  297.04 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  543.927     18.831  28.884  < 2e-16 ***
## GenderMale                    -5.398      4.751  -1.136 0.256063    
## MotivationIntrinsic          128.493     37.326   3.442 0.000589 ***
## MotivationBoth               203.334     25.674   7.920 4.03e-15 ***
## MotivationExtrinsic          152.680     28.318   5.392 7.86e-08 ***
## Anxiety                       -1.616      1.284  -1.259 0.208153    
## MotivationIntrinsic:Anxiety   -4.637      2.922  -1.587 0.112700    
## MotivationBoth:Anxiety       -10.492      1.967  -5.333 1.08e-07 ***
## MotivationExtrinsic:Anxiety   -8.205      1.985  -4.134 3.73e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 100.8 on 1888 degrees of freedom
## Multiple R-squared:  0.1491, Adjusted R-squared:  0.1455 
## F-statistic: 41.35 on 8 and 1888 DF,  p-value: < 2.2e-16

6.2 lmm

m21<- lme4::lmer(Math ~ Gender+ Motivation*Anxiety+ (1| School), data=dta_project)
sjPlot::tab_model(m21, show.p=TRUE, show.r2 = FALSE )
  Math
Predictors Estimates CI p
(Intercept) 565.56 534.85 – 596.26 <0.001
Gender [Male] 0.64 -7.22 – 8.51 0.873
Motivation [Intrinsic] 102.68 45.66 – 159.71 <0.001
Motivation [Both] 136.60 97.15 – 176.05 <0.001
Motivation [Extrinsic] 89.18 45.90 – 132.47 <0.001
Anxiety -2.65 -4.61 – -0.68 0.008
Motivation [Intrinsic] *
Anxiety
-4.09 -8.55 – 0.37 0.072
Motivation [Both] *
Anxiety
-7.12 -10.13 – -4.10 <0.001
Motivation [Extrinsic] *
Anxiety
-4.72 -7.75 – -1.69 0.002
Random Effects
σ2 5734.26
τ00 School 4589.81
ICC 0.44
N School 163
Observations 1897
summary(m21)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Math ~ Gender + Motivation * Anxiety + (1 | School)
##    Data: dta_project
## 
## REML criterion at convergence: 22135.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4936 -0.5907  0.0762  0.6634  2.6615 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  School   (Intercept) 4590     67.75   
##  Residual             5734     75.72   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##                             Estimate Std. Error t value
## (Intercept)                 565.5572    15.6655  36.102
## GenderMale                    0.6404     4.0128   0.160
## MotivationIntrinsic         102.6822    29.0945   3.529
## MotivationBoth              136.5998    20.1255   6.787
## MotivationExtrinsic          89.1848    22.0860   4.038
## Anxiety                      -2.6455     1.0039  -2.635
## MotivationIntrinsic:Anxiety  -4.0886     2.2747  -1.797
## MotivationBoth:Anxiety       -7.1190     1.5384  -4.628
## MotivationExtrinsic:Anxiety  -4.7175     1.5466  -3.050
## 
## Correlation of Fixed Effects:
##             (Intr) GndrMl MtvtnI MtvtnB MtvtnE Anxity MtvI:A MtvB:A
## GenderMale  -0.186                                                 
## MtvtnIntrns -0.458 -0.005                                          
## MotivatnBth -0.657 -0.016  0.358                                   
## MtvtnExtrns -0.601  0.008  0.325  0.468                            
## Anxiety     -0.911  0.081  0.483  0.694  0.630                     
## MtvtnIntr:A  0.396  0.000 -0.972 -0.309 -0.278 -0.438              
## MtvtnBth:An  0.582 -0.012 -0.314 -0.966 -0.409 -0.645  0.286       
## MtvtnExtr:A  0.579 -0.009 -0.312 -0.451 -0.978 -0.639  0.281  0.416

6.3 the 2-way interaction graph

  1. Figure 1a
ggplot(data=dta_project)+geom_smooth(mapping = aes(x=Anxiety, y=Math, color= Motivation))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

  1. Figure 1b
ggplot(data=dta_project)+geom_smooth(mapping = aes(x=Anxiety, y=Math))+facet_grid(.~Motivation)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

# Conclusion & Limitations - To decrease the risk of being classified as remedial students, promoting students to solve problem or
increase any type of Motivation seems to viable approaches. - motivation’ and ‘Anxiety’ were more important to math excellence. - Girls are more likely to exhibit math anxiety and to be devoid of motivation. - Correlated data, exercise caution in interpretation. - missing values issue.

7 Supplementary information:

Remedial students

m9<- lme4::glmer(Remedial ~ Gender+ Motivation +PS+ Anxiety+ (1| School), data=dta_project, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0596727 (tol = 0.002, component 1)
sjPlot::tab_model(m9, show.p=TRUE, show.r2 = FALSE )
  Remedial
Predictors Odds Ratios CI p
(Intercept) 0.22 0.08 – 0.61 0.003
Gender [Male] 1.22 0.86 – 1.73 0.265
Motivation [Intrinsic] 0.24 0.11 – 0.51 <0.001
Motivation [Both] 0.33 0.20 – 0.54 <0.001
Motivation [Extrinsic] 0.63 0.43 – 0.92 0.016
PS [Approach] 0.21 0.08 – 0.54 0.001
PS [Combo] 0.24 0.14 – 0.43 <0.001
Anxiety 1.05 0.99 – 1.11 0.085
Random Effects
σ2 3.29
τ00 School 1.69
ICC 0.34
N School 163
Observations 1897
summary (m9)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: Remedial ~ Gender + Motivation + PS + Anxiety + (1 | School)
##    Data: dta_project
## 
##      AIC      BIC   logLik deviance df.resid 
##   1213.3   1263.2   -597.7   1195.3     1888 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5983 -0.3231 -0.2081 -0.1358  5.3702 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  School (Intercept) 1.695    1.302   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         -1.50483    0.51349  -2.931 0.003383 ** 
## GenderMale           0.19804    0.17777   1.114 0.265280    
## MotivationIntrinsic -1.43095    0.39111  -3.659 0.000254 ***
## MotivationBoth      -1.10529    0.24936  -4.433 9.31e-06 ***
## MotivationExtrinsic -0.45848    0.19107  -2.400 0.016416 *  
## PSApproach          -1.57978    0.49289  -3.205 0.001350 ** 
## PSCombo             -1.41788    0.29763  -4.764 1.90e-06 ***
## Anxiety              0.04798    0.02782   1.725 0.084579 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) GndrMl MtvtnI MtvtnB MtvtnE PSAppr PSComb
## GenderMale  -0.289                                          
## MtvtnIntrns -0.162 -0.011                                   
## MotivatnBth -0.224 -0.134  0.197                            
## MtvtnExtrns -0.111 -0.015  0.201  0.345                     
## PSApproach  -0.327  0.018 -0.044  0.014  0.002              
## PSCombo     -0.474  0.080 -0.022 -0.041 -0.068  0.545       
## Anxiety     -0.756  0.117  0.143  0.194 -0.007  0.023 -0.065
## convergence code: 0
## Model failed to converge with max|grad| = 0.0596727 (tol = 0.002, component 1)

Math Excellence students

m10<- lme4::glmer(Excellence ~ Gender+ Motivation +PS+ Anxiety+ (1| School), data=dta_project, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.135813 (tol = 0.002, component 1)
sjPlot::tab_model(m10, show.p=TRUE, show.r2 = FALSE )
  Excellence
Predictors Odds Ratios CI p
(Intercept) 0.59 0.15 – 2.25 0.437
Gender [Male] 1.07 0.75 – 1.52 0.711
Motivation [Intrinsic] 2.65 1.44 – 4.85 0.002
Motivation [Both] 3.53 2.18 – 5.71 <0.001
Motivation [Extrinsic] 2.76 1.72 – 4.43 <0.001
PS [Approach] 1.10 0.32 – 3.79 0.877
PS [Combo] 1.52 0.55 – 4.18 0.422
Anxiety 0.77 0.73 – 0.82 <0.001
Random Effects
σ2 3.29
τ00 School 3.32
ICC 0.50
N School 163
Observations 1897
summary (m10)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: Excellence ~ Gender + Motivation + PS + Anxiety + (1 | School)
##    Data: dta_project
## 
##      AIC      BIC   logLik deviance df.resid 
##   1323.5   1373.5   -652.8   1305.5     1888 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5271 -0.3311 -0.1729 -0.0828 11.0551 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  School (Intercept) 3.319    1.822   
## Number of obs: 1897, groups:  School, 163
## 
## Fixed effects:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         -0.53229    0.68520  -0.777  0.43725    
## GenderMale           0.06679    0.18004   0.371  0.71066    
## MotivationIntrinsic  0.97367    0.30928   3.148  0.00164 ** 
## MotivationBoth       1.26061    0.24528   5.140 2.75e-07 ***
## MotivationExtrinsic  1.01633    0.24077   4.221 2.43e-05 ***
## PSApproach           0.09732    0.63067   0.154  0.87736    
## PSCombo              0.41567    0.51808   0.802  0.42236    
## Anxiety             -0.25624    0.03103  -8.257  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) GndrMl MtvtnI MtvtnB MtvtnE PSAppr PSComb
## GenderMale  -0.228                                          
## MtvtnIntrns -0.198 -0.057                                   
## MotivatnBth -0.279 -0.104  0.554                            
## MtvtnExtrns -0.155 -0.006  0.527  0.659                     
## PSApproach  -0.633  0.073 -0.059 -0.041 -0.066              
## PSCombo     -0.721  0.063 -0.065 -0.066 -0.085  0.804       
## Anxiety     -0.566  0.092  0.113  0.183 -0.029  0.074  0.016
## convergence code: 0
## Model failed to converge with max|grad| = 0.135813 (tol = 0.002, component 1)