library(dplyr)
library(tidyverse)
## Warning: package 'tibble' was built under R version 3.4.3
## Warning: package 'tidyr' was built under R version 3.4.3
library(lme4)
## Warning: package 'lme4' was built under R version 3.4.4
library(lmerTest)
## Warning: package 'lmerTest' was built under R version 3.4.4
library(gmodels)
library(jmRtools)
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")
pre_survey_all_variables <- read_csv("/Volumes/SCHMIDTLAB/PSE/data/STEM-IE/STEM-IE-pre-survey-data-processed.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")
value <- read_csv("/Volumes/SCHMIDTLAB/PSE/Data/STEM-IE/STEM-IE-value.csv")
community_space <- read_csv("/Volumes/SCHMIDTLAB/PSE/Data/STEM-IE/STEM-IE-community-space-content.csv")
Creating motivation to attend variable
pre_survey_all_variables$motivation_to_attend <- ifelse(pre_survey_all_variables$how_much_looking_forward == 1, 0, 1)
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)
pre_survey_all_variables <- rename(pre_survey_all_variables, program_ID_string = program_ID)
pre_survey_all_variables <- rename(pre_survey_all_variables, program_providence_useless = program_providence)
df <- left_join(esm, pre_survey_data_processed, by = "participant_ID") # df = esm & pre-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
df <- left_join(df, pre_survey_all_variables, by = "participant_ID") #df & pre-survey all variables Not sure what two program id's now
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$stem_sb_dummy <- ifelse(pqa$stem_sb == 0, 0, 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"))
## Warning: Column `program_ID` joining factor and character vector, coercing
## into character vector
# !!! MERGE PQA
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$program_ID <- as.character(pqa$program_ID)
df <- left_join(df, pqa, by = c("response_date", "program_ID", "signal_number", "sociedad_class"))
# !!!
# !!! MERGE CLASS
class_data$COMPOSIT <- jmRtools::composite_mean_maker(class_data, ID, P, AI, ILF, QF, CU)
class_data$sociedad_class <- ifelse(class_data$eighth_math == 1, "8th Math",
ifelse(class_data$seventh_math == 1, "7th Math",
ifelse(class_data$sixth_math == 1, "6th Math",
ifelse(class_data$robotics == 1, "Robotics",
ifelse(class_data$dance == 1, "Dance", NA)))))
class_data$program_ID <- as.character(class_data$SiteIDNumeric)
class_data <- rename(class_data,
response_date = Responsedate,
signal_number = r_signal_number)
df <- left_join(df, class_data, by = c("response_date", "program_ID", "signal_number", "sociedad_class"))
df <-left_join(df, pqa)
# !!!
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(ho_thinking > 0, 1, 0),
agency_dummy = ifelse(agency > 0, 1, 0),
active_dummy = ifelse(active > 0, 1, 0),
belonging_dummy = ifelse(belonging > 0, 1, 0),
stem_sb_dummy = ifelse(sum_stem_sb > 0, 1, 0))
Creating subject variable
#pqa$subject <-ifelse(pqa$science == 1, "Science",
#ifelse(pqa$mathematics == 1, "Math",
#ifelse(pqa$building == 1, "Building", NA)))
df$subject <-ifelse(df$science == 1, "Science",
ifelse(df$mathematics == 1, "Math",
ifelse(df$building == 1, "Building", NA)))
df$subject_other <- ifelse(df$science == 0 &
df$mathematics == 0 &
df$building == 0, 1, 0)
Creating variable that is >=3
df$agency_comp_three <- ifelse(df$agency >= 3 & df$COMPOSIT >=3, 1, 0)
community_space <- rename(community_space,
response_date = resp_date,
signal_number = signal,
program_ID = SiteIDNumeric)
community_space$program_ID <- as.character(community_space$program_ID)
community_space$sociedad_class <- ifelse(community_space$eighth_math == 1, "8th Math",
ifelse(community_space$seventh_math == 1, "7th Math",
ifelse(community_space$sixth_math == 1, "6th Math",
ifelse(community_space$robotics == 1, "Robotics",
ifelse(community_space$dance == 1, "Dance", NA)))))
community_space$response_date <- format(as.Date(community_space$response_date, format = "%m/%d/%Y"), "%Y-%m-%d")
## Warning in strptime(x, format, tz = "GMT"): unknown timezone 'zone/tz/
## 2018c.1.0/zoneinfo/America/Detroit'
community_space <- mutate(community_space, response_date = as.character(response_date))
df <- mutate(df, response_date = as.character(response_date))
df <- left_join(df, community_space, by = c("response_date", "program_ID", "signal_number", "sociedad_class"))
value <- rename(value,
response_date = resp_date,
signal_number = signal,
program_ID = SiteIDNumeric)
value$program_ID <- as.character(value$program_ID)
value$sociedad_class <- ifelse(value$eighth_math == 1, "8th Math",
ifelse(value$seventh_math == 1, "7th Math",
ifelse(value$sixth_math == 1, "6th Math",
ifelse(value$robotics == 1, "Robotics",
ifelse(value$dance == 1, "Dance", NA)))))
value$response_date <- format(as.Date(value$response_date, format = "%m/%d/%Y"), "%Y-%m-%d")
value <- mutate(value, response_date = as.character(response_date))
df <- left_join(df, value, by = c("response_date", "program_ID", "signal_number", "sociedad_class"))
df$all_value_sum <- df$V01.01.HighUtility_sum + df$V01.03.HighIntrinsic_sum + df$V01.05.HighAttainment_sum
df$control <- jmRtools::composite_mean_maker(df, in_control, learning, good_at)
df$value <- jmRtools::composite_mean_maker(df, important, future_goals)
Reliabilities
#control_reliability <- select(df, in_control, learning, good_at)
#cronbach(control_reliability)
#value_reliability <- select(df, important, future_goals)
#cronbach(value_reliability)
#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)
}
Emo_Corr <- select(df, creating_product, basic_skills, program_staff_led, not_focused, field_trip_speaker, lab, control, value, happy, excited, frustrated, bored)
corstarsl(Emo_Corr)
## Warning: package 'Hmisc' was built under R version 3.4.3
## creating_product basic_skills program_staff_led
## creating_product
## basic_skills -0.27***
## program_staff_led -0.21*** -0.23***
## not_focused -0.35*** -0.38*** -0.29***
## field_trip_speaker -0.11*** -0.12*** -0.09***
## lab -0.11*** -0.12*** -0.09***
## control 0.04* 0.02 0.01
## value 0.08*** -0.01 0.01
## happy 0.07*** -0.07*** -0.08***
## excited 0.03 -0.04* -0.06**
## frustrated 0.07*** 0.00 -0.04*
## bored -0.02 0.06** 0.03
## not_focused field_trip_speaker lab control
## creating_product
## basic_skills
## program_staff_led
## not_focused
## field_trip_speaker -0.16***
## lab -0.15*** -0.05**
## control -0.05** -0.01 0.00
## value -0.06*** 0.01 -0.02 0.66***
## happy 0.05** 0.00 0.01 0.53***
## excited 0.03 0.03 0.03 0.50***
## frustrated -0.05* 0.01 0.02 -0.07***
## bored -0.07*** 0.02 -0.01 -0.19***
## value happy excited frustrated
## creating_product
## basic_skills
## program_staff_led
## not_focused
## field_trip_speaker
## lab
## control
## value
## happy 0.48***
## excited 0.46*** 0.75***
## frustrated 0.02 -0.19*** -0.13***
## bored -0.17*** -0.37*** -0.30*** 0.53***
More correlations
Emo_Corr2 <- select(df, sum_ap, sum_ho_thinking, sum_belonging, sum_agency, sum_stem_sb, control, value, happy, excited, frustrated, bored)
corstarsl(Emo_Corr2)
## sum_ap sum_ho_thinking sum_belonging sum_agency
## sum_ap
## sum_ho_thinking 0.44***
## sum_belonging 0.23*** 0.36***
## sum_agency 0.16*** 0.38*** 0.53***
## sum_stem_sb 0.57*** 0.53*** 0.42*** 0.39***
## control 0.01 0.02 0.02 0.04*
## value 0.02 0.03 -0.02 0.02
## happy -0.01 0.02 0.00 0.05*
## excited 0.02 0.04* -0.02 0.02
## frustrated -0.01 -0.04* -0.01 0.01
## bored -0.03 -0.05** -0.03 -0.06**
## sum_stem_sb control value happy excited frustrated
## sum_ap
## sum_ho_thinking
## sum_belonging
## sum_agency
## sum_stem_sb
## control 0.02
## value 0.03 0.66***
## happy -0.04* 0.53*** 0.48***
## excited -0.03 0.50*** 0.46*** 0.75***
## frustrated 0.02 -0.07*** 0.02 -0.19*** -0.13***
## bored 0.02 -0.19*** -0.17*** -0.37*** -0.30*** 0.53***
Descriptives
psych::describe(pqa$sum_ap)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 236 1.42 0.53 1 1.42 0 0 2 2 -0.01 -1.25 0.03
psych::describe(pqa$sum_ho_thinking)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 236 1.83 1.13 2 1.92 1.48 0 3 3 -0.42 -1.25
## se
## X1 0.07
psych::describe(pqa$sum_belonging)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 236 1.08 0.73 1 1.11 1.48 0 2 2 -0.13 -1.14
## se
## X1 0.05
psych::describe(pqa$sum_agency)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 236 2 1.4 2 2 1.48 0 4 4 0.11 -1.23 0.09
psych::describe(pqa$sum_stem_sb)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 236 3.15 2.44 3 2.95 2.97 0 9 9 0.49 -0.53 0.16
psych::describe(df$control)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 2970 2.84 0.83 3 2.88 0.99 1 4 3 -0.31 -0.6
## se
## X1 0.02
psych::describe(df$value)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 2970 2.58 0.99 2.5 2.59 0.74 1 4 3 -0.09 -1.07
## se
## X1 0.02
psych::describe(df$happy)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 2969 2.84 1.11 3 2.93 1.48 1 4 3 -0.45 -1.18
## se
## X1 0.02
psych::describe(df$excited)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 2969 2.65 1.19 3 2.69 1.48 1 4 3 -0.21 -1.47
## se
## X1 0.02
psych::describe(df$frustrated)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 2969 1.84 1.09 1 1.67 0 1 4 3 0.93 -0.61 0.02
psych::describe(df$bored)
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 2969 2.08 1.18 2 1.98 1.48 1 4 3 0.55 -1.26
## se
## X1 0.02
Null Models
M0 <- lmer(control ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M0)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## control ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 6067.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.3699 -0.4740 0.0764 0.5490 3.1104
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.01837 0.1355
## participant_ID (Intercept) 0.28568 0.5345
## program_ID (Intercept) 0.00000 0.0000
## Residual 0.36895 0.6074
## Number of obs: 2970, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.82952 0.04064 221.77795 69.62 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M0)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: control ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.027291
## ICC (participant_ID): 0.424490
## ICC (program_ID): 0.000000
M01 <- lmer(value ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M01)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## value ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 6925
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7755 -0.5366 0.0545 0.6020 3.5370
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.018641 0.13653
## participant_ID (Intercept) 0.476102 0.69000
## program_ID (Intercept) 0.005928 0.07699
## Residual 0.488635 0.69902
## Number of obs: 2970, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.56689 0.05782 7.39127 44.4 3.03e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M01)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: value ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.018843
## ICC (participant_ID): 0.481249
## ICC (program_ID): 0.005992
M02 <- lmer(happy ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M02)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## happy ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 7605.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4665 -0.4019 0.0595 0.5188 3.2445
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.0189 0.1375
## participant_ID (Intercept) 0.5047 0.7105
## program_ID (Intercept) 0.1043 0.3230
## Residual 0.6229 0.7893
## Number of obs: 2969, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.799 0.121 7.755 23.14 1.95e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M02)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: happy ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.015110
## ICC (participant_ID): 0.403504
## ICC (program_ID): 0.083398
M03 <- lmer(excited ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M03)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## excited ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 8101.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2302 -0.5459 0.0673 0.5932 3.1045
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.02962 0.1721
## participant_ID (Intercept) 0.54034 0.7351
## program_ID (Intercept) 0.11483 0.3389
## Residual 0.73599 0.8579
## Number of obs: 2969, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.6018 0.1268 7.2855 20.51 1.03e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M03)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: excited ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.020847
## ICC (participant_ID): 0.380310
## ICC (program_ID): 0.080823
M04 <- lmer(frustrated ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M04)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## frustrated ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 7789.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9657 -0.5174 -0.1433 0.3808 3.3343
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.008871 0.09418
## participant_ID (Intercept) 0.503086 0.70929
## program_ID (Intercept) 0.041607 0.20398
## Residual 0.675877 0.82212
## Number of obs: 2969, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.89567 0.08705 8.34963 21.78 1.19e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M04)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: frustrated ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.007215
## ICC (participant_ID): 0.409199
## ICC (program_ID): 0.033842
M05 <- lmer(bored ~
(1|program_ID) +
(1|participant_ID) +
(1|beep_ID_new),
data = df)
summary(M05)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## bored ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
## Data: df
##
## REML criterion at convergence: 8288.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.97201 -0.61796 -0.09737 0.48698 3.08594
##
## Random effects:
## Groups Name Variance Std.Dev.
## beep_ID_new (Intercept) 0.03174 0.1782
## participant_ID (Intercept) 0.53709 0.7329
## program_ID (Intercept) 0.08910 0.2985
## Residual 0.78770 0.8875
## Number of obs: 2969, groups:
## beep_ID_new, 248; participant_ID, 203; program_ID, 9
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.155 0.115 7.964 18.74 7.16e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M05)
##
## Linear mixed model
## Family: gaussian (identity)
## Formula: bored ~ (1 | program_ID) + (1 | participant_ID) + (1 | beep_ID_new)
##
## ICC (beep_ID_new): 0.021959
## ICC (participant_ID): 0.371529
## ICC (program_ID): 0.061631
Manova of control, value, and emos by activity. Post hocs included.
#fit<-manova(cbind(df$control, df$value, df$happy, df$excited, df$frustrated, df$bored) ~ df$youth_activity_rc, data = df)
#summary(fit, test="Pillai")
#summary.aov(fit)
#TukeyHSD(aov(df$control ~ df$youth_activity_rc))
#pairwise.t.test(df$challenge, df$youth_activity_rc, p.adj = "bonf")
#TukeyHSD(aov(df$value ~ df$youth_activity_rc))
#pairwise.t.test(df$relevance, df$youth_activity_rc, p.adj = "bonf")
#TukeyHSD(aov(df$happy ~ df$youth_activity_rc))
#pairwise.t.test(df$learning, df$youth_activity_rc, p.adj = "bonf")
#TukeyHSD(aov(df$excited ~ df$youth_activity_rc))
#TukeyHSD(aov(df$frustrated ~ df$youth_activity_rc))
#TukeyHSD(aov(df$bored ~ df$youth_activity_rc))
#model1 <- '
#measurement model
#control =~ in_control + learning + good_at
#value =~ important + future_goals
#regressions
#happy ~ control + value + basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#excited ~ control + value + basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#frustrated ~ control + value + basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#bored ~ control + value + basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#control ~ basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#value ~ basic_skills + creating_product + field_trip_speaker + lab + program_staff_led
#residual correlations
#basic_skills ~ creating_product + field_trip_speaker + lab + program_staff_led
#creating_product ~ field_trip_speaker + lab + program_staff_led
#field_trip_speaker ~ lab + program_staff_led
#lab ~ program_staff_led
#control ~~ value
#'
#fit1 <- sem(model1, data=df)
#summary(fit1, fit.measures = TRUE)
#model2 <- '
#measurement model
#control =~ in_control + learning + good_at + concentrating
#value =~ important + future_goals
#regressions
#happy ~ control + value + sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#excited ~ control + value + sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#frustrated ~ control + value + sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#bored ~ control + value + sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#control ~ sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#value ~ sum_ap + sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#residual correlations
#sum_ap ~~ sum_ho_thinking + sum_belonging + sum_agency + sum_stem_sb
#sum_ho_thinking ~~ sum_belonging + sum_agency + sum_stem_sb
#sum_belonging ~~ sum_agency + sum_stem_sb
#sum_agency ~~ sum_stem_sb
#control ~~ value
#happy ~~ excited + frustrated + bored
#excited ~~ frustrated + bored
#frustrated ~~ bored
#'
#fit2 <- sem(model2, data=df)
#summary(fit2, fit.measures = TRUE)