Sandbox - 03

Background

This is a sandbox for exploring the data, in preparation for adding to the results section.

This document is organized around two sets of model specifications:

  1. Fit using the R package mclust
  2. Fit using the commerical software MPlus

Both are interfaced to through the tidyLPA package.

Models that are specified

mclust

For models fit using mclust, eight model specifications are tested, where all five refers to the variables for cognitive (learning), behavioral (hard working), and affective (enjoy), and challenge and competence, where three refers to just the three engagement measures. Note that the prior is to regularize the parameter estimates to be more less likely to be extreme (and therefore to be less likely to lead to convergence problems, but possibly less meaningful / interpretable).

  • All five variables w/ no prior
  • All five variables standardized w/ prior

MPlus

  • All five variables
  • All five variables standardized
library(tidyverse)
library(lmerTest)
library(lme4)
library(corrr)
library(jmRtools)
library(tidyLPA)
library(sjPlot)
esm <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-esm.csv")
pre_survey_data_processed <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-pre-survey.csv")
post_survey_data_partially_processed <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-post-survey.csv")
video <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-video.csv")
pqa <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-pqa.csv")
attendance <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-attendance.csv")
class_data <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-class-video.csv")
demographics <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-demographics.csv")
pm <- read_csv("/Volumes/SCHMIDTLAB/PSE/Data/STEM-IE/STEM-IE-program-match.csv")
# save.image("~/desktop/sandbox-01.Rdata")
load("~/desktop/sandbox-01.Rdata")
attendance <- rename(attendance, participant_ID = ParticipantID)
attendance <- mutate(attendance, prop_attend = DaysAttended / DaysScheduled, 
                     participant_ID = as.integer(participant_ID))
attendance <- select(attendance, participant_ID, prop_attend)

demographics <- filter(demographics, participant_ID!= 7187)
demographics <- left_join(demographics, attendance)

esm$overall_engagement <- jmRtools::composite_mean_maker(esm, hard_working, concentrating, enjoy, interest)
df <- left_join(esm, pre_survey_data_processed, by = "participant_ID") # df & post-survey
df <- left_join(df, video, by = c("program_ID", "response_date", "sociedad_class", "signal_number")) # df & video
df <- left_join(df, demographics, by = c("participant_ID", "program_ID")) # df and demographics
pqa <- mutate(pqa, 
              active = active_part_1 + active_part_2,
              ho_thinking = ho_thinking_1 + ho_thinking_2 + ho_thinking_3,
              belonging = belonging_1 + belonging_2,
              agency = agency_1 + agency_2 + agency_3 + agency_4,
              youth_development_overall = active_part_1 + active_part_2 + ho_thinking_1 + ho_thinking_2 + ho_thinking_3 + belonging_1 + belonging_2 + agency_1 + agency_2 + agency_3 + agency_4,
              making_observations = stem_sb_8,
              data_modeling = stem_sb_2 + stem_sb_3 + stem_sb_9,
              interpreting_communicating = stem_sb_6,
              generating_data = stem_sb_4,
              asking_questions = stem_sb_1,
              stem_sb = stem_sb_1 + stem_sb_2 + stem_sb_3 + stem_sb_4 + stem_sb_5 + stem_sb_6 + stem_sb_7 + stem_sb_8 + stem_sb_9)

# pqa <- rename(pqa, sixth_math_sociedad = sixth_math)
# pqa <- rename(pqa, seventh_math_sociedad = seventh_math)
# pqa <- rename(pqa, eighth_math_sociedad = eighth_math)
# pqa <- rename(pqa, dance_sociedad = dance)
# pqa <- rename(pqa, robotics_sociedad = robotics)

pqa$sociedad_class <- ifelse(pqa$eighth_math == 1, "8th Math",
                             ifelse(pqa$seventh_math == 1, "7th Math",
                                    ifelse(pqa$sixth_math == 1, "6th Math",
                                           ifelse(pqa$robotics == 1, "Robotics",
                                                  ifelse(pqa$dance == 1, "Dance", NA)))))

