1. Loading, setting up

2. Null models (ready)

3. Models for youth activity (ready)

video %>% 
    left_join(pm) %>% 
    count(program_name, youth_activity_rc) %>% 
    filter(!is.na(youth_activity_rc)) %>% 
    spread(youth_activity_rc, n, fill = 0) %>% 
    gather(youth_activity_rc, frequency, -program_name) %>% 
    group_by(program_name) %>% 
    mutate(frequency_prop = frequency / sum(frequency)) %>% 
    ggplot(aes(x = reorder(youth_activity_rc, frequency_prop), y = frequency_prop)) +
    facet_wrap( ~ program_name) +
    geom_col() +
    theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
    ylab("Frequency Proportion") +
    xlab(NULL) +
    ggtitle("Frequency of Youth Activity (Recoded) Codes by Program")

df$youth_activity_rc_fac <- as.factor(df$youth_activity_rc)
dc <- as.tibble(psych::dummy.code(df$youth_activity_rc_fac))
df_ss <- bind_cols(df, dc)

df_ss %>% 
    select(challenge, relevance, learning, positive_affect, 
           `Not Focused`, `Basic Skills Activity`, `Creating Product`, 
           `Field Trip Speaker`, `Lab Activity`, `Program Staff Led`) %>% 
    correlate() %>% 
    shave() %>% 
    fashion()
