split_half_one$cognitive_engagement<-composite_mean_maker(split_half_one, IMPTYOU, IMPTGOAL)
split_half_one$affective_engagement<-composite_mean_maker(split_half_one, ENJOY, INTEREST)
split_half_one$behavioral_engagement<-composite_mean_maker(split_half_one, CONCEN, WRKHARD)
split_half_two$cognitive_engagement<-composite_mean_maker(split_half_two, IMPTYOU, IMPTGOAL)
split_half_two$affective_engagement<-composite_mean_maker(split_half_two, ENJOY, INTEREST)
split_half_two$behavioral_engagement<-composite_mean_maker(split_half_two, CONCEN, WRKHARD)
#imuscle_profs<-compare_models_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, starts = c(100, 20))
#compare_models_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement)
#compare_models_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, prior_control = T)
#imuscle_profs[[1]] %>%
#gather(key,val, -n_profiles) %>%
#mutate(val = as.numeric(val)) %>%
#ggplot(aes(x=n_profiles, y=val, color=key, group=key)) +
#geom_line() +
#geom_point()
m1<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=6, model=1, return_save_data = T)
plot_profiles_mplus(m1, to_center=TRUE, to_scale = TRUE)
m7<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=6, model=1)
plot_profiles_lpa(m7, to_center=TRUE, to_scale = TRUE)
m2<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=7, model=1, return_save_data = T)
plot_profiles_mplus(m2, to_center=TRUE, to_scale = TRUE)
m8<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=7, model=1)
plot_profiles_lpa(m8, to_center=TRUE, to_scale = TRUE)
m3<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=1, return_save_data = T)
plot_profiles_mplus(m3, to_center=TRUE, to_scale = TRUE)
m8<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=1)
plot_profiles_lpa(m8, to_center=TRUE, to_scale = TRUE)
m4<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=4, model=1, return_save_data = T)
plot_profiles_mplus(m4, to_center=TRUE, to_scale = TRUE)
m9<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=4, model=1)
plot_profiles_lpa(m9, to_center=TRUE, to_scale = TRUE)
m5<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=2, return_save_data = T)
plot_profiles_mplus(m5, to_center=TRUE, to_scale = TRUE)
Quick interpretation of full esm file profiles: high affective, low all, low cognitive, high all, high cognitive
m5 %>%
pluck(2) %>%
select(COGNITIV: AFFECTIV, C) %>%
group_by(C) %>%
summarise_all(mean, na.rm=T)
## # A tibble: 5 x 4
## C COGNITIV BEHAVIOR AFFECTIV
## <dbl> <dbl> <dbl> <dbl>
## 1 1.00 0.630 2.26 0.848
## 2 2.00 0.541 0.850 0.705
## 3 3.00 0.715 2.39 2.34
## 4 4.00 2.30 2.44 2.33
## 5 5.00 2.32 2.09 0.776
r<-m5 %>%
pluck(2)
fit<-manova(cbind(COGNITIV, BEHAVIOR, AFFECTIV) ~ as.factor(r$C), data=r)
summary(fit, test="Pillai")
## Df Pillai approx F num Df den Df Pr(>F)
## as.factor(r$C) 4 1.7306 2245.2 12 19761 < 2.2e-16 ***
## Residuals 6587
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary.aov(fit)
## Response COGNITIV :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(r$C) 4 4684.9 1171.23 4182.2 < 2.2e-16 ***
## Residuals 6587 1844.7 0.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response BEHAVIOR :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(r$C) 4 2359.2 589.80 1809.1 < 2.2e-16 ***
## Residuals 6587 2147.5 0.33
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response AFFECTIV :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(r$C) 4 3931.6 982.91 3468.6 < 2.2e-16 ***
## Residuals 6587 1866.6 0.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
aov1<-aov(COGNITIV ~ C, data = r)
summary(aov1)
## Df Sum Sq Mean Sq F value Pr(>F)
## C 1 3727 3727 8763 <2e-16 ***
## Residuals 6590 2803 0
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(r$COGNITIV ~ as.factor(r$C)))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = r$COGNITIV ~ as.factor(r$C))
##
## $`as.factor(r$C)`
## diff lwr upr p adj
## 2-1 -0.08868734 -0.15025448 -0.02712020 0.0008149
## 3-1 0.08516891 0.01726861 0.15306921 0.0056378
## 4-1 1.67235761 1.61951124 1.72520397 0.0000000
## 5-1 1.69101713 1.61420510 1.76782916 0.0000000
## 3-2 0.17385625 0.10897093 0.23874157 0.0000000
## 4-2 1.76104495 1.71213286 1.80995703 0.0000000
## 5-2 1.77970447 1.70554423 1.85386471 0.0000000
## 4-3 1.58718870 1.53051128 1.64386612 0.0000000
## 5-3 1.60584822 1.52635181 1.68534463 0.0000000
## 5-4 0.01865952 -0.04843717 0.08575622 0.9422519
aov2<-aov(BEHAVIOR ~ C, data = r)
summary(aov2)
## Df Sum Sq Mean Sq F value Pr(>F)
## C 1 489 489.2 802.5 <2e-16 ***
## Residuals 6590 4017 0.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(r$BEHAVIOR ~ as.factor(r$C)))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = r$BEHAVIOR ~ as.factor(r$C))
##
## $`as.factor(r$C)`
## diff lwr upr p adj
## 2-1 -1.4092005 -1.47562873 -1.34277222 0.0000000
## 3-1 0.1338478 0.06058631 0.20710923 0.0000063
## 4-1 0.1796676 0.12264865 0.23668649 0.0000000
## 5-1 -0.1666407 -0.24951751 -0.08376386 0.0000004
## 3-2 1.5430482 1.47303982 1.61305666 0.0000000
## 4-2 1.5888680 1.53609404 1.64164204 0.0000000
## 5-2 1.2425598 1.16254413 1.32257545 0.0000000
## 4-3 0.0458198 -0.01533266 0.10697226 0.2449271
## 5-3 -0.3004885 -0.38626161 -0.21471530 0.0000000
## 5-4 -0.3463083 -0.41870266 -0.27391385 0.0000000
aov3<-aov(AFFECTIV ~ C, data = r)
summary(aov3)
## Df Sum Sq Mean Sq F value Pr(>F)
## C 1 1415 1415.4 2128 <2e-16 ***
## Residuals 6590 4383 0.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(r$AFFECTIV ~ as.factor(r$C)))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = r$AFFECTIV ~ as.factor(r$C))
##
## $`as.factor(r$C)`
## diff lwr upr p adj
## 2-1 -0.143363157 -0.205294159 -0.081432155 0.0000000
## 3-1 1.488911991 1.420610402 1.557213579 0.0000000
## 4-1 1.482862473 1.429703789 1.536021157 0.0000000
## 5-1 -0.072693761 -0.149959745 0.004572223 0.0766603
## 3-2 1.632275148 1.567006360 1.697543936 0.0000000
## 4-2 1.626225630 1.577024478 1.675426782 0.0000000
## 5-2 0.070669396 -0.003929128 0.145267921 0.0732552
## 4-3 -0.006049518 -0.063061897 0.050962861 0.9984686
## 5-3 -1.561605751 -1.641571981 -1.481639522 0.0000000
## 5-4 -1.555556234 -1.623049467 -1.488063000 0.0000000
m51<-create_profiles_mplus(split_half_one, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=2, return_save_data = T)
plot_profiles_mplus(m51, to_center=TRUE, to_scale = TRUE)
Quick interpretation of split half profiles: very low all, low all, high all, high affective, high cognitive
m52<-create_profiles_mplus(split_half_two, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=2, return_save_data = T)
plot_profiles_mplus(m52, to_center=TRUE, to_scale = TRUE)
Quick interpretation of split half two profiles: high affective, low all, low cognitive, high all, high cognitive
m10<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=5, model=2)
plot_profiles_lpa(m10, to_center=TRUE, to_scale = TRUE)
m6<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=7, model=2, return_save_data = T)
plot_profiles_mplus(m6, to_center=TRUE, to_scale = TRUE)
m11<-create_profiles_lpa(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=7, model=2)
plot_profiles_lpa(m11, to_center=TRUE, to_scale = TRUE)
m12<-create_profiles_mplus(iMUScLE_esm, cognitive_engagement, behavioral_engagement, affective_engagement, n_profiles=4, model=2, return_save_data = T)
plot_profiles_mplus(m12, to_center=TRUE, to_scale = TRUE)