pqa <- rename(pqa, 
              program_ID = SiteIDNumeric,
              response_date = resp_date,
              signal_number = signal)

pqa$program_ID <- as.character(pqa$program_ID)

df <- left_join(df, pqa, by = c("response_date", "program_ID", "signal_number", "sociedad_class"))
df <- df %>% 
    mutate(youth_activity_three = case_when(
        youth_activity_rc == "Creating Product" ~ "Creating Product",
        youth_activity_rc == "Basic Skills Activity" ~ "Basic Skills Activity",
        TRUE ~ "Other"
    ))

df$youth_activity_three <- fct_relevel(df$youth_activity_three, 
                                       "Other")
# <!-- Cognitive engagement As you were signaled, were you learning anything or getting better at something? -->
# <!-- Behavioral engagement    As you were signaled, how hard were you working? -->
# <!-- Affective engagement As you were signaled, did you enjoy what you are doing? -->
# <!-- Perceived challenge  As you were signaled, how challenging was the main activity? -->
# <!-- Perceived competence As you were signaled, were you good at the main activity? -->

library(jmRtools)

df <- df %>% 
    mutate(dm_cog_eng = learning,
           dm_beh_eng = hard_working,
           dm_aff_eng = enjoy,
           dm_challenge = challenge,
           dm_competence = good_at) %>% 
    rename(ssb_predict = stem_sb_1,
           ssb_model = stem_sb_2 ,
           ssb_analyze = stem_sb_3,
           ssb_measure = stem_sb_4,
           ssb_tools = stem_sb_5,
           ssb_precision = stem_sb_6,
           ssb_vocabulary = stem_sb_7,
           ssb_classification = stem_sb_8,
           ssb_symbols = stem_sb_9) %>% 
    mutate(dm_ask = ssb_predict,
           dm_obs = ssb_classification,
           dm_gen = ifelse(ssb_measure == 1 | ssb_precision == 1, 1, 0),
           dm_mod = ifelse(ssb_model == 1 | ssb_analyze == 1, 1, 0),
           dm_com = ssb_symbols) %>% 
    mutate(ov_cog_eng = (important + future_goals) / 2,
           ov_beh_eng = (hard_working + concentrating) / 2,
           ov_aff_eng = (enjoy + interest) / 2)
out <- df %>% 
    group_by(program_ID) %>% 
    select(contains("ssb")) %>% 
    summarize_all(sum, na.rm = T)

out1 <- pqa %>% 
    select(contains("stem"), -sum_stem_sb, -stem_sb) %>% 
    summarize_all(sum, na.rm = T) / 236

names(out1) <- df %>% select(contains("ssb")) %>% names()

pqa_out <- pqa %>% 
    group_by(program_ID) %>% 
    select(contains("stem"), -sum_stem_sb, -stem_sb) %>% 
    summarize_all(sum, na.rm = T)

names(pqa_out) <- names(out)

1. Specific solutions

m <- create_profiles_mplus(df, dm_cog_eng, dm_beh_eng, dm_aff_eng, dm_challenge, dm_competence, n_profiles=6, model = 2, return_save_data = TRUE)
plot_profiles_mplus(m) + scale_fill_brewer("", palette="Set2", labels = c("Affective Engagement", "Behavioral Engagement", "Challenge", "Cognitive Engagement", "Competence")) + ylab("Z-score") 