##                  rowname challenge relevance learning positive_affect
## 1              challenge                                             
## 2              relevance       .39                                   
## 3               learning       .30       .65                         
## 4        positive_affect       .27       .52      .48                
## 5            Not Focused      -.02      -.06     -.05             .04
## 6  Basic Skills Activity      -.01      -.01      .04            -.06
## 7       Creating Product       .12       .08      .04             .05
## 8     Field Trip Speaker      -.04       .01     -.02             .02
## 9           Lab Activity       .00      -.03      .01             .02
## 10     Program Staff Led      -.06       .01     -.00            -.07
##    Not.Focused Basic.Skills.Activity Creating.Product Field.Trip.Speaker
## 1                                                                       
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6         -.35                                                          
## 7         -.33                  -.25                                    
## 8         -.15                  -.11             -.11                   
## 9         -.14                  -.11             -.10               -.05
## 10        -.27                  -.21             -.20               -.09
##    Lab.Activity Program.Staff.Led
## 1                                
## 2                                
## 3                                
## 4                                
## 5                                
## 6                                
## 7                                
## 8                                
## 9                                
## 10         -.09
m1i <- lmer(challenge ~ 1 + 
                youth_activity_rc +
                (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
            data = df)

sjPlot::sjt.lmer(m1i, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    challenge
    B std. Error p
Fixed Parts
(Intercept)   2.19 0.09 <.001
youth_activity_rc (Basic Skills Activity)   0.10 0.06 .117
youth_activity_rc (Creating Product)   0.37 0.06 <.001
youth_activity_rc (Field Trip Speaker)   -0.08 0.13 .550
youth_activity_rc (Lab Activity)   0.20 0.12 .102
youth_activity_rc (Program Staff Led)   -0.10 0.07 .173
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.045
ICCparticipant_ID   0.385
ICCprogram_ID   0.034
Observations   2818
R2 / Ω02   .529 / .522
m1ii <- lmer(relevance ~ 1 + 
                 youth_activity_rc +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m1ii, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    relevance
    B std. Error p
Fixed Parts
(Intercept)   2.46 0.07 <.001
youth_activity_rc (Basic Skills Activity)   0.15 0.04 <.001
youth_activity_rc (Creating Product)   0.23 0.04 <.001
youth_activity_rc (Field Trip Speaker)   0.29 0.07 <.001
youth_activity_rc (Lab Activity)   0.11 0.07 .144
youth_activity_rc (Program Staff Led)   0.15 0.04 <.001
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.007
ICCparticipant_ID   0.523
ICCprogram_ID   0.016
Observations   2818
R2 / Ω02   .586 / .583
m1iii <- lmer(learning ~ 1 + 
                  youth_activity_rc +
                  (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
              data = df)

sjPlot::sjt.lmer(m1iii, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    learning
    B std. Error p
Fixed Parts
(Intercept)   2.68 0.06 <.001
youth_activity_rc (Basic Skills Activity)   0.22 0.05 <.001
youth_activity_rc (Creating Product)   0.14 0.05 .009
youth_activity_rc (Field Trip Speaker)   0.10 0.10 .312
youth_activity_rc (Lab Activity)   0.15 0.10 .111
youth_activity_rc (Program Staff Led)   0.07 0.06 .218
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.011
ICCparticipant_ID   0.357
ICCprogram_ID   0.002
Observations   2817
R2 / Ω02   .428 / .421
df$positive_affect <- jmRtools::composite_mean_maker(df,
                                                     happy, excited)

m1iv <- lmer(positive_affect ~ 1 + 
                 youth_activity_rc +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m1iv, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    positive_affect
    B std. Error p
Fixed Parts
(Intercept)   2.70 0.12 <.001
youth_activity_rc (Basic Skills Activity)   0.03 0.05 .532
youth_activity_rc (Creating Product)   0.01 0.05 .802
youth_activity_rc (Field Trip Speaker)   0.01 0.10 .926
youth_activity_rc (Lab Activity)   0.07 0.10 .510
youth_activity_rc (Program Staff Led)   -0.05 0.06 .380
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.023
ICCparticipant_ID   0.421
ICCprogram_ID   0.091
Observations   2818
R2 / Ω02   .580 / .576

4. CLASS models (not ready)

df %>% 
    select(CLASS_EmotionalSupportEncouragement, CLASS_InstructionalSupport, CLASS_STEMConceptualDevelopment, CLASS_ActivityLeaderEnthusiasm, CLASS_Autonomy,
           challenge, relevance, learning, positive_affect) %>%  
    correlate() %>% 
    shave() %>% 
    fashion()
##                               rowname CLASS_EmotionalSupportEncouragement
## 1 CLASS_EmotionalSupportEncouragement                                    
## 2          CLASS_InstructionalSupport                                 .39
## 3     CLASS_STEMConceptualDevelopment                                 .28
## 4      CLASS_ActivityLeaderEnthusiasm                                 .63
## 5                      CLASS_Autonomy                                 .29
## 6                           challenge                                 .03
## 7                           relevance                                -.01
## 8                            learning                                 .00
## 9                     positive_affect                                 .01
##   CLASS_InstructionalSupport CLASS_STEMConceptualDevelopment
## 1                                                           
## 2                                                           
## 3                        .89                                
## 4                        .77                             .63
## 5                        .50                             .51
## 6                        .06                             .04
## 7                        .05                             .04
## 8                        .07                             .07
## 9                        .06                             .05
##   CLASS_ActivityLeaderEnthusiasm CLASS_Autonomy challenge relevance
## 1                                                                  
## 2                                                                  
## 3                                                                  
## 4                                                                  
## 5                            .52                                   
## 6                            .07            .06                    
## 7                            .04            .01       .39          
## 8                            .05            .02       .30       .65
## 9                            .09            .02       .27       .52
##   learning positive_affect
## 1                         
## 2                         
## 3                         
## 4                         
## 5                         
## 6                         
## 7                         
## 8                         
## 9      .48
m1v <- lmer(relevance ~ 1 + 
                # CLASS_EmotionalSupportEncouragement +
                # CLASS_InstructionalSupport +
                # CLASS_STEMConceptualDevelopment +
                # CLASS_ActivityLeaderEnthusiasm +
                CLASS_Autonomy +
                (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
            data = df)

sjPlot::sjt.lmer(m1v, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    relevance
    B std. Error p
Fixed Parts
(Intercept)   2.48 0.07 <.001
CLASS_Autonomy   0.03 0.01 .012
Random Parts
Nbeep_ID_new   236
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.013
ICCparticipant_ID   0.518
ICCprogram_ID   0.012
Observations   2800
R2 / Ω02   .588 / .585
m1vi <- lmer(challenge ~ 1 +
                 # CLASS_EmotionalSupportEncouragement +
                 #CLASS_InstructionalSupport +
                 # CLASS_STEMConceptualDevelopment +
                 #CLASS_ActivityLeaderEnthusiasm +
                 CLASS_Autonomy +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m1vi, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    challenge
    B std. Error p
Fixed Parts
(Intercept)   2.01 0.11 <.001
CLASS_Autonomy   0.08 0.02 <.001
Random Parts
Nbeep_ID_new   236
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.053
ICCparticipant_ID   0.375
ICCprogram_ID   0.043
Observations   2800
R2 / Ω02   .531 / .523
m1viii <- lmer(learning ~ 1 +
                   # CLASS_EmotionalSupportEncouragement +
                   #CLASS_InstructionalSupport +
                   # CLASS_STEMConceptualDevelopment +
                   #CLASS_ActivityLeaderEnthusiasm +
                   CLASS_Autonomy +
                   (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
               data = df)

sjPlot::sjt.lmer(m1viii, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    learning
    B std. Error p
Fixed Parts
(Intercept)   2.68 0.07 <.001
CLASS_Autonomy   0.03 0.01 .045
Random Parts
Nbeep_ID_new   236
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.014
ICCparticipant_ID   0.354
ICCprogram_ID   0.000
Observations   2799
R2 / Ω02   .428 / .421
m1viv <- lmer(positive_affect ~ 1 +
                  # CLASS_EmotionalSupportEncouragement +
                  #CLASS_InstructionalSupport +
                  # CLASS_STEMConceptualDevelopment +
                  #CLASS_ActivityLeaderEnthusiasm +
                  CLASS_Autonomy +
                  (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
              data = df)

sjPlot::sjt.lmer(m1viv, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    positive_affect
    B std. Error p
Fixed Parts
(Intercept)   2.59 0.13 <.001
CLASS_Autonomy   0.03 0.01 .021
Random Parts
Nbeep_ID_new   236
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.022
ICCparticipant_ID   0.424
ICCprogram_ID   0.093
Observations   2800
R2 / Ω02   .583 / .580

5. Pre-survey measures (ready)

df %>% 
    select(overall_pre_competence_beliefs, overall_pre_interest, overall_pre_utility_value,
           challenge, relevance, learning, positive_affect) %>%  
    correlate() %>% 
    shave() %>% 
    fashion()
##                          rowname overall_pre_competence_beliefs
## 1 overall_pre_competence_beliefs                               
## 2           overall_pre_interest                            .73
## 3      overall_pre_utility_value                            .68
## 4                      challenge                           -.12
## 5                      relevance                            .03
## 6                       learning                            .09
## 7                positive_affect                            .08
##   overall_pre_interest overall_pre_utility_value challenge relevance
## 1                                                                   
## 2                                                                   
## 3                  .65                                              
## 4                 -.00                      -.04                    
## 5                  .09                       .08       .39          
## 6                  .08                       .07       .30       .65
## 7                  .20                       .07       .27       .52
##   learning positive_affect
## 1                         
## 2                         
## 3                         
## 4                         
## 5                         
## 6                         
## 7      .48
m2i <- lmer(challenge ~ 1 + 
                overall_pre_competence_beliefs +
                overall_pre_interest +
                #overall_pre_utility_value +
                classroom_versus_field_enrichment +
                #youth_activity_rc +
                (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
            data = df)

sjPlot::sjt.lmer(m2i, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    challenge
    B std. Error p
Fixed Parts
(Intercept)   2.42 0.25 <.001
overall_pre_competence_beliefs   -0.30 0.11 .005
overall_pre_interest   0.23 0.10 .024
classroom_versus_field_enrichment   0.15 0.06 .019
Random Parts
Nbeep_ID_new   238
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.064
ICCparticipant_ID   0.376
ICCprogram_ID   0.034
Observations   2622
R2 / Ω02   .535 / .527
m2ib <- lmer(challenge ~ 1 +
                 overall_pre_competence_beliefs +
                 overall_pre_interest +
                 #overall_pre_utility_value +
                 classroom_versus_field_enrichment +
                 youth_activity_rc +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m2ib, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    challenge
    B std. Error p
Fixed Parts
(Intercept)   2.43 0.24 <.001
overall_pre_competence_beliefs   -0.30 0.11 .005
overall_pre_interest   0.22 0.10 .033
classroom_versus_field_enrichment   0.05 0.06 .457
youth_activity_rc (Basic Skills Activity)   0.10 0.07 .142
youth_activity_rc (Creating Product)   0.34 0.07 <.001
youth_activity_rc (Field Trip Speaker)   -0.08 0.14 .571
youth_activity_rc (Lab Activity)   0.17 0.13 .201
youth_activity_rc (Program Staff Led)   -0.13 0.08 .099
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.049
ICCparticipant_ID   0.387
ICCprogram_ID   0.027
Observations   2590
R2 / Ω02   .531 / .524
m2ii <- lmer(relevance ~ 1 + 
                 overall_pre_competence_beliefs +
                 overall_pre_interest +
                 #overall_pre_utility_value +
                 # youth_activity_rc +
                 classroom_versus_field_enrichment +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m2ii, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    relevance
    B std. Error p
Fixed Parts
(Intercept)   2.37 0.22 <.001
overall_pre_competence_beliefs   -0.08 0.10 .446
overall_pre_interest   0.16 0.10 .102
classroom_versus_field_enrichment   -0.04 0.04 .293
Random Parts
Nbeep_ID_new   238
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.017
ICCparticipant_ID   0.526
ICCprogram_ID   0.008
Observations   2622
R2 / Ω02   .595 / .592
m2iib <- lmer(relevance ~ 1 +
                  #overall_pre_competence_beliefs +
                  overall_pre_interest +
                  #overall_pre_utility_value +
                  youth_activity_rc +
                  classroom_versus_field_enrichment +
                  (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
              data = df)

sjPlot::sjt.lmer(m2iib, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    relevance
    B std. Error p
Fixed Parts
(Intercept)   2.21 0.21 <.001
overall_pre_interest   0.11 0.06 .101
youth_activity_rc (Basic Skills Activity)   0.13 0.04 .001
youth_activity_rc (Creating Product)   0.23 0.04 <.001
youth_activity_rc (Field Trip Speaker)   0.23 0.08 .003
youth_activity_rc (Lab Activity)   0.09 0.08 .235
youth_activity_rc (Program Staff Led)   0.15 0.05 .001
classroom_versus_field_enrichment   -0.08 0.04 .051
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.009
ICCparticipant_ID   0.527
ICCprogram_ID   0.017
Observations   2590
R2 / Ω02   .593 / .590
m2iii <- lmer(learning ~ 1 + 
                  overall_pre_competence_beliefs +
                  overall_pre_interest +
                  #overall_pre_utility_value +
                  classroom_versus_field_enrichment +
                  #youth_activity_rc +
                  (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
              data = df)

sjPlot::sjt.lmer(m2iii, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    learning
    B std. Error p
Fixed Parts
(Intercept)   2.47 0.20 <.001
overall_pre_competence_beliefs   0.03 0.09 .724
overall_pre_interest   0.06 0.09 .466
classroom_versus_field_enrichment   0.01 0.05 .751
Random Parts
Nbeep_ID_new   238
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.014
ICCparticipant_ID   0.352
ICCprogram_ID   0.000
Observations   2621
R2 / Ω02   .420 / .413
m2iiib <- lmer(learning ~ 1 + 
                   overall_pre_competence_beliefs +
                   overall_pre_interest +
                   #overall_pre_utility_value +
                   classroom_versus_field_enrichment +
                   youth_activity_rc +
                   (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
               data = df)

sjPlot::sjt.lmer(m2iiib, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    learning
    B std. Error p
Fixed Parts
(Intercept)   2.41 0.20 <.001
overall_pre_competence_beliefs   0.02 0.09 .836
overall_pre_interest   0.07 0.09 .448
classroom_versus_field_enrichment   0.01 0.05 .799
youth_activity_rc (Basic Skills Activity)   0.22 0.05 <.001
youth_activity_rc (Creating Product)   0.12 0.06 .036
youth_activity_rc (Field Trip Speaker)   0.08 0.10 .417
youth_activity_rc (Lab Activity)   0.19 0.10 .053
youth_activity_rc (Program Staff Led)   0.07 0.06 .245
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.010
ICCparticipant_ID   0.358
ICCprogram_ID   0.000
Observations   2589
R2 / Ω02   .420 / .414
df$positive_affect <- jmRtools::composite_mean_maker(df, happy, excited)

m2iv <- lmer(positive_affect ~ 
                 overall_pre_competence_beliefs +
                 overall_pre_interest +
                 #overall_pre_utility_value +
                 classroom_versus_field_enrichment +
                 # youth_activity_rc +
                 (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
             data = df)

sjPlot::sjt.lmer(m2iv, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    positive_affect
    B std. Error p
Fixed Parts
(Intercept)   2.17 0.26 <.001
overall_pre_competence_beliefs   -0.05 0.11 .683
overall_pre_interest   0.23 0.11 .031
classroom_versus_field_enrichment   -0.05 0.05 .273
Random Parts
Nbeep_ID_new   238
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.029
ICCparticipant_ID   0.443
ICCprogram_ID   0.061
Observations   2622
R2 / Ω02   .586 / .582
m2ivb <- lmer(positive_affect ~ 
                  overall_pre_competence_beliefs +
                  overall_pre_interest +
                  #overall_pre_utility_value +
                  classroom_versus_field_enrichment +
                  youth_activity_rc +
                  (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
              data = df)

sjPlot::sjt.lmer(m2ivb, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    positive_affect
    B std. Error p
Fixed Parts
(Intercept)   2.20 0.26 <.001
overall_pre_competence_beliefs   -0.05 0.11 .657
overall_pre_interest   0.23 0.11 .031
classroom_versus_field_enrichment   -0.06 0.05 .253
youth_activity_rc (Basic Skills Activity)   0.00 0.06 .977
youth_activity_rc (Creating Product)   0.01 0.06 .824
youth_activity_rc (Field Trip Speaker)   -0.03 0.11 .768
youth_activity_rc (Lab Activity)   0.07 0.11 .530
youth_activity_rc (Program Staff Led)   -0.07 0.07 .266
Random Parts
Nbeep_ID_new   235
Nparticipant_ID   181
Nprogram_ID   9
ICCbeep_ID_new   0.030
ICCparticipant_ID   0.441
ICCprogram_ID   0.058
Observations   2590
R2 / Ω02   .585 / .581

6. Situational experiences (ready)

df$overall_engagement <- jmRtools::composite_mean_maker(df, hard_working, concentrating, enjoy)

df %>% 
    select(overall_engagement, interest, challenge, relevance, learning, positive_affect) %>%  
    correlate() %>% 
    shave() %>% 
    fashion()
##              rowname overall_engagement interest challenge relevance
## 1 overall_engagement                                                
## 2           interest                .69                             
## 3          challenge                .31      .28                    
## 4          relevance                .65      .61       .39          
## 5           learning                .68      .56       .30       .65
## 6    positive_affect                .65      .56       .27       .52
##   learning positive_affect
## 1                         
## 2                         
## 3                         
## 4                         
## 5                         
## 6      .48
m3i <- lmer(interest ~ 1 +
                challenge + relevance + learning + positive_affect +
                (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
            data = df)

sjPlot::sjt.lmer(m3i, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    interest
    B std. Error p
Fixed Parts
(Intercept)   0.65 0.07 <.001
challenge   0.02 0.01 .141
relevance   0.36 0.02 <.001
learning   0.17 0.02 <.001
positive_affect   0.28 0.02 <.001
Random Parts
Nbeep_ID_new   248
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.033
ICCparticipant_ID   0.098
ICCprogram_ID   0.016
Observations   2969
R2 / Ω02   .583 / .582
m3v <- lmer(overall_engagement ~ 1 + 
                challenge + relevance + learning + positive_affect +
                (1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
            data = df)

sjPlot::sjt.lmer(m3v, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
    overall_engagement
    B std. Error p
Fixed Parts
(Intercept)   0.70 0.05 <.001
challenge   0.03 0.01 <.001
relevance   0.23 0.02 <.001
learning   0.27 0.01 <.001
positive_affect   0.28 0.01 <.001
Random Parts
Nbeep_ID_new   248
Nparticipant_ID   203
Nprogram_ID   9
ICCbeep_ID_new   0.028
ICCparticipant_ID   0.203
ICCprogram_ID   0.000
Observations   2969
R2 / Ω02   .734 / .733

7. Outcomes (not ready)

participant_df <-df %>% 
    select(participant_ID, challenge, relevance, learning, positive_affect) %>% 
    group_by(participant_ID) %>% 
    mutate_at(vars(challenge, relevance, learning, positive_affect), funs(mean, sd)) %>%
    select(participant_ID, contains("mean"), contains("sd")) %>% 
    distinct()

df_ss <- left_join(df, participant_df)
## Joining, by = "participant_ID"
df_ss <- select(df_ss, 
                participant_ID, program_ID,
                challenge_mean, relevance_mean, learning_mean, positive_affect_mean,
                challenge_sd, relevance_sd, learning_sd, positive_affect_sd,
                overall_post_interest, overall_pre_interest,
                future_goals)

df_ss <- mutate(df_ss,
                challenge_sd = abs(challenge_sd),
                relevance_sd = abs(relevance_sd),
                learning_sd = abs(learning_sd),
                positive_affect_sd = abs(positive_affect_sd))

df_ss <- distinct(df_ss)

m4ia <- lmer(overall_post_interest ~ 1 + 
                 challenge_mean +
                 learning_mean + 
                 relevance_mean + 
                 positive_affect_mean + 
                 overall_pre_interest +
                 (1|program_ID),
             data = df_ss)

sjPlot::sjt.lmer(m4ia, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
## Computing p-values via Wald-statistics approximation (treating t as Wald z).
    overall_post_interest
    B std. Error p
Fixed Parts
(Intercept)   0.73 0.24 .002
challenge_mean   -0.13 0.06 .025
learning_mean   0.46 0.11 <.001
relevance_mean   -0.22 0.12 .064
positive_affect_mean   0.17 0.07 .014
overall_pre_interest   0.47 0.05 <.001
Random Parts
Nprogram_ID   9
ICCprogram_ID   0.114
Observations   425
R2 / Ω02   .472 / .472
m4ib <- lmer(overall_post_interest ~ 1 + 
                 challenge_mean + challenge_sd +
                 learning_mean + learning_sd +
                 relevance_mean + relevance_sd +
                 positive_affect_mean + positive_affect_sd +
                 overall_pre_interest +
                 (1|program_ID),
             data = df_ss)

sjPlot::sjt.lmer(m4ib, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
## Computing p-values via Wald-statistics approximation (treating t as Wald z).
    overall_post_interest
    B std. Error p
Fixed Parts
(Intercept)   0.69 0.27 .011
challenge_mean   -0.07 0.06 .275
challenge_sd   -0.50 0.13 <.001
learning_mean   0.51 0.11 <.001
learning_sd   0.05 0.13 .701
relevance_mean   -0.25 0.12 .037
relevance_sd   0.31 0.18 .087
positive_affect_mean   0.16 0.07 .022
positive_affect_sd   0.07 0.13 .570
overall_pre_interest   0.47 0.05 <.001
Random Parts
Nprogram_ID   9
ICCprogram_ID   0.110
Observations   425
R2 / Ω02   .492 / .492
m4iia <- lmer(future_goals ~ 1 + 
                  challenge_mean + 
                  learning_mean + 
                  relevance_mean +
                  positive_affect_mean + 
                  overall_pre_interest +
                  (1|program_ID),
              data = df_ss)

sjPlot::sjt.lmer(m4iia, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
## Computing p-values via Wald-statistics approximation (treating t as Wald z).
    future_goals
    B std. Error p
Fixed Parts
(Intercept)   1.27 0.27 <.001
challenge_mean   0.07 0.08 .351
learning_mean   -0.15 0.15 .302
relevance_mean   0.62 0.15 <.001
positive_affect_mean   -0.05 0.08 .556
overall_pre_interest   -0.00 0.05 .941
Random Parts
Nprogram_ID   9
ICCprogram_ID   0.000
Observations   529
R2 / Ω02   .092 / .092
m4iib <- lmer(future_goals ~ 1 + 
                 challenge_mean + challenge_sd +
                 learning_mean + learning_sd +
                 relevance_mean + relevance_sd +
                 positive_affect_mean + positive_affect_sd +
                 overall_pre_interest +
                 (1|program_ID),
             data = df_ss)

sjPlot::sjt.lmer(m4iib, p.kr = F, show.re.var = F, show.ci = F, show.se = T)
## Computing p-values via Wald-statistics approximation (treating t as Wald z).
    future_goals
    B std. Error p
Fixed Parts
(Intercept)   1.29 0.33 <.001
challenge_mean   0.06 0.08 .443
challenge_sd   -0.09 0.16 .582
learning_mean   -0.13 0.15 .408
learning_sd   0.06 0.18 .753
relevance_mean   0.61 0.15 <.001
relevance_sd   -0.15 0.25 .559
positive_affect_mean   -0.04 0.08 .624
positive_affect_sd   0.08 0.17 .632
overall_pre_interest   -0.01 0.05 .818
Random Parts
Nprogram_ID   9
ICCprogram_ID   0.000
Observations   528
R2 / Ω02   .091 / .091