library(tidyverse)
library(lme4)
library(corrr)
library(jmRtools)
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")
load("~/Desktop/all-data.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)
# 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")
df <- df %>%
mutate(ho_thinking_dummy = ifelse(sum_ho_thinking > 0, 1, 0),
agency_dummy = ifelse(sum_agency > 0, 1, 0),
active_dummy = ifelse(sum_ap > 0, 1, 0),
belonging_dummy = ifelse(sum_belonging > 0, 1, 0),
stem_sb_dummy = ifelse(sum_stem_sb > 0, 1, 0))
df %>%
select(sum_agency, sum_stem_sb, overall_pre_interest) %>%
correlate() %>%
shave() %>%
fashion() %>%
knitr::kable()
rowname | sum_agency | sum_stem_sb | overall_pre_interest |
---|---|---|---|
sum_agency | |||
sum_stem_sb | .39 | ||
overall_pre_interest | .08 | .02 |
df$gender <- as.factor(df$gender)
m <- lmer(challenge ~
youth_activity_three +
agency_dummy +
stem_sb_dummy +
overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | challenge | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.98 | 0.24 | <.001 |
youth_activity_three (Basic Skills Activity) | Â | 0.13 | 0.06 | .034 |
youth_activity_three (Creating Product) | Â | 0.33 | 0.07 | <.001 |
agency_dummy | Â | 0.08 | 0.06 | .206 |
stem_sb_dummy | Â | 0.02 | 0.07 | .795 |
overall_pre_interest | Â | 0.01 | 0.07 | .936 |
gender (M) | Â | 0.25 | 0.11 | .027 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.049 | ||
ICCparticipant_ID | Â | 0.379 | ||
ICCprogram_ID | Â | 0.042 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .530 / .523 |
m <- lmer(challenge ~
youth_activity_three*gender +
agency_dummy*gender +
stem_sb_dummy*gender +
overall_pre_interest +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | challenge | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.86 | 0.25 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.15 | 0.07 | .045 |
youth_activity_threeCreating Product | Â | 0.33 | 0.08 | <.001 |
genderM | Â | 0.52 | 0.15 | <.001 |
agency_dummy | Â | 0.11 | 0.08 | .150 |
stem_sb_dummy | Â | 0.13 | 0.08 | .107 |
overall_pre_interest | Â | 0.01 | 0.07 | .927 |
youth_activity_threeBasic Skills Activity:genderM | Â | -0.03 | 0.09 | .707 |
youth_activity_threeCreating Product:genderM | Â | 0.01 | 0.10 | .880 |
genderM:agency_dummy | Â | -0.08 | 0.09 | .408 |
genderM:stem_sb_dummy | Â | -0.25 | 0.10 | .012 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.048 | ||
ICCparticipant_ID | Â | 0.380 | ||
ICCprogram_ID | Â | 0.042 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .531 / .524 |
sjp.int(m)
m <- lmer(challenge ~
youth_activity_three*overall_pre_interest +
agency_dummy*overall_pre_interest +
stem_sb_dummy*overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | challenge | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.66 | 0.29 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.18 | 0.17 | .278 |
youth_activity_threeCreating Product | Â | 0.50 | 0.20 | .015 |
overall_pre_interest | Â | 0.12 | 0.09 | .195 |
agency_dummy | Â | 0.21 | 0.18 | .232 |
stem_sb_dummy | Â | 0.23 | 0.19 | .214 |
genderM | Â | 0.25 | 0.11 | .026 |
youth_activity_threeBasic Skills Activity:overall_pre_interest | Â | -0.01 | 0.05 | .782 |
youth_activity_threeCreating Product:overall_pre_interest | Â | -0.05 | 0.06 | .404 |
overall_pre_interest:agency_dummy | Â | -0.05 | 0.05 | .400 |
overall_pre_interest:stem_sb_dummy | Â | -0.08 | 0.06 | .201 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.051 | ||
ICCparticipant_ID | Â | 0.379 | ||
ICCprogram_ID | Â | 0.042 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .532 / .525 |
sjp.int(m)
m <- lmer(relevance ~
youth_activity_three +
agency_dummy +
stem_sb_dummy +
overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | relevance | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.10 | 0.21 | <.001 |
youth_activity_three (Basic Skills Activity) | Â | 0.04 | 0.04 | .269 |
youth_activity_three (Creating Product) | Â | 0.12 | 0.04 | .004 |
agency_dummy | Â | -0.05 | 0.04 | .187 |
stem_sb_dummy | Â | 0.11 | 0.04 | .011 |
overall_pre_interest | Â | 0.10 | 0.06 | .125 |
gender (M) | Â | 0.24 | 0.11 | .030 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.012 | ||
ICCparticipant_ID | Â | 0.519 | ||
ICCprogram_ID | Â | 0.011 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .594 / .592 |
m <- lmer(relevance ~
youth_activity_three*gender +
agency_dummy*gender +
stem_sb_dummy*gender +
overall_pre_interest +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | relevance | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.03 | 0.21 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.08 | 0.05 | .124 |
youth_activity_threeCreating Product | Â | 0.18 | 0.06 | .002 |
genderM | Â | 0.37 | 0.13 | .006 |
agency_dummy | Â | -0.05 | 0.05 | .323 |
stem_sb_dummy | Â | 0.16 | 0.05 | .004 |
overall_pre_interest | Â | 0.10 | 0.06 | .125 |
youth_activity_threeBasic Skills Activity:genderM | Â | -0.07 | 0.07 | .277 |
youth_activity_threeCreating Product:genderM | Â | -0.11 | 0.08 | .154 |
genderM:agency_dummy | Â | -0.01 | 0.07 | .891 |
genderM:stem_sb_dummy | Â | -0.11 | 0.07 | .144 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.012 | ||
ICCparticipant_ID | Â | 0.520 | ||
ICCprogram_ID | Â | 0.011 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .595 / .592 |
sjp.int(m)
m <- lmer(relevance ~
youth_activity_three*overall_pre_interest +
agency_dummy*overall_pre_interest +
stem_sb_dummy*overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | relevance | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.11 | 0.24 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.04 | 0.12 | .727 |
youth_activity_threeCreating Product | Â | -0.24 | 0.15 | .122 |
overall_pre_interest | Â | 0.09 | 0.08 | .217 |
agency_dummy | Â | -0.03 | 0.13 | .790 |
stem_sb_dummy | Â | 0.15 | 0.14 | .287 |
genderM | Â | 0.24 | 0.11 | .028 |
youth_activity_threeBasic Skills Activity:overall_pre_interest | Â | 0.00 | 0.04 | .969 |
youth_activity_threeCreating Product:overall_pre_interest | Â | 0.11 | 0.05 | .016 |
overall_pre_interest:agency_dummy | Â | -0.01 | 0.04 | .865 |
overall_pre_interest:stem_sb_dummy | Â | -0.01 | 0.04 | .779 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.013 | ||
ICCparticipant_ID | Â | 0.518 | ||
ICCprogram_ID | Â | 0.012 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .595 / .593 |
sjp.int(m)
m <- lmer(learning ~
youth_activity_three +
agency_dummy +
stem_sb_dummy +
overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | learning | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.35 | 0.19 | <.001 |
youth_activity_three (Basic Skills Activity) | Â | 0.15 | 0.05 | .003 |
youth_activity_three (Creating Product) | Â | 0.04 | 0.05 | .435 |
agency_dummy | Â | 0.03 | 0.05 | .578 |
stem_sb_dummy | Â | 0.10 | 0.05 | .054 |
overall_pre_interest | Â | 0.08 | 0.06 | .171 |
gender (M) | Â | 0.07 | 0.10 | .522 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.008 | ||
ICCparticipant_ID | Â | 0.354 | ||
ICCprogram_ID | Â | 0.000 | ||
Observations | Â | 2548 | ||
R2 / Ω02 |  | .417 / .411 |
m <- lmer(learning ~
youth_activity_three*gender +
agency_dummy*gender +
stem_sb_dummy*gender +
overall_pre_interest +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | learning | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.27 | 0.20 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.21 | 0.06 | .001 |
youth_activity_threeCreating Product | Â | 0.06 | 0.07 | .402 |
genderM | Â | 0.23 | 0.14 | .118 |
agency_dummy | Â | 0.08 | 0.07 | .254 |
stem_sb_dummy | Â | 0.12 | 0.07 | .080 |
overall_pre_interest | Â | 0.08 | 0.06 | .160 |
youth_activity_threeBasic Skills Activity:genderM | Â | -0.14 | 0.09 | .118 |
youth_activity_threeCreating Product:genderM | Â | -0.04 | 0.10 | .684 |
genderM:agency_dummy | Â | -0.10 | 0.09 | .268 |
genderM:stem_sb_dummy | Â | -0.05 | 0.10 | .618 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.008 | ||
ICCparticipant_ID | Â | 0.355 | ||
ICCprogram_ID | Â | 0.000 | ||
Observations | Â | 2548 | ||
R2 / Ω02 |  | .418 / .412 |
sjp.int(m)
m <- lmer(learning ~
youth_activity_three*overall_pre_interest +
agency_dummy*overall_pre_interest +
stem_sb_dummy*overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | learning | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 2.29 | 0.25 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.26 | 0.15 | .100 |
youth_activity_threeCreating Product | Â | -0.00 | 0.20 | .991 |
overall_pre_interest | Â | 0.10 | 0.08 | .207 |
agency_dummy | Â | -0.08 | 0.16 | .632 |
stem_sb_dummy | Â | 0.26 | 0.18 | .146 |
genderM | Â | 0.07 | 0.10 | .516 |
youth_activity_threeBasic Skills Activity:overall_pre_interest | Â | -0.04 | 0.05 | .475 |
youth_activity_threeCreating Product:overall_pre_interest | Â | 0.01 | 0.06 | .839 |
overall_pre_interest:agency_dummy | Â | 0.04 | 0.05 | .501 |
overall_pre_interest:stem_sb_dummy | Â | -0.05 | 0.06 | .375 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.009 | ||
ICCparticipant_ID | Â | 0.354 | ||
ICCprogram_ID | Â | 0.000 | ||
Observations | Â | 2548 | ||
R2 / Ω02 |  | .418 / .412 |
sjp.int(m)
m <- lmer(positive_affect ~
youth_activity_three +
agency_dummy +
stem_sb_dummy +
overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | positive_affect | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.94 | 0.25 | <.001 |
youth_activity_three (Basic Skills Activity) | Â | 0.02 | 0.05 | .748 |
youth_activity_three (Creating Product) | Â | -0.05 | 0.05 | .360 |
agency_dummy | Â | 0.17 | 0.05 | .002 |
stem_sb_dummy | Â | -0.04 | 0.05 | .422 |
overall_pre_interest | Â | 0.20 | 0.07 | .007 |
gender (M) | Â | 0.16 | 0.11 | .160 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.027 | ||
ICCparticipant_ID | Â | 0.432 | ||
ICCprogram_ID | Â | 0.074 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .587 / .583 |
m <- lmer(positive_affect ~
youth_activity_three*gender +
agency_dummy*gender +
stem_sb_dummy*gender +
overall_pre_interest +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | positive_affect | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.92 | 0.26 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.02 | 0.06 | .771 |
youth_activity_threeCreating Product | Â | -0.10 | 0.07 | .133 |
genderM | Â | 0.20 | 0.14 | .173 |
agency_dummy | Â | 0.20 | 0.06 | .003 |
stem_sb_dummy | Â | -0.04 | 0.07 | .509 |
overall_pre_interest | Â | 0.20 | 0.07 | .006 |
youth_activity_threeBasic Skills Activity:genderM | Â | 0.00 | 0.08 | .991 |
youth_activity_threeCreating Product:genderM | Â | 0.11 | 0.09 | .199 |
genderM:agency_dummy | Â | -0.07 | 0.08 | .391 |
genderM:stem_sb_dummy | Â | -0.00 | 0.09 | .980 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.027 | ||
ICCparticipant_ID | Â | 0.431 | ||
ICCprogram_ID | Â | 0.074 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .587 / .583 |
sjp.int(m)
m <- lmer(positive_affect ~
youth_activity_three*overall_pre_interest +
agency_dummy*overall_pre_interest +
stem_sb_dummy*overall_pre_interest +
gender +
(1|program_ID) + (1|participant_ID) + (1|beep_ID_new),
data = df)
sjPlot::sjt.lmer(m, p.kr = T, show.re.var = F, show.ci = F, show.se = T)
 |  | positive_affect | ||
 |  | B | std. Error | p |
Fixed Parts | ||||
(Intercept) | Â | 1.96 | 0.29 | <.001 |
youth_activity_threeBasic Skills Activity | Â | 0.04 | 0.15 | .802 |
youth_activity_threeCreating Product | Â | -0.23 | 0.18 | .207 |
overall_pre_interest | Â | 0.19 | 0.09 | .032 |
agency_dummy | Â | -0.12 | 0.15 | .417 |
stem_sb_dummy | Â | 0.24 | 0.16 | .149 |
genderM | Â | 0.16 | 0.11 | .162 |
youth_activity_threeBasic Skills Activity:overall_pre_interest | Â | -0.01 | 0.05 | .887 |
youth_activity_threeCreating Product:overall_pre_interest | Â | 0.05 | 0.05 | .323 |
overall_pre_interest:agency_dummy | Â | 0.10 | 0.05 | .047 |
overall_pre_interest:stem_sb_dummy | Â | -0.09 | 0.05 | .086 |
Random Parts | ||||
Nbeep_ID_new | Â | 236 | ||
Nparticipant_ID | Â | 180 | ||
Nprogram_ID | Â | 9 | ||
ICCbeep_ID_new | Â | 0.026 | ||
ICCparticipant_ID | Â | 0.432 | ||
ICCprogram_ID | Â | 0.074 | ||
Observations | Â | 2549 | ||
R2 / Ω02 |  | .587 / .583 |
sjp.int(m)