Loading packages

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 2.2.1     ✔ readr   1.1.1
## ✔ tibble  1.4.2     ✔ purrr   0.2.4
## ✔ tidyr   0.8.0     ✔ stringr 1.2.0
## ✔ ggplot2 2.2.1     ✔ forcats 0.2.0
## Warning: package 'tibble' was built under R version 3.4.3
## Warning: package 'tidyr' was built under R version 3.4.3
## ── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(lme4)
## Warning: package 'lme4' was built under R version 3.4.3
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
## 
##     expand
library(lmerTest)
## Warning: package 'lmerTest' was built under R version 3.4.3
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
library(sjstats)
## Warning: package 'sjstats' was built under R version 3.4.3
library(jmRtools)
library(MuMIn)
## Warning: package 'MuMIn' was built under R version 3.4.3

Loading data

SciMo_esm <- read_csv("/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-Mo-esm.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   stud_ID = col_character(),
##   teacher_ID = col_integer(),
##   subject = col_integer(),
##   month = col_integer(),
##   day = col_integer(),
##   year = col_integer(),
##   pager = col_integer(),
##   Wave = col_integer(),
##   part_stat = col_integer(),
##   gender = col_integer(),
##   race = col_integer(),
##   grade = col_integer(),
##   age = col_integer(),
##   beep = col_integer(),
##   lecture = col_integer(),
##   lab = col_integer(),
##   manage = col_integer(),
##   present = col_integer(),
##   seat = col_integer(),
##   test = col_integer()
##   # ... with 3 more columns
## )
## See spec(...) for full column specifications.
## Warning in rbind(names(probs), probs_f): number of columns of result is not
## a multiple of vector length (arg 1)
## Warning: 38 parsing failures.
## row # A tibble: 5 x 5 col     row col   expected   actual file                                       expected   <int> <chr> <chr>      <chr>  <chr>                                      actual 1  2165 race  an integer NaN    '/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-M… file 2  2166 race  an integer NaN    '/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-M… row 3  2167 race  an integer NaN    '/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-M… col 4  2168 race  an integer NaN    '/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-M… expected 5  2169 race  an integer NaN    '/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-M…
## ... ................. ... .......................................................................... ........ .......................................................................... ...... .......................................................................... .... .......................................................................... ... .......................................................................... ... .......................................................................... ........ ..........................................................................
## See problems(...) for more details.
SciMo_student_survey <- read_csv("/Volumes/SCHMIDTLAB/PSE/Data/SciMo/Sci-Mo-student-survey.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   stud_ID = col_character(),
##   FirstQuar_2010 = col_integer(),
##   SecondQuar_2010 = col_integer(),
##   ThirdQuar_2010 = col_character(),
##   FourthQuar_2010 = col_character(),
##   ExploreComp_2010 = col_integer(),
##   PlanComp_2010 = col_integer(),
##   ACTComp_2010 = col_integer(),
##   Grad_2010 = col_integer(),
##   FirstQuar_2011 = col_integer(),
##   SecondQuar_2011 = col_integer(),
##   ThirdQuar_2011 = col_character(),
##   FourthQuar_2011 = col_integer(),
##   ExloreComp2011 = col_integer(),
##   ExploreSciComp_2011 = col_integer(),
##   PlanComp_2011 = col_integer(),
##   PlanSciComp_2011 = col_integer(),
##   ACTComp_2011 = col_integer(),
##   ACTSciComp_2011 = col_integer(),
##   Grad_2011 = col_integer()
## )
## See spec(...) for full column specifications.

Creating variables

SciMo_student_survey$female <- ifelse(SciMo_student_survey$gender == 2, 1, 0)
SciMo_student_survey$minority <- ifelse(SciMo_student_survey$race == 4, 0, 1)
SciMo_esm$engagement_three <- composite_mean_maker(SciMo_esm, enjoy, conc, hardwk)
fix_missing <- function(x) {
  x[x == NA] <- 0
  x
}
SciMo_esm$ch_who[is.na(SciMo_esm$ch_who)] <- 0
SciMo_esm$ch_howdo[is.na(SciMo_esm$ch_howdo)] <- 0
SciMo_esm$ch_mat[is.na(SciMo_esm$ch_mat)] <- 0
SciMo_esm$ch_time[is.na(SciMo_esm$ch_time)] <- 0
SciMo_esm$ch_doing[is.na(SciMo_esm$ch_doing)] <- 0
SciMo_esm$ch_topic[is.na(SciMo_esm$ch_topic)] <- 0
SciMo_esm$ch_defin[is.na(SciMo_esm$ch_defin)] <- 0
SciMo_esm$ch_other[is.na(SciMo_esm$ch_other)] <- 0
SciMo_esm$ch_none[is.na(SciMo_esm$ch_none)] <- 0
SciMo_esm$ch_none <- ifelse(((SciMo_esm$ch_who == 0 & SciMo_esm$ch_howdo == 0 & SciMo_esm$ch_mat == 0 & SciMo_esm$ch_time == 0 & SciMo_esm$ch_doing == 0 &
                                SciMo_esm$ch_defin == 0 & SciMo_esm$ch_topic == 0 & SciMo_esm$ch_other == 0) & SciMo_esm$ch_none == 0), 1, SciMo_esm$ch_none)
SciMo_esm$ch_none <- ifelse(((SciMo_esm$ch_who == 1 | SciMo_esm$ch_howdo == 1 | SciMo_esm$ch_mat == 1 | SciMo_esm$ch_time == 1 | SciMo_esm$ch_doing |
                                SciMo_esm$ch_defin == 1 | SciMo_esm$ch_topic == 1 | SciMo_esm$ch_other == 1) & SciMo_esm$ch_none == 1), 0, SciMo_esm$ch_none)
SciMo_esm$ch_framing <- ifelse(SciMo_esm$ch_defin == 1 | SciMo_esm$ch_topic == 1 | SciMo_esm$ch_doing, 1, 0)
SciMo_esm$anychoice <- ifelse(SciMo_esm$ch_mat == 1 | SciMo_esm$ch_howdo == 1 | SciMo_esm$ch_topic == 1 | SciMo_esm$ch_doing == 1 |SciMo_esm$ch_time == 1 |
                                 SciMo_esm$ch_who == 1 | SciMo_esm$ch_defin == 1 |  SciMo_esm$ch_other == 1, 1, 0)

Join data

SciMo_All <- left_join(SciMo_student_survey, SciMo_esm, by = "stud_ID")

Creating new beep_id variable for cross classification

SciMo_All<- SciMo_All %>%
  dplyr::mutate(beep_id = stringr::str_c(signal, teacher_ID1, month, day, year))

Creating scaled interest variable

SciMo_All$interest_c <- scale(SciMo_All$interest)

Null Models

Null engagement model

M0 <- lmer(engagement_three ~
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M0)
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: 
## engagement_three ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 8115.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9111 -0.6117  0.0361  0.6341  2.9416 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.04092  0.2023  
##  stud_ID     (Intercept) 0.22590  0.4753  
##  teacher_ID1 (Intercept) 0.01347  0.1160  
##  Residual                0.36309  0.6026  
## Number of obs: 4001, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  1.63997    0.04887   33.55
sjstats::icc(M0)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: engagement_three ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.063595
##       ICC (stud_ID): 0.351116
##   ICC (teacher_ID1): 0.020930

Null positive affect model

M00 <- lmer(posaffect ~
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
            data = SciMo_All)
summary(M00)
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: posaffect ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 8242.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5316 -0.6240 -0.1028  0.5386  3.8416 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.0148   0.1217  
##  stud_ID     (Intercept) 0.3326   0.5767  
##  teacher_ID1 (Intercept) 0.0000   0.0000  
##  Residual                0.3845   0.6200  
## Number of obs: 3982, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  1.05434    0.04006   26.32
sjstats::icc(M00)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: posaffect ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.020229
##       ICC (stud_ID): 0.454454
##   ICC (teacher_ID1): 0.000000

Null negative affect model

M000 <- lmer(negaffect ~
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
             data = SciMo_All)
summary(M000)
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: negaffect ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7882.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5612 -0.5353 -0.1660  0.3599  4.5191 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01679  0.1296  
##  stud_ID     (Intercept) 0.19937  0.4465  
##  teacher_ID1 (Intercept) 0.01915  0.1384  
##  Residual                0.35720  0.5977  
## Number of obs: 3980, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  0.57815    0.05145   11.24
sjstats::icc(M000)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: negaffect ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.028338
##       ICC (stud_ID): 0.336484
##   ICC (teacher_ID1): 0.032312

Null learning model

M0000 <- lmer(learning ~
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
             data = SciMo_All)
summary(M0000)
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: learning ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 10203.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1964 -0.6184  0.0670  0.6803  2.7711 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.06631  0.2575  
##  stud_ID     (Intercept) 0.24948  0.4995  
##  teacher_ID1 (Intercept) 0.02262  0.1504  
##  Residual                0.63575  0.7973  
## Number of obs: 3981, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  1.68251    0.05866   28.68
sjstats::icc(M0000)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: learning ~ (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.068066
##       ICC (stud_ID): 0.256098
##   ICC (teacher_ID1): 0.023218

Models with just any choice and interest as predictors

Engagement

M1 <- lmer(engagement_three ~ 
             interest_c + 
             anychoice +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M1)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: engagement_three ~ interest_c + anychoice + (1 | stud_ID) + (1 |  
##     teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 6884.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4677 -0.6179  0.0269  0.6459  3.9276 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01584  0.1259  
##  stud_ID     (Intercept) 0.10336  0.3215  
##  teacher_ID1 (Intercept) 0.01337  0.1156  
##  Residual                0.29452  0.5427  
## Number of obs: 3884, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.585e+00  4.340e-02 1.100e+01  36.525 1.09e-12 ***
## interest_c  3.754e-01  1.089e-02 3.747e+03  34.486  < 2e-16 ***
## anychoice   8.930e-02  2.248e-02 3.836e+03   3.973 7.24e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_
## interest_c  0.017       
## anychoice  -0.292 -0.059
sjstats::icc(M1)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: engagement_three ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.037095
##       ICC (stud_ID): 0.242000
##   ICC (teacher_ID1): 0.031316

Positive Affect

M2 <- lmer(posaffect ~ 
             interest_c + 
             anychoice +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M2)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## posaffect ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7543
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0082 -0.6226 -0.0950  0.5438  4.3392 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  beep_id     (Intercept) 0.0032709 0.05719 
##  stud_ID     (Intercept) 0.2712346 0.52080 
##  teacher_ID1 (Intercept) 0.0004154 0.02038 
##  Residual                0.3469680 0.58904 
## Number of obs: 3873, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.019e+00  3.870e-02 1.300e+01  26.341 2.28e-12 ***
## interest_c  2.674e-01  1.169e-02 3.302e+03  22.871  < 2e-16 ***
## anychoice   6.539e-02  2.437e-02 3.650e+03   2.683  0.00733 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_
## interest_c  0.018       
## anychoice  -0.346 -0.048
sjstats::icc(M2)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: posaffect ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.005260
##       ICC (stud_ID): 0.436146
##   ICC (teacher_ID1): 0.000668

Negative Affect

M3 <- lmer(negaffect ~ 
             interest_c + 
             anychoice +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M3)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## negaffect ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7657.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6525 -0.5391 -0.1693  0.3570  4.6170 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01513  0.1230  
##  stud_ID     (Intercept) 0.20000  0.4472  
##  teacher_ID1 (Intercept) 0.01904  0.1380  
##  Residual                0.35490  0.5957  
## Number of obs: 3873, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##               Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)  5.818e-01  5.322e-02  1.200e+01  10.933 1.73e-07 ***
## interest_c  -7.660e-02  1.207e-02  3.679e+03  -6.346 2.48e-10 ***
## anychoice   -8.287e-03  2.494e-02  3.851e+03  -0.332     0.74    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_
## interest_c  0.014       
## anychoice  -0.263 -0.053
sjstats::icc(M3)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: negaffect ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.025678
##       ICC (stud_ID): 0.339520
##   ICC (teacher_ID1): 0.032315

Learning

M4 <- lmer(learning ~ 
             interest_c + 
             anychoice +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M4)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## learning ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 9298.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6915 -0.6149  0.0334  0.6511  3.0104 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.03259  0.1805  
##  stud_ID     (Intercept) 0.12625  0.3553  
##  teacher_ID1 (Intercept) 0.02394  0.1547  
##  Residual                0.56424  0.7512  
## Number of obs: 3869, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.634e+00  5.615e-02 1.200e+01  29.100 1.55e-12 ***
## interest_c  3.947e-01  1.489e-02 3.632e+03  26.511  < 2e-16 ***
## anychoice   8.185e-02  3.070e-02 3.662e+03   2.666  0.00771 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_
## interest_c  0.020       
## anychoice  -0.309 -0.064
sjstats::icc(M4)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: learning ~ interest_c + anychoice + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.043628
##       ICC (stud_ID): 0.169009
##   ICC (teacher_ID1): 0.032042

Models with just all choices and interest as predictors

Engagement

M1a <- lmer(engagement_three ~ 
             interest_c + 
             ch_who + 
             ch_howdo + 
             ch_mat + 
             ch_time + 
             ch_other + 
             ch_framing +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M1a)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: engagement_three ~ interest_c + ch_who + ch_howdo + ch_mat +  
##     ch_time + ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 6887.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4265 -0.6107  0.0271  0.6403  3.9307 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01475  0.1215  
##  stud_ID     (Intercept) 0.10413  0.3227  
##  teacher_ID1 (Intercept) 0.01298  0.1139  
##  Residual                0.29359  0.5418  
## Number of obs: 3884, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##               Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)    1.59546    0.04240   10.00000  37.633 2.35e-12 ***
## interest_c     0.37382    0.01088 3742.00000  34.356  < 2e-16 ***
## ch_who        -0.01970    0.03424 3348.00000  -0.575 0.565090    
## ch_howdo       0.07240    0.02805 3821.00000   2.581 0.009891 ** 
## ch_mat         0.06899    0.03296 3861.00000   2.093 0.036378 *  
## ch_time        0.10604    0.03052 3857.00000   3.475 0.000517 ***
## ch_other      -0.02295    0.02957 3798.00000  -0.776 0.437728    
## ch_framing     0.02676    0.02846 3836.00000   0.940 0.347155    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr
## interest_c  0.018                                          
## ch_who     -0.046 -0.002                                   
## ch_howdo   -0.082 -0.027 -0.110                            
## ch_mat     -0.052 -0.060 -0.136 -0.228                     
## ch_time    -0.065 -0.010 -0.136 -0.152 -0.107              
## ch_other   -0.143 -0.039  0.010  0.029  0.041  0.024       
## ch_framing -0.111 -0.016 -0.059 -0.063 -0.057 -0.017  0.058
sjstats::icc(M1a)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: engagement_three ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.034671
##       ICC (stud_ID): 0.244756
##   ICC (teacher_ID1): 0.030498

Positive Affect

M2a <- lmer(posaffect ~ 
             interest_c + 
             ch_who + 
             ch_howdo + 
             ch_mat + 
             ch_time + 
             ch_other + 
             ch_framing +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M2a)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: posaffect ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time +  
##     ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7560.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0218 -0.6184 -0.0989  0.5427  4.2937 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  beep_id     (Intercept) 0.0031145 0.05581 
##  stud_ID     (Intercept) 0.2714202 0.52098 
##  teacher_ID1 (Intercept) 0.0002111 0.01453 
##  Residual                0.3468789 0.58896 
## Number of obs: 3873, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept) 1.024e+00  3.771e-02 1.200e+01  27.150 7.34e-12 ***
## interest_c  2.667e-01  1.172e-02 3.327e+03  22.756  < 2e-16 ***
## ch_who      9.445e-02  3.603e-02 2.629e+03   2.621  0.00881 ** 
## ch_howdo    6.700e-03  3.055e-02 3.771e+03   0.219  0.82642    
## ch_mat      3.299e-02  3.560e-02 3.651e+03   0.927  0.35417    
## ch_time     3.143e-02  3.308e-02 3.744e+03   0.950  0.34208    
## ch_other    5.146e-02  3.246e-02 3.833e+03   1.585  0.11295    
## ch_framing  6.211e-03  3.124e-02 3.834e+03   0.199  0.84244    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr
## interest_c  0.019                                          
## ch_who     -0.045  0.001                                   
## ch_howdo   -0.098 -0.023 -0.113                            
## ch_mat     -0.062 -0.070 -0.136 -0.235                     
## ch_time    -0.079  0.001 -0.142 -0.149 -0.104              
## ch_other   -0.173 -0.029  0.002  0.030  0.045  0.023       
## ch_framing -0.135 -0.010 -0.063 -0.057 -0.053 -0.012  0.062
sjstats::icc(M2a)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: posaffect ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.005010
##       ICC (stud_ID): 0.436630
##   ICC (teacher_ID1): 0.000340

Engagement

M3a <- lmer(negaffect ~ 
             interest_c + 
             ch_who + 
             ch_howdo + 
             ch_mat + 
             ch_time + 
             ch_other + 
             ch_framing +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M3a)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: negaffect ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time +  
##     ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7672.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5981 -0.5473 -0.1670  0.3578  4.7040 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01371  0.1171  
##  stud_ID     (Intercept) 0.20156  0.4490  
##  teacher_ID1 (Intercept) 0.01846  0.1359  
##  Residual                0.35520  0.5960  
## Number of obs: 3873, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##               Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)  5.769e-01  5.219e-02  1.100e+01  11.054 2.36e-07 ***
## interest_c  -7.739e-02  1.208e-02  3.663e+03  -6.407 1.67e-10 ***
## ch_who      -3.956e-02  3.762e-02  3.135e+03  -1.052   0.2931    
## ch_howdo     1.308e-02  3.109e-02  3.780e+03   0.421   0.6740    
## ch_mat       2.833e-02  3.647e-02  3.798e+03   0.777   0.4374    
## ch_time      6.592e-02  3.378e-02  3.805e+03   1.951   0.0511 .  
## ch_other    -5.799e-02  3.298e-02  3.860e+03  -1.758   0.0788 .  
## ch_framing  -9.226e-03  3.171e-02  3.844e+03  -0.291   0.7711    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr
## interest_c  0.016                                          
## ch_who     -0.039 -0.001                                   
## ch_howdo   -0.075 -0.023 -0.108                            
## ch_mat     -0.048 -0.062 -0.136 -0.229                     
## ch_time    -0.059 -0.008 -0.138 -0.148 -0.106              
## ch_other   -0.129 -0.033  0.007  0.030  0.042  0.023       
## ch_framing -0.101 -0.013 -0.063 -0.058 -0.055 -0.012  0.061
sjstats::icc(M3a)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: negaffect ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.023286
##       ICC (stud_ID): 0.342241
##   ICC (teacher_ID1): 0.031351

Learning

M4a <- lmer(learning ~ 
             interest_c + 
             ch_who + 
             ch_howdo + 
             ch_mat + 
             ch_time + 
             ch_other + 
             ch_framing +
             (1|stud_ID) + 
             (1|teacher_ID1) + 
             (1|beep_id), 
           data = SciMo_All)
summary(M4a)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: learning ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time +  
##     ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) +  
##     (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 9321.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6850 -0.6131  0.0352  0.6562  2.9832 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.03251  0.1803  
##  stud_ID     (Intercept) 0.12626  0.3553  
##  teacher_ID1 (Intercept) 0.02256  0.1502  
##  Residual                0.56537  0.7519  
## Number of obs: 3869, groups:  beep_id, 246; stud_ID, 232; teacher_ID1, 12
## 
## Fixed effects:
##               Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)    1.65997    0.05423   11.00000  30.609 3.73e-12 ***
## interest_c     0.39517    0.01494 3643.00000  26.456  < 2e-16 ***
## ch_who        -0.04334    0.04739 3445.00000  -0.914   0.3606    
## ch_howdo       0.03303    0.03862 3818.00000   0.855   0.3924    
## ch_mat         0.03239    0.04540 3835.00000   0.713   0.4756    
## ch_time       -0.01684    0.04201 3855.00000  -0.401   0.6886    
## ch_other       0.07535    0.04037 3553.00000   1.866   0.0621 .  
## ch_framing     0.01709    0.03897 3699.00000   0.439   0.6610    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr
## interest_c  0.021                                          
## ch_who     -0.051 -0.001                                   
## ch_howdo   -0.086 -0.028 -0.111                            
## ch_mat     -0.055 -0.060 -0.136 -0.231                     
## ch_time    -0.068 -0.013 -0.137 -0.158 -0.107              
## ch_other   -0.153 -0.042  0.012  0.029  0.041  0.023       
## ch_framing -0.117 -0.021 -0.057 -0.071 -0.063 -0.021  0.056
sjstats::icc(M4a)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: learning ~ interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.043534
##       ICC (stud_ID): 0.169088
##   ICC (teacher_ID1): 0.030210

Any Choice & Interest Models

Any choice predicting engagement

M1_1 <- lmer(engagement_three ~ scale(interesfun1, scale=FALSE) +
             interest_c + 
             anychoice + 
             interest_c*anychoice + 
             female + 
             minority +  
             (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M1_1)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## engagement_three ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     anychoice + interest_c * anychoice + female + minority +  
##     (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 6844.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3567 -0.6159  0.0292  0.6424  4.0472 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01605  0.1267  
##  stud_ID     (Intercept) 0.09072  0.3012  
##  teacher_ID1 (Intercept) 0.01010  0.1005  
##  Residual                0.29431  0.5425  
## Number of obs: 3868, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                          1.66578    0.05308   33.00000  31.384
## scale(interesfun1, scale = FALSE)    0.15274    0.02859  226.00000   5.343
## interest_c                           0.39715    0.01549 3840.00000  25.642
## anychoice                            0.08355    0.02247 3789.00000   3.719
## female                              -0.03003    0.04459  216.00000  -0.674
## minority                            -0.09188    0.04761  219.00000  -1.930
## interest_c:anychoice                -0.04864    0.01964 3805.00000  -2.477
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE) 2.23e-07 ***
## interest_c                         < 2e-16 ***
## anychoice                         0.000203 ***
## female                            0.501304    
## minority                          0.054896 .  
## interest_c:anychoice              0.013292 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ anychc female minrty
## s(1,s=FALSE  0.007                                   
## interest_c   0.039 -0.087                            
## anychoice   -0.216 -0.040 -0.069                     
## female      -0.365  0.103 -0.008  0.000              
## minority    -0.542 -0.054 -0.016 -0.042 -0.047       
## intrst_c:ny -0.033  0.001 -0.707  0.046  0.013  0.001
rand(M1_1)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID     531.48      1  <2e-16 ***
## teacher_ID1   4.47      1    0.03 *  
## beep_id      48.05      1   4e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M1_1)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: engagement_three ~ scale(interesfun1, scale = FALSE) + interest_c + anychoice + interest_c * anychoice + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.039030
##       ICC (stud_ID): 0.220640
##   ICC (teacher_ID1): 0.024558
sjPlot::sjp.int(M1_1, type = "eff", swap.pred = TRUE)
## `sjp.int()` will become deprecated in the future. Please use `plot_model()` instead.

#konfound::konfound(M1_1, `interest*choice`)
M1_1r<-r2glmm::r2beta(M1_1, method = "nsj")
M1_1r
##                              Effect   Rsq upper.CL lower.CL
## 1                             Model 0.306    0.329    0.285
## 3                        interest_c 0.141    0.161    0.122
## 2 scale(interesfun1, scale = FALSE) 0.032    0.044    0.022
## 6                          minority 0.005    0.010    0.001
## 4                         anychoice 0.004    0.009    0.001
## 7              interest_c:anychoice 0.001    0.005    0.000
## 5                            female 0.001    0.003    0.000
MuMIn::r.squaredGLMM(M1_1)
##       R2m       R2c 
## 0.3062082 0.5034031
plot(M1_1r)

Any choice predicting positive affect

M2_2 <- lmer(posaffect ~ scale(interesfun1, scale=FALSE) +
             interest_c + 
             anychoice + 
             interest_c*anychoice + 
             female + 
             minority +  
             (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M2_2)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: posaffect ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     anychoice + interest_c * anychoice + female + minority +  
##     (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7526.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9681 -0.6127 -0.0911  0.5483  4.3593 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.003049 0.05521 
##  stud_ID     (Intercept) 0.265018 0.51480 
##  teacher_ID1 (Intercept) 0.000000 0.00000 
##  Residual                0.347860 0.58980 
## Number of obs: 3857, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                          1.00751    0.06745  240.00000  14.937
## scale(interesfun1, scale = FALSE)    0.11122    0.04467  231.00000   2.490
## interest_c                           0.24921    0.01666 3503.00000  14.958
## anychoice                            0.06440    0.02447 3693.00000   2.631
## female                              -0.07465    0.07109  226.00000  -1.050
## minority                             0.07734    0.07367  226.00000   1.050
## interest_c:anychoice                 0.02717    0.02131 3737.00000   1.275
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE)  0.01349 *  
## interest_c                         < 2e-16 ***
## anychoice                          0.00854 ** 
## female                             0.29482    
## minority                           0.29489    
## interest_c:anychoice               0.20244    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ anychc female minrty
## s(1,s=FALSE  0.028                                   
## interest_c   0.029 -0.056                            
## anychoice   -0.176 -0.029 -0.064                     
## female      -0.467  0.089 -0.008  0.005              
## minority    -0.660 -0.087 -0.006 -0.040 -0.045       
## intrst_c:ny -0.025 -0.002 -0.708  0.047  0.007  0.000
rand(M2_2)
## Analysis of Random effects Table:
##              Chi.sq Chi.DF p.value    
## stud_ID     1485.56      1  <2e-16 ***
## teacher_ID1    0.00      1     1.0    
## beep_id        1.77      1     0.2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M2_2)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: posaffect ~ scale(interesfun1, scale = FALSE) + interest_c + anychoice + interest_c * anychoice + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.004950
##       ICC (stud_ID): 0.430275
##   ICC (teacher_ID1): 0.000000
#sjPlot::sjp.int(M2_2, type = "eff")
#konfound::konfound(M2_2, `interest*choice`)
M2_2r<-r2glmm::r2beta(M2_2, method = "nsj")
M2_2r
##                              Effect   Rsq upper.CL lower.CL
## 1                             Model 0.140    0.161    0.122
## 3                        interest_c 0.042    0.055    0.030
## 2 scale(interesfun1, scale = FALSE) 0.012    0.019    0.006
## 6                          minority 0.002    0.006    0.000
## 5                            female 0.002    0.006    0.000
## 4                         anychoice 0.002    0.005    0.000
## 7              interest_c:anychoice 0.000    0.002    0.000
MuMIn::r.squaredGLMM(M2_2)
##       R2m       R2c 
## 0.1396755 0.5141098
#plot(M2_2r)

Any choice predicting negative affect

M3_3 <- lmer(negaffect ~ scale(interesfun1, scale=FALSE) +
             interest_c + 
             anychoice + 
             interest_c*anychoice + 
             female + 
             minority +  
             (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M3_3)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: negaffect ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     anychoice + interest_c * anychoice + female + minority +  
##     (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7639.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6106 -0.5468 -0.1664  0.3723  4.6167 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01506  0.1227  
##  stud_ID     (Intercept) 0.18930  0.4351  
##  teacher_ID1 (Intercept) 0.02346  0.1532  
##  Residual                0.35584  0.5965  
## Number of obs: 3857, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                        5.253e-01  7.509e-02  3.300e+01   6.995
## scale(interesfun1, scale = FALSE) -6.493e-02  3.971e-02  2.250e+02  -1.635
## interest_c                        -7.728e-02  1.715e-02  3.761e+03  -4.506
## anychoice                         -5.840e-03  2.505e-02  3.835e+03  -0.233
## female                             1.858e-01  6.205e-02  2.170e+02   2.994
## minority                          -4.905e-02  6.642e-02  2.210e+02  -0.739
## interest_c:anychoice               5.923e-03  2.174e-02  3.754e+03   0.272
##                                   Pr(>|t|)    
## (Intercept)                       5.22e-08 ***
## scale(interesfun1, scale = FALSE)  0.10340    
## interest_c                        6.81e-06 ***
## anychoice                          0.81568    
## female                             0.00308 ** 
## minority                           0.46098    
## interest_c:anychoice               0.78531    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ anychc female minrty
## s(1,s=FALSE  0.006                                   
## interest_c   0.030 -0.069                            
## anychoice   -0.170 -0.034 -0.069                     
## female      -0.359  0.100 -0.006 -0.001              
## minority    -0.539 -0.054 -0.012 -0.033 -0.047       
## intrst_c:ny -0.026 -0.001 -0.705  0.049  0.009  0.001
rand(M3_3)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID     971.50      1  <2e-16 ***
## teacher_ID1   7.49      1   0.006 ** 
## beep_id      30.22      1   4e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M3_3)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: negaffect ~ scale(interesfun1, scale = FALSE) + interest_c + anychoice + interest_c * anychoice + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.025802
##       ICC (stud_ID): 0.324334
##   ICC (teacher_ID1): 0.040188
#sjPlot::sjp.int(M3_3, type = "eff")
#konfound::konfound(M3_3, `interest*choice`)
M3_3r<-r2glmm::r2beta(M3_3, method = "nsj")
M3_3r
##                              Effect   Rsq upper.CL lower.CL
## 1                             Model 0.035    0.049    0.026
## 5                            female 0.014    0.023    0.008
## 3                        interest_c 0.004    0.009    0.001
## 2 scale(interesfun1, scale = FALSE) 0.004    0.009    0.001
## 6                          minority 0.001    0.004    0.000
## 7              interest_c:anychoice 0.000    0.001    0.000
## 4                         anychoice 0.000    0.001    0.000
MuMIn::r.squaredGLMM(M3_3)
##        R2m        R2c 
## 0.03521135 0.41179243
#plot(M3_3r)

Any choice predicting learning

M4_4 <- lmer(learning ~ scale(interesfun1, scale=FALSE) +
             interest_c + 
             anychoice + 
             interest_c*anychoice + 
             female + 
             minority +  
             (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M4_4)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## learning ~ scale(interesfun1, scale = FALSE) + interest_c + anychoice +  
##     interest_c * anychoice + female + minority + (1 | stud_ID) +  
##     (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 9256.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6416 -0.6180  0.0337  0.6554  3.1005 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.03262  0.1806  
##  stud_ID     (Intercept) 0.11200  0.3347  
##  teacher_ID1 (Intercept) 0.01751  0.1323  
##  Residual                0.56498  0.7516  
## Number of obs: 3853, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                          1.72011    0.06523   30.00000  26.370
## scale(interesfun1, scale = FALSE)    0.16186    0.03343  225.00000   4.842
## interest_c                           0.39990    0.02133 3818.00000  18.749
## anychoice                            0.07701    0.03069 3582.00000   2.509
## female                               0.01395    0.05195  214.00000   0.268
## minority                            -0.13537    0.05559  218.00000  -2.435
## interest_c:anychoice                -0.01875    0.02704 3811.00000  -0.693
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE) 2.39e-06 ***
## interest_c                         < 2e-16 ***
## anychoice                           0.0121 *  
## female                              0.7886    
## minority                            0.0157 *  
## interest_c:anychoice                0.4882    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ anychc female minrty
## s(1,s=FALSE  0.006                                   
## interest_c   0.045 -0.103                            
## anychoice   -0.241 -0.046 -0.069                     
## female      -0.345  0.108 -0.009 -0.001              
## minority    -0.511 -0.050 -0.022 -0.048 -0.048       
## intrst_c:ny -0.037  0.002 -0.709  0.044  0.015  0.003
rand(M4_4)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID      315.3      1  <2e-16 ***
## teacher_ID1    5.7      1    0.02 *  
## beep_id       53.3      1   3e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M4_4)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: learning ~ scale(interesfun1, scale = FALSE) + interest_c + anychoice + interest_c * anychoice + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.044860
##       ICC (stud_ID): 0.154034
##   ICC (teacher_ID1): 0.024079
#sjPlot::sjp.int(M4_4, type = "eff")
#konfound::konfound(M4_4, `interest*choice`)
M4_4r<-r2glmm::r2beta(M4_4, method = "nsj")
M4_4r
##                              Effect   Rsq upper.CL lower.CL
## 1                             Model 0.215    0.238    0.194
## 3                        interest_c 0.086    0.103    0.070
## 2 scale(interesfun1, scale = FALSE) 0.021    0.031    0.013
## 6                          minority 0.006    0.011    0.002
## 4                         anychoice 0.002    0.006    0.000
## 7              interest_c:anychoice 0.000    0.002    0.000
## 5                            female 0.000    0.002    0.000
MuMIn::r.squaredGLMM(M4_4)
##       R2m       R2c 
## 0.2150382 0.3900638
#plot(M4_4r)

All Choices and Interest Models

All choices predicting engagement

M11<-lmer(engagement_three ~ scale(interesfun1, scale=FALSE) + 
            interest_c + 
            ch_who + 
            ch_howdo + 
            ch_mat + 
            ch_time + 
            ch_other + 
            ch_framing +
            female + 
            minority + 
            (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M11)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## engagement_three ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing +  
##     female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 |  
##     beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 6848.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3660 -0.6093  0.0310  0.6405  3.9732 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01493  0.1222  
##  stud_ID     (Intercept) 0.09117  0.3019  
##  teacher_ID1 (Intercept) 0.01038  0.1019  
##  Residual                0.29392  0.5421  
## Number of obs: 3868, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                          1.67195    0.05290   32.00000  31.608
## scale(interesfun1, scale = FALSE)    0.15011    0.02866  227.00000   5.237
## interest_c                           0.36863    0.01096 3735.00000  33.636
## ch_who                              -0.01846    0.03425 3345.00000  -0.539
## ch_howdo                             0.07135    0.02801 3812.00000   2.548
## ch_mat                               0.06895    0.03298 3844.00000   2.091
## ch_time                              0.10060    0.03048 3847.00000   3.300
## ch_other                            -0.02361    0.02945 3737.00000  -0.802
## ch_framing                           0.02286    0.02842 3800.00000   0.804
## female                              -0.02879    0.04471  217.00000  -0.644
## minority                            -0.09190    0.04780  221.00000  -1.923
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE) 3.72e-07 ***
## interest_c                         < 2e-16 ***
## ch_who                            0.589821    
## ch_howdo                          0.010882 *  
## ch_mat                            0.036629 *  
## ch_time                           0.000975 ***
## ch_other                          0.422734    
## ch_framing                        0.421374    
## female                            0.520306    
## minority                          0.055815 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr ch_frm
## s(1,s=FALSE  0.006                                                        
## interest_c   0.022 -0.120                                                 
## ch_who      -0.042  0.002 -0.002                                          
## ch_howdo    -0.063 -0.001 -0.027 -0.111                                   
## ch_mat      -0.010 -0.024 -0.056 -0.133 -0.229                            
## ch_time     -0.060 -0.027 -0.008 -0.137 -0.154 -0.108                     
## ch_other    -0.103 -0.015 -0.037  0.010  0.029  0.041  0.025              
## ch_framing  -0.074 -0.029 -0.011 -0.059 -0.065 -0.056 -0.018  0.058       
## female      -0.364  0.104  0.003  0.007 -0.001  0.001 -0.017 -0.030  0.015
## minority    -0.549 -0.053 -0.019  0.004 -0.003 -0.056  0.025  0.000 -0.037
##             female
## s(1,s=FALSE       
## interest_c        
## ch_who            
## ch_howdo          
## ch_mat            
## ch_time           
## ch_other          
## ch_framing        
## female            
## minority    -0.048
rand(M11)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID     535.38      1  <2e-16 ***
## teacher_ID1   4.71      1    0.03 *  
## beep_id      42.33      1   8e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M11)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: engagement_three ~ scale(interesfun1, scale = FALSE) + interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.036370
##       ICC (stud_ID): 0.222159
##   ICC (teacher_ID1): 0.025289
#sjPlot::sjp.int(M11, type = "eff")
M11r<-r2glmm::r2beta(M11, method = "nsj")
M11r
##                               Effect   Rsq upper.CL lower.CL
## 1                              Model 0.310    0.333    0.289
## 3                         interest_c 0.236    0.258    0.214
## 2  scale(interesfun1, scale = FALSE) 0.031    0.043    0.021
## 11                          minority 0.005    0.010    0.001
## 7                            ch_time 0.003    0.007    0.000
## 5                           ch_howdo 0.002    0.005    0.000
## 6                             ch_mat 0.001    0.004    0.000
## 10                            female 0.000    0.003    0.000
## 8                           ch_other 0.000    0.002    0.000
## 9                         ch_framing 0.000    0.002    0.000
## 4                             ch_who 0.000    0.002    0.000
MuMIn::r.squaredGLMM(M11)
##       R2m       R2c 
## 0.3097582 0.5056612
#plot(M11r)

All choices predicting positive affect

M22<-lmer(posaffect ~ scale(interesfun1, scale=FALSE) + 
            interest_c + 
            ch_who + 
            ch_howdo + 
            ch_mat + 
            ch_time + 
            ch_other + 
            ch_framing +
            female + 
            minority + 
            (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M22)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: posaffect ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing +  
##     female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 |  
##     beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7539.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9918 -0.6170 -0.0985  0.5450  4.3094 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. 
##  beep_id     (Intercept) 2.903e-03 5.388e-02
##  stud_ID     (Intercept) 2.649e-01 5.147e-01
##  teacher_ID1 (Intercept) 3.000e-13 5.477e-07
##  Residual                3.478e-01 5.898e-01
## Number of obs: 3857, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                        1.015e+00  6.703e-02  2.340e+02  15.144
## scale(interesfun1, scale = FALSE)  1.103e-01  4.468e-02  2.300e+02   2.469
## interest_c                         2.635e-01  1.180e-02  3.302e+03  22.332
## ch_who                             9.528e-02  3.609e-02  2.601e+03   2.640
## ch_howdo                           5.891e-03  3.058e-02  3.761e+03   0.193
## ch_mat                             3.144e-02  3.571e-02  3.626e+03   0.881
## ch_time                            2.928e-02  3.312e-02  3.728e+03   0.884
## ch_other                           5.122e-02  3.248e-02  3.830e+03   1.577
## ch_framing                         2.708e-03  3.133e-02  3.818e+03   0.086
## female                            -7.664e-02  7.109e-02  2.260e+02  -1.078
## minority                           7.673e-02  7.372e-02  2.260e+02   1.041
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE)  0.01429 *  
## interest_c                         < 2e-16 ***
## ch_who                             0.00834 ** 
## ch_howdo                           0.84726    
## ch_mat                             0.37863    
## ch_time                            0.37669    
## ch_other                           0.11493    
## ch_framing                         0.93111    
## female                             0.28221    
## minority                           0.29907    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr ch_frm
## s(1,s=FALSE  0.028                                                        
## interest_c   0.015 -0.080                                                 
## ch_who      -0.023 -0.003  0.001                                          
## ch_howdo    -0.056  0.000 -0.023 -0.114                                   
## ch_mat      -0.006 -0.013 -0.068 -0.132 -0.236                            
## ch_time     -0.047 -0.024  0.003 -0.143 -0.149 -0.104                     
## ch_other    -0.084 -0.011 -0.028  0.002  0.030  0.045  0.024              
## ch_framing  -0.061 -0.020 -0.006 -0.063 -0.057 -0.052 -0.012  0.063       
## female      -0.468  0.089 -0.004  0.007  0.002  0.002 -0.010 -0.016  0.009
## minority    -0.666 -0.087 -0.006 -0.009  0.000 -0.043  0.010 -0.008 -0.028
##             female
## s(1,s=FALSE       
## interest_c        
## ch_who            
## ch_howdo          
## ch_mat            
## ch_time           
## ch_other          
## ch_framing        
## female            
## minority    -0.046
rand(M22)
## Analysis of Random effects Table:
##               Chi.sq Chi.DF p.value    
## stud_ID     1.46e+03      1  <2e-16 ***
## teacher_ID1 6.37e-12      1     1.0    
## beep_id     1.61e+00      1     0.2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M22)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: posaffect ~ scale(interesfun1, scale = FALSE) + interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.004716
##       ICC (stud_ID): 0.430321
##   ICC (teacher_ID1): 0.000000
#sjPlot::sjp.int(M22, type = "eff")
M22r<-r2glmm::r2beta(M22, method = "nsj")
M22r
##                               Effect   Rsq upper.CL lower.CL
## 1                              Model 0.140    0.162    0.123
## 3                         interest_c 0.095    0.113    0.078
## 2  scale(interesfun1, scale = FALSE) 0.011    0.019    0.006
## 10                            female 0.002    0.006    0.000
## 11                          minority 0.002    0.006    0.000
## 4                             ch_who 0.001    0.005    0.000
## 8                           ch_other 0.001    0.003    0.000
## 6                             ch_mat 0.000    0.002    0.000
## 7                            ch_time 0.000    0.002    0.000
## 5                           ch_howdo 0.000    0.001    0.000
## 9                         ch_framing 0.000    0.001    0.000
MuMIn::r.squaredGLMM(M22)
##       R2m       R2c 
## 0.1403063 0.5143046
#plot(M22r)

All choices predicting negative affect

M33<-lmer(negaffect ~ scale(interesfun1, scale=FALSE) + 
            interest_c + 
            ch_who + 
            ch_howdo + 
            ch_mat + 
            ch_time + 
            ch_other + 
            ch_framing +
            female + 
            minority + 
            (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M33)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: negaffect ~ scale(interesfun1, scale = FALSE) + interest_c +  
##     ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing +  
##     female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 |  
##     beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 7648.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5645 -0.5472 -0.1640  0.3684  4.7130 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.01367  0.1169  
##  stud_ID     (Intercept) 0.19050  0.4365  
##  teacher_ID1 (Intercept) 0.02291  0.1514  
##  Residual                0.35603  0.5967  
## Number of obs: 3857, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                        5.221e-01  7.450e-02  3.300e+01   7.008
## scale(interesfun1, scale = FALSE) -6.732e-02  3.982e-02  2.250e+02  -1.691
## interest_c                        -7.473e-02  1.218e-02  3.637e+03  -6.137
## ch_who                            -3.938e-02  3.770e-02  3.120e+03  -1.044
## ch_howdo                           1.388e-02  3.111e-02  3.768e+03   0.446
## ch_mat                             3.008e-02  3.657e-02  3.779e+03   0.823
## ch_time                            6.585e-02  3.382e-02  3.790e+03   1.947
## ch_other                          -5.934e-02  3.299e-02  3.840e+03  -1.799
## ch_framing                        -5.923e-03  3.178e-02  3.826e+03  -0.186
## female                             1.865e-01  6.225e-02  2.170e+02   2.996
## minority                          -5.109e-02  6.665e-02  2.220e+02  -0.767
##                                   Pr(>|t|)    
## (Intercept)                       5.24e-08 ***
## scale(interesfun1, scale = FALSE)  0.09231 .  
## interest_c                        9.29e-10 ***
## ch_who                             0.29640    
## ch_howdo                           0.65549    
## ch_mat                             0.41074    
## ch_time                            0.05158 .  
## ch_other                           0.07213 .  
## ch_framing                         0.85213    
## female                             0.00305 ** 
## minority                           0.44418    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr ch_frm
## s(1,s=FALSE  0.005                                                        
## interest_c   0.016 -0.096                                                 
## ch_who      -0.032  0.002 -0.001                                          
## ch_howdo    -0.051 -0.003 -0.022 -0.109                                   
## ch_mat      -0.009 -0.018 -0.060 -0.133 -0.229                            
## ch_time     -0.047 -0.023 -0.006 -0.138 -0.148 -0.106                     
## ch_other    -0.082 -0.013 -0.032  0.007  0.030  0.042  0.024              
## ch_framing  -0.060 -0.025 -0.008 -0.063 -0.058 -0.053 -0.013  0.061       
## female      -0.361  0.100  0.002  0.006  0.000  0.001 -0.014 -0.025  0.011
## minority    -0.547 -0.053 -0.014  0.004 -0.002 -0.046  0.020  0.000 -0.029
##             female
## s(1,s=FALSE       
## interest_c        
## ch_who            
## ch_howdo          
## ch_mat            
## ch_time           
## ch_other          
## ch_framing        
## female            
## minority    -0.048
rand(M33)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID     972.88      1  <2e-16 ***
## teacher_ID1   7.24      1   0.007 ** 
## beep_id      25.30      1   5e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M33)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: negaffect ~ scale(interesfun1, scale = FALSE) + interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.023439
##       ICC (stud_ID): 0.326697
##   ICC (teacher_ID1): 0.039295
#sjPlot::sjp.int(M33, type = "eff")
M33r<-r2glmm::r2beta(M33, method = "nsj")
M33r
##                               Effect   Rsq upper.CL lower.CL
## 1                              Model 0.037    0.052    0.029
## 10                            female 0.014    0.023    0.008
## 3                         interest_c 0.009    0.016    0.004
## 2  scale(interesfun1, scale = FALSE) 0.005    0.010    0.001
## 11                          minority 0.001    0.004    0.000
## 8                           ch_other 0.001    0.004    0.000
## 7                            ch_time 0.001    0.004    0.000
## 4                             ch_who 0.000    0.002    0.000
## 6                             ch_mat 0.000    0.002    0.000
## 5                           ch_howdo 0.000    0.001    0.000
## 9                         ch_framing 0.000    0.001    0.000
MuMIn::r.squaredGLMM(M33)
##        R2m        R2c 
## 0.03741364 0.41227476
#plot(M33r)

All choices predicting learning

M44<-lmer(learning ~ scale(interesfun1, scale=FALSE) + 
            interest_c + 
            ch_who + 
            ch_howdo + 
            ch_mat + 
            ch_time + 
            ch_other + 
            ch_framing +
            female + 
            minority + 
            (1|stud_ID) + (1|teacher_ID1) + (1|beep_id), data = SciMo_All)
summary(M44)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: 
## learning ~ scale(interesfun1, scale = FALSE) + interest_c + ch_who +  
##     ch_howdo + ch_mat + ch_time + ch_other + ch_framing + female +  
##     minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
##    Data: SciMo_All
## 
## REML criterion at convergence: 9274.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6547 -0.6142  0.0361  0.6537  3.0528 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  beep_id     (Intercept) 0.03263  0.1806  
##  stud_ID     (Intercept) 0.11155  0.3340  
##  teacher_ID1 (Intercept) 0.01627  0.1275  
##  Residual                0.56604  0.7524  
## Number of obs: 3853, groups:  beep_id, 246; stud_ID, 231; teacher_ID1, 12
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value
## (Intercept)                          1.74583    0.06368   29.00000  27.417
## scale(interesfun1, scale = FALSE)    0.16421    0.03339  226.00000   4.917
## interest_c                           0.38976    0.01507 3674.00000  25.856
## ch_who                              -0.04324    0.04737 3430.00000  -0.913
## ch_howdo                             0.03288    0.03853 3796.00000   0.853
## ch_mat                               0.03229    0.04542 3805.00000   0.711
## ch_time                             -0.02581    0.04195 3833.00000  -0.615
## ch_other                             0.07041    0.04018 3450.00000   1.753
## ch_framing                           0.01364    0.03890 3637.00000   0.351
## female                               0.01201    0.05191  215.00000   0.231
## minority                            -0.13444    0.05560  219.00000  -2.418
##                                   Pr(>|t|)    
## (Intercept)                        < 2e-16 ***
## scale(interesfun1, scale = FALSE) 1.69e-06 ***
## interest_c                         < 2e-16 ***
## ch_who                              0.3614    
## ch_howdo                            0.3936    
## ch_mat                              0.4773    
## ch_time                             0.5384    
## ch_other                            0.0798 .  
## ch_framing                          0.7259    
## female                              0.8173    
## minority                            0.0164 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) s(1s=F intrs_ ch_who ch_hwd ch_mat ch_tim ch_thr ch_frm
## s(1,s=FALSE  0.005                                                        
## interest_c   0.027 -0.142                                                 
## ch_who      -0.049  0.003 -0.001                                          
## ch_howdo    -0.070 -0.001 -0.027 -0.113                                   
## ch_mat      -0.012 -0.028 -0.054 -0.134 -0.232                            
## ch_time     -0.068 -0.031 -0.010 -0.139 -0.160 -0.108                     
## ch_other    -0.118 -0.018 -0.040  0.012  0.029  0.040  0.024              
## ch_framing  -0.082 -0.034 -0.014 -0.057 -0.073 -0.061 -0.023  0.055       
## female      -0.349  0.108  0.004  0.008 -0.002  0.001 -0.020 -0.035  0.018
## minority    -0.528 -0.050 -0.025  0.007 -0.004 -0.065  0.032  0.001 -0.044
##             female
## s(1,s=FALSE       
## interest_c        
## ch_who            
## ch_howdo          
## ch_mat            
## ch_time           
## ch_other          
## ch_framing        
## female            
## minority    -0.050
rand(M44)
## Analysis of Random effects Table:
##             Chi.sq Chi.DF p.value    
## stud_ID     311.47      1  <2e-16 ***
## teacher_ID1   4.99      1    0.03 *  
## beep_id      52.71      1   4e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M44)
## 
## Linear mixed model
##  Family: gaussian (identity)
## Formula: learning ~ scale(interesfun1, scale = FALSE) + interest_c + ch_who + ch_howdo + ch_mat + ch_time + ch_other + ch_framing + female + minority + (1 | stud_ID) + (1 | teacher_ID1) + (1 | beep_id)
## 
##       ICC (beep_id): 0.044914
##       ICC (stud_ID): 0.153544
##   ICC (teacher_ID1): 0.022393
#sjPlot::sjp.int(M44, type = "eff")
M44r<-r2glmm::r2beta(M44, method = "nsj")
M44r
##                               Effect   Rsq upper.CL lower.CL
## 1                              Model 0.216    0.239    0.196
## 3                         interest_c 0.163    0.184    0.143
## 2  scale(interesfun1, scale = FALSE) 0.021    0.031    0.013
## 11                          minority 0.006    0.011    0.002
## 8                           ch_other 0.001    0.004    0.000
## 4                             ch_who 0.000    0.002    0.000
## 5                           ch_howdo 0.000    0.002    0.000
## 6                             ch_mat 0.000    0.002    0.000
## 7                            ch_time 0.000    0.002    0.000
## 10                            female 0.000    0.002    0.000
## 9                         ch_framing 0.000    0.001    0.000
MuMIn::r.squaredGLMM(M44)
##       R2m       R2c 
## 0.2156818 0.3888997
#plot(M44r)

Correlation Function

#correlation table function
corstarsl <- function(x) { 
  require(Hmisc) 
  x <- as.matrix(x) 
  R <- rcorr(x)$r 
  p <- rcorr(x)$P 
  
  ## define notions for significance levels; spacing is important.
  mystars <- ifelse(p < .001, "***", ifelse(p < .01, "** ", ifelse(p < .05, "*  ", "   ")))
  
  ## trunctuate the matrix that holds the correlations to two decimal
  R <- format(round(cbind(rep(-1.11, ncol(x)), R), 2))[,-1] 
  
  ## build a new matrix that includes the correlations with their apropriate stars 
  Rnew <- matrix(paste(R, mystars, sep=""), ncol=ncol(x)) 
  diag(Rnew) <- paste(diag(R), " ", sep="") 
  rownames(Rnew) <- colnames(x) 
  colnames(Rnew) <- paste(colnames(x), "", sep="") 
  
  ## remove upper triangle
  Rnew <- as.matrix(Rnew)
  Rnew[upper.tri(Rnew, diag = TRUE)] <- ""
  Rnew <- as.data.frame(Rnew) 
  
  ## remove last column and return the matrix (which is now a data frame)
  Rnew <- cbind(Rnew[1:length(Rnew)-1])
  return(Rnew) 
}

Correlations

Scimo_All_Corr <- select(SciMo_All, engagement_three, learning, posaffect, negaffect, interesfun1, interest, anychoice, ch_framing, ch_mat, ch_time, ch_who, ch_howdo, ch_other)
corstarsl(Scimo_All_Corr)
## Loading required package: Hmisc
## Warning: package 'Hmisc' was built under R version 3.4.3
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:sjstats':
## 
##     deff
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## The following objects are masked from 'package:base':
## 
##     format.pval, units
##                  engagement_three learning posaffect negaffect interesfun1
## engagement_three                                                          
## learning                  0.64***                                         
## posaffect                 0.44***  0.34***                                
## negaffect                -0.13*** -0.12***  -0.07***                      
## interesfun1               0.28***  0.23***   0.20***  -0.11***            
## interest                  0.59***  0.49***   0.39***  -0.12***     0.25***
## anychoice                 0.09***  0.05**    0.08***  -0.01        0.10***
## ch_framing                0.07***  0.02      0.03      0.00        0.09***
## ch_mat                    0.10***  0.04**    0.05**    0.00        0.10***
## ch_time                   0.08***  0.01     -0.01      0.03        0.09***
## ch_who                    0.02    -0.03      0.05**    0.02        0.05** 
## ch_howdo                  0.08***  0.04**    0.04*     0.02        0.06***
## ch_other                  0.01     0.03      0.09***  -0.01        0.03   
##                  interest anychoice ch_framing   ch_mat  ch_time   ch_who
## engagement_three                                                         
## learning                                                                 
## posaffect                                                                
## negaffect                                                                
## interesfun1                                                              
## interest                                                                 
## anychoice         0.09***                                                
## ch_framing        0.07***   0.43***                                      
## ch_mat            0.11***   0.37***    0.22***                           
## ch_time           0.04*     0.38***    0.16***  0.23***                  
## ch_who            0.02      0.33***    0.15***  0.26***  0.27***         
## ch_howdo          0.07***   0.46***    0.23***  0.38***  0.32***  0.27***
## ch_other          0.05**    0.40***   -0.05**  -0.04**  -0.04**  -0.03   
##                  ch_howdo
## engagement_three         
## learning                 
## posaffect                
## negaffect                
## interesfun1              
## interest                 
## anychoice                
## ch_framing               
## ch_mat                   
## ch_time                  
## ch_who                   
## ch_howdo                 
## ch_other         -0.06***
interest_corr <- select(SciMo_student_survey, interesfun1, notinterest1r)
corstarsl(interest_corr)
##               interesfun1
## interesfun1              
## notinterest1r     0.48***

reliability for interest

library(psy)
## 
## Attaching package: 'psy'
## The following object is masked from 'package:sjstats':
## 
##     icc
interest_reliability <- select(SciMo_student_survey, interesfun1, notinterest1r)
cronbach(interest_reliability)
## $sample.size
## [1] 231
## 
## $number.of.items
## [1] 2
## 
## $alpha
## [1] 0.635647

Descriptives

psych::describe(SciMo_esm$engagement_three)
##    vars    n mean  sd median trimmed  mad min max range  skew kurtosis
## X1    1 4106 1.64 0.8   1.67    1.67 0.99   0   3     3 -0.24    -0.58
##      se
## X1 0.01
psych::describe(SciMo_esm$posaffect)
##    vars    n mean   sd median trimmed  mad min max range skew kurtosis
## X1    1 4087 1.06 0.86      1    0.98 0.99   0   3     3 0.62    -0.58
##      se
## X1 0.01
psych::describe(SciMo_esm$negaffect)
##    vars    n mean   sd median trimmed  mad min max range skew kurtosis
## X1    1 4081 0.57 0.76   0.33    0.41 0.49   0   3     3 1.44     1.35
##      se
## X1 0.01
psych::describe(SciMo_esm$learning)
##    vars    n mean   sd median trimmed  mad min max range  skew kurtosis
## X1    1 4086 1.69 0.98      2    1.74 1.48   0   3     3 -0.27    -0.93
##      se
## X1 0.02
psych::describe(SciMo_esm$interest)
##    vars    n mean   sd median trimmed  mad min max range skew kurtosis
## X1    1 3986 1.23 0.97      1    1.16 1.48   0   3     3 0.27    -0.95
##      se
## X1 0.02
psych::describe(SciMo_esm$anychoice)
##    vars    n mean  sd median trimmed mad min max range  skew kurtosis   se
## X1    1 4136 0.55 0.5      1    0.56   0   0   1     1 -0.19    -1.96 0.01
psych::describe(SciMo_esm$ch_framing)
##    vars    n mean   sd median trimmed mad min max range skew kurtosis   se
## X1    1 4136 0.18 0.39      0    0.11   0   0   1     1 1.62     0.64 0.01
psych::describe(SciMo_esm$ch_mat)
##    vars    n mean   sd median trimmed mad min max range skew kurtosis   se
## X1    1 4136 0.14 0.35      0    0.05   0   0   1     1 2.07     2.29 0.01
psych::describe(SciMo_esm$ch_time)
##    vars    n mean   sd median trimmed mad min max range skew kurtosis   se
## X1    1 4136 0.15 0.36      0    0.06   0   0   1     1 1.96     1.83 0.01
psych::describe(SciMo_esm$ch_who)
##    vars    n mean   sd median trimmed mad min max range skew kurtosis se
## X1    1 4136 0.11 0.32      0    0.02   0   0   1     1 2.42     3.87  0
psych::describe(SciMo_esm$ch_howdo)
##    vars    n mean  sd median trimmed mad min max range skew kurtosis   se
## X1    1 4136  0.2 0.4      0    0.13   0   0   1     1 1.48      0.2 0.01
psych::describe(SciMo_esm$ch_other)
##    vars    n mean   sd median trimmed mad min max range skew kurtosis   se
## X1    1 4136 0.17 0.37      0    0.08   0   0   1     1  1.8     1.24 0.01
psych::describe(SciMo_student_survey$interesfun1)
##    vars   n mean   sd median trimmed mad min max range  skew kurtosis   se
## X1    1 232 2.67 0.81      3     2.7   0   1   4     3 -0.37    -0.29 0.05
psych::describe(scale(SciMo_student_survey$interesfun1, center=TRUE, scale=FALSE))
##    vars   n mean   sd median trimmed mad   min  max range  skew kurtosis
## X1    1 232    0 0.81   0.33    0.03   0 -1.67 1.33     3 -0.37    -0.29
##      se
## X1 0.05
table(SciMo_esm$ch_who)
## 
##    0    1 
## 3663  473
table(SciMo_esm$ch_mat)
## 
##    0    1 
## 3556  580
table(SciMo_esm$ch_time)
## 
##    0    1 
## 3515  621
table(SciMo_esm$ch_howdo)
## 
##    0    1 
## 3301  835
table(SciMo_esm$ch_other)
## 
##    0    1 
## 3452  684
table(SciMo_esm$ch_framing)
## 
##    0    1 
## 3372  764
table(SciMo_esm$ch_doing)
## 
##    0    1 
## 3779  357
table(SciMo_esm$ch_defin)
## 
##    0    1 
## 3774  362
table(SciMo_esm$ch_topic)
## 
##    0    1 
## 3903  233
table(SciMo_esm$ch_none)
## 
##    0    1 
## 2267 1869
table(SciMo_esm$anychoice)
## 
##    0    1 
## 1869 2267