cc <- df %>% select(dm_cog_eng:dm_competence) %>% complete.cases()
C <- m[[2]] %>% pull(C)
df_ss <- df[cc, ]
df_ss$profile <- C
d <- df_ss %>% select(contains("dm"), participant_ID, program_ID, beep_ID = beep_ID_new, profile)
d %>% psych::describe()
##                 vars    n   mean    sd median trimmed   mad min max range
## dm_cog_eng         1 2958   2.77  1.06      3    2.84  1.48   1   4     3
## dm_beh_eng         2 2958   2.86  1.04      3    2.95  1.48   1   4     3
## dm_aff_eng         3 2958   2.83  1.05      3    2.92  1.48   1   4     3
## dm_challenge       4 2958   2.27  1.12      2    2.21  1.48   1   4     3
## dm_competence      5 2958   3.00  0.95      3    3.11  1.48   1   4     3
## dm_ask             6 2787   0.42  0.49      0    0.40  0.00   0   1     1
## dm_obs             7 2787   0.28  0.45      0    0.23  0.00   0   1     1
## dm_gen             8 2787   0.44  0.50      0    0.43  0.00   0   1     1
## dm_mod             9 2787   0.37  0.48      0    0.34  0.00   0   1     1
## dm_com            10 2787   0.46  0.50      0    0.44  0.00   0   1     1
## participant_ID*   11 2958 103.28 60.07    108  103.81 78.58   1 203   202
## program_ID*       12 2958   6.01  2.75      6    6.08  2.97   1  10     9
## beep_ID*          13 2958 134.18 74.66    145  136.46 99.33   1 248   247
## profile           14 2958   3.51  1.40      4    3.52  1.48   1   6     5
##                  skew kurtosis   se
## dm_cog_eng      -0.35    -1.12 0.02
## dm_beh_eng      -0.46    -1.00 0.02
## dm_aff_eng      -0.43    -1.04 0.02
## dm_challenge     0.26    -1.31 0.02
## dm_competence   -0.61    -0.63 0.02
## dm_ask           0.33    -1.89 0.01
## dm_obs           0.96    -1.08 0.01
## dm_gen           0.23    -1.95 0.01
## dm_mod           0.53    -1.72 0.01
## dm_com           0.18    -1.97 0.01
## participant_ID* -0.09    -1.29 1.10
## program_ID*     -0.22    -1.09 0.05
## beep_ID*        -0.22    -1.22 1.37
## profile         -0.09    -0.74 0.03
d <- d %>% 
    mutate(
        profile_1 = ifelse(profile == 1, 1, 0),
        profile_2 = ifelse(profile == 2, 1, 0),
        profile_3 = ifelse(profile == 3, 1, 0),
        profile_4 = ifelse(profile == 4, 1, 0),
        profile_5 = ifelse(profile == 5, 1, 0),
        profile_6 = ifelse(profile == 6, 1, 0),
    )
m1 <- glmer(profile_1 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m1)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_1 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   1522.3   1546.2   -757.1   1514.3     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5736 -0.2586 -0.1349 -0.1167  4.7246 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.1908   0.4368  
##  participant_ID (Intercept) 3.1202   1.7664  
##  program_ID     (Intercept) 0.0000   0.0000  
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -3.4136     0.2146  -15.91   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(m1)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_1 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.028900
##   ICC (participant_ID): 0.472696
##       ICC (program_ID): 0.000000
m2 <- glmer(profile_2 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_2 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2386.9   2410.8  -1189.4   2378.9     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5352 -0.3864 -0.2402 -0.1620  4.0061 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev. 
##  beep_ID        (Intercept) 2.561e-01 5.060e-01
##  participant_ID (Intercept) 2.369e+00 1.539e+00
##  program_ID     (Intercept) 2.330e-10 1.527e-05
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.2629     0.1521  -14.88   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(m2)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_2 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.043293
##   ICC (participant_ID): 0.400490
##       ICC (program_ID): 0.000000
m3 <- glmer(profile_3 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m3)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_3 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2343.7   2367.6  -1167.8   2335.7     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.8161 -0.3957 -0.2389 -0.1668  4.3318 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.08281  0.2878  
##  participant_ID (Intercept) 2.48074  1.5750  
##  program_ID     (Intercept) 0.01829  0.1352  
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.2279     0.1578  -14.12   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(m3)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_3 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.014104
##   ICC (participant_ID): 0.422490
##       ICC (program_ID): 0.003115
m4 <- glmer(profile_4 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m4)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_4 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2957.3   2981.3  -1474.7   2949.3     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5065 -0.4958 -0.2452  0.4891  4.5159 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.3947   0.6282  
##  participant_ID (Intercept) 3.4287   1.8517  
##  program_ID     (Intercept) 0.5966   0.7724  
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -1.1087     0.3009  -3.684 0.000229 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(m4)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_4 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.051192
##   ICC (participant_ID): 0.444715
##       ICC (program_ID): 0.077386
m5 <- glmer(profile_5 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m5)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_5 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2187.7   2211.7  -1089.9   2179.7     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.1068 -0.3843 -0.2825 -0.2075  4.0392 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev. 
##  beep_ID        (Intercept) 2.532e-08 0.0001591
##  participant_ID (Intercept) 1.198e+00 1.0943746
##  program_ID     (Intercept) 6.477e-02 0.2545091
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.287565   0.000603   -3794   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## convergence code: 0
## Model failed to converge with max|grad| = 0.117255 (tol = 0.001, component 1)
## Model is nearly unidentifiable: very large eigenvalue
##  - Rescale variables?
sjstats::icc(m5)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_5 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.000000
##   ICC (participant_ID): 0.263088
##       ICC (program_ID): 0.014229
m6 <- glmer(profile_6 ~ 1 +
                (1 | participant_ID) +
                (1 | beep_ID) +
                (1 | program_ID),
            family = binomial(link = "logit"),
            data = d)

summary(m6)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## profile_6 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   1670.9   1694.9   -831.5   1662.9     2954 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.9902 -0.2918 -0.2155 -0.1719  4.6578 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.3107   0.5574  
##  participant_ID (Intercept) 1.1224   1.0595  
##  program_ID     (Intercept) 0.0000   0.0000  
## Number of obs: 2958, groups:  
## beep_ID, 248; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.9115     0.1476  -19.72   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(m6)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_6 ~ 1 + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.065790
##   ICC (participant_ID): 0.237654
##       ICC (program_ID): 0.000000
m4a <- glmer(profile_4 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m4a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_4 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2792.5   2845.9  -1387.3   2774.5     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7228 -0.5038 -0.2427  0.4676  4.3202 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.3227   0.5680  
##  participant_ID (Intercept) 3.5233   1.8771  
##  program_ID     (Intercept) 0.7143   0.8451  
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.14123    0.33344  -3.423  0.00062 ***
## dm_ask      -0.15678    0.16134  -0.972  0.33121    
## dm_obs      -0.36204    0.16496  -2.195  0.02818 *  
## dm_gen       0.33313    0.15337   2.172  0.02985 *  
## dm_mod       0.16141    0.16510   0.978  0.32826    
## dm_com       0.01383    0.15949   0.087  0.93092    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.060                            
## dm_obs -0.026 -0.256                     
## dm_gen -0.112 -0.105 -0.168              
## dm_mod -0.013 -0.232 -0.091 -0.175       
## dm_com -0.094 -0.161  0.011 -0.142 -0.344
sjstats::icc(m4a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_4 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.041102
##   ICC (participant_ID): 0.448826
##       ICC (program_ID): 0.090986
m1a <- glmer(profile_1 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m1a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_1 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   1453.1   1506.4   -717.5   1435.1     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5698 -0.2590 -0.1406 -0.1171  4.5335 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev.
##  beep_ID        (Intercept) 0.2073578 0.45537 
##  participant_ID (Intercept) 3.0627722 1.75008 
##  program_ID     (Intercept) 0.0008134 0.02852 
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -3.4369     0.2447 -14.046   <2e-16 ***
## dm_ask        0.2114     0.2077   1.018    0.309    
## dm_obs        0.2440     0.2063   1.183    0.237    
## dm_gen       -0.2277     0.1987  -1.146    0.252    
## dm_mod       -0.2992     0.2116  -1.414    0.157    
## dm_com        0.1895     0.2039   0.929    0.353    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.150                            
## dm_obs -0.134 -0.253                     
## dm_gen -0.115 -0.114 -0.189              
## dm_mod  0.008 -0.235 -0.079 -0.191       
## dm_com -0.197 -0.178  0.062 -0.174 -0.297
## convergence code: 0
## Model failed to converge with max|grad| = 0.156466 (tol = 0.001, component 1)
sjstats::icc(m1a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_1 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.031606
##   ICC (participant_ID): 0.466828
##       ICC (program_ID): 0.000124
m2a <- glmer(profile_2 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m2a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_2 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2242.7   2296.1  -1112.3   2224.7     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.2737 -0.3867 -0.2370 -0.1608  4.0763 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev. 
##  beep_ID        (Intercept) 1.922e-01 0.4384243
##  participant_ID (Intercept) 2.358e+00 1.5356592
##  program_ID     (Intercept) 8.858e-07 0.0009412
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.00606    0.16990 -11.807   <2e-16 ***
## dm_ask      -0.10443    0.16445  -0.635   0.5254    
## dm_obs      -0.01302    0.16770  -0.078   0.9381    
## dm_gen      -0.28237    0.15838  -1.783   0.0746 .  
## dm_mod      -0.04334    0.16836  -0.257   0.7968    
## dm_com      -0.19503    0.16362  -1.192   0.2333    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.122                            
## dm_obs -0.081 -0.265                     
## dm_gen -0.152 -0.085 -0.177              
## dm_mod -0.029 -0.205 -0.079 -0.202       
## dm_com -0.166 -0.192  0.052 -0.167 -0.312
## convergence code: 0
## Model failed to converge with max|grad| = 0.00440029 (tol = 0.001, component 1)
sjstats::icc(m2a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_2 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.032912
##   ICC (participant_ID): 0.403787
##       ICC (program_ID): 0.000000
m3a <- glmer(profile_3 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m3a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_3 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2216.6   2270.0  -1099.3   2198.6     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6509 -0.4027 -0.2318 -0.1635  4.3869 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.07580  0.2753  
##  participant_ID (Intercept) 2.48712  1.5771  
##  program_ID     (Intercept) 0.05465  0.2338  
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.34196    0.19194 -12.202   <2e-16 ***
## dm_ask      -0.10813    0.15618  -0.692    0.489    
## dm_obs       0.07836    0.15514   0.505    0.613    
## dm_gen       0.20437    0.14639   1.396    0.163    
## dm_mod      -0.11890    0.15641  -0.760    0.447    
## dm_com       0.18233    0.15310   1.191    0.234    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.074                            
## dm_obs -0.093 -0.273                     
## dm_gen -0.172 -0.121 -0.172              
## dm_mod -0.010 -0.232 -0.072 -0.183       
## dm_com -0.191 -0.175  0.050 -0.161 -0.319
## convergence code: 0
## Model failed to converge with max|grad| = 0.044158 (tol = 0.001, component 1)
sjstats::icc(m3a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_3 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.012832
##   ICC (participant_ID): 0.421014
##       ICC (program_ID): 0.009251
m4a <- glmer(profile_4 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m4a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_4 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2792.5   2845.9  -1387.3   2774.5     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7228 -0.5038 -0.2427  0.4676  4.3202 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.3227   0.5680  
##  participant_ID (Intercept) 3.5233   1.8771  
##  program_ID     (Intercept) 0.7143   0.8451  
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.14123    0.33344  -3.423  0.00062 ***
## dm_ask      -0.15678    0.16134  -0.972  0.33121    
## dm_obs      -0.36204    0.16496  -2.195  0.02818 *  
## dm_gen       0.33313    0.15337   2.172  0.02985 *  
## dm_mod       0.16141    0.16510   0.978  0.32826    
## dm_com       0.01383    0.15949   0.087  0.93092    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.060                            
## dm_obs -0.026 -0.256                     
## dm_gen -0.112 -0.105 -0.168              
## dm_mod -0.013 -0.232 -0.091 -0.175       
## dm_com -0.094 -0.161  0.011 -0.142 -0.344
sjstats::icc(m4a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_4 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.041102
##   ICC (participant_ID): 0.448826
##       ICC (program_ID): 0.090986
m5a <- glmer(profile_5 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m5a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_5 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   2043.2   2096.6  -1012.6   2025.2     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.2554 -0.3758 -0.2753 -0.2045  4.2732 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev. 
##  beep_ID        (Intercept) 3.790e-08 0.0001947
##  participant_ID (Intercept) 1.227e+00 1.1078815
##  program_ID     (Intercept) 6.467e-02 0.2543001
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.51236    0.16886 -14.878   <2e-16 ***
## dm_ask       0.18233    0.14858   1.227    0.220    
## dm_obs       0.14153    0.14887   0.951    0.342    
## dm_gen      -0.07064    0.14435  -0.489    0.625    
## dm_mod       0.04861    0.15098   0.322    0.747    
## dm_com       0.19676    0.15000   1.312    0.190    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.144                            
## dm_obs -0.087 -0.266                     
## dm_gen -0.155 -0.094 -0.185              
## dm_mod -0.027 -0.206 -0.096 -0.189       
## dm_com -0.198 -0.176  0.054 -0.192 -0.323
## convergence code: 0
## Model failed to converge with max|grad| = 0.00223344 (tol = 0.001, component 1)
sjstats::icc(m5a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_5 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.000000
##   ICC (participant_ID): 0.267878
##       ICC (program_ID): 0.014114
m6a <- glmer(profile_6 ~ 1 +
                 dm_ask + dm_obs + dm_gen + dm_mod + dm_com +
                 (1 | participant_ID) +
                 (1 | beep_ID) +
                 (1 | program_ID),
             family = binomial(link = "logit"),
             data = d)

summary(m6a)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: profile_6 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com +  
##     (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
##    Data: d
## 
##      AIC      BIC   logLik deviance df.resid 
##   1604.2   1657.6   -793.1   1586.2     2778 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.9962 -0.2931 -0.2168 -0.1716  4.5537 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  beep_ID        (Intercept) 0.3116   0.5582  
##  participant_ID (Intercept) 1.1523   1.0735  
##  program_ID     (Intercept) 0.0000   0.0000  
## Number of obs: 2787, groups:  
## beep_ID, 236; participant_ID, 203; program_ID, 9
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.85922    0.18314 -15.612   <2e-16 ***
## dm_ask       0.12106    0.20565   0.589   0.5561    
## dm_obs       0.08188    0.20702   0.396   0.6925    
## dm_gen      -0.11704    0.19314  -0.606   0.5445    
## dm_mod       0.25695    0.21133   1.216   0.2240    
## dm_com      -0.36072    0.20336  -1.774   0.0761 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##        (Intr) dm_ask dm_obs dm_gen dm_mod
## dm_ask -0.176                            
## dm_obs -0.107 -0.288                     
## dm_gen -0.184 -0.088 -0.184              
## dm_mod -0.089 -0.251 -0.045 -0.191       
## dm_com -0.138 -0.168 -0.004 -0.152 -0.336
sjstats::icc(m6a)
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: profile_6 ~ 1 + dm_ask + dm_obs + dm_gen + dm_mod + dm_com + (1 | participant_ID) + (1 | beep_ID) + (1 | program_ID)
## 
##          ICC (beep_ID): 0.065548
##   ICC (participant_ID): 0.242399
##       ICC (program_ID): 0.000000