This script is for the project: https://osf.io/pvy6a/
Clear environment
rm(list = ls())
Load packages
library(here)
library(tidyverse)
library(qwraps2)
library(lavaan)
library(lme4)
library(psych)
library(summarytools)
library(sjPlot)
library(interactions)
library(RColorBrewer)
library(ggeasy)
library(janitor)
Read in data
coral <- read_csv(here("data", "CORAL_T1_T2_T3_WITHOUT_EXCLUDED_PS.csv"))
study1 <- read_csv(here("data", "study1.csv"))
Make age groups an ordered factor
study1$age_group <- ordered(study1$age_group, levels = c("adolescents", "emerging_adults", "adults", "older_adults"))
Duplicate age group columns
For one column, want to keep age as a factor, to make it easy to see which p’s fall into which age group. For the other…
study1 <- study1 %>%
mutate(age_group_factor = age_group) %>%
relocate(age_group_factor, .after = age_group)
Make age group numeric, according to order specified
study1$age_group <- as.numeric(study1$age_group)
Rename variables for easy reshaping
Drop the suffix “risk” and “total”
names(study1) <- gsub("[_]risk","",names(study1))
names(study1) <- gsub("[_]total","",names(study1))
Edit participant ID = 61307
Due to Qualtrics error, same ID has been assigned to two different participants. Edit one of these IDs, as otherwise, data from these two participants will be put in the same row during next step (pivoting).
study1[3132, 1] = 613071
Make long data frame
study1_long <- study1 %>%
pivot_longer(cols = !(ID:T1_IUS), names_to = c("time", "score"), names_sep = "_") %>%
pivot_wider(names_from = "score", values_from = "value")
Make time a continuous numeric variable
study1_long <- study1_long %>%
mutate(time = dplyr::recode(time, T1 = 1, T2 = 2, T3 = 3))
How many people participated at subsequent timepoints
T2 <- coral %>%
filter(!is.na(T2_ID))
T2 %>% filter(!is.na(T2_progress_percent)) %>% filter(T2_progress_percent != 0) %>% count()
## # A tibble: 1 x 1
## n
## <int>
## 1 954
T3 <- coral %>%
filter(!is.na(T3_ID))
T3 %>% filter(!is.na(T3_progress_percent)) %>% filter(T3_progress_percent != 0) %>% count()
## # A tibble: 1 x 1
## n
## <int>
## 1 877
Demographics breakdown
coral %>% select(T1_eligibility_age, T1_gender, T1_eligibility_country, T1_education, T1_ethnicity, T1_psychiatric_history) %>%
dfSummary()
## Data Frame Summary
## coral
## Dimensions: 3208 x 6
## Duplicates: 1795
##
## ----------------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------------------ ------------------------------ -------------------- ---------------------- --------- ---------
## 1 T1_eligibility_age Mean (sd) : 38 (17.2) 79 distinct values : 3168 40
## [numeric] min < med < max: : (98.8%) (1.2%)
## 11 < 34 < 100 . :
## IQR (CV) : 21 (0.5) : : : : :
## : : : : : : : .
##
## 2 T1_gender 1. Female 2811 (90.6%) IIIIIIIIIIIIIIIIII 3102 106
## [character] 2. Male 251 ( 8.1%) I (96.7%) (3.3%)
## 3. Other 32 ( 1.0%)
## 4. Prefer not to say 8 ( 0.3%)
##
## 3 T1_eligibility_country 1. Australia 769 (24.0%) IIII 3206 2
## [character] 2. United Kingdom 1475 (46.0%) IIIIIIIII (99.9%) (0.1%)
## 3. United States of America 962 (30.0%) IIIIII
##
## 4 T1_education 1. High School 578 (20.0%) IIII 2885 323
## [character] 2. Primary School 24 ( 0.8%) (89.9%) (10.1%)
## 3. Professional/ Vocational 481 (16.7%) III
## 4. University 1802 (62.5%) IIIIIIIIIIII
##
## 5 T1_ethnicity 1. Aboriginal or Torres Stra 11 ( 0.4%) 2884 324
## [character] 2. African 18 ( 0.6%) (89.9%) (10.1%)
## 3. Asian 119 ( 4.1%)
## 4. Caucasian 2422 (84.0%) IIIIIIIIIIIIIIII
## 5. Hispanic 61 ( 2.1%)
## 6. Mixed 82 ( 2.8%)
## 7. Other 134 ( 4.6%)
## 8. Prefer not to say 37 ( 1.3%)
##
## 6 T1_psychiatric_history 1. No 1833 (63.5%) IIIIIIIIIIII 2885 323
## [character] 2. Yes 1052 (36.5%) IIIIIII (89.9%) (10.1%)
## ----------------------------------------------------------------------------------------------------------------------------
Age group breakdown
dfSummary(study1$age_group)
## Data Frame Summary
## study1
## Dimensions: 3208 x 1
## Duplicates: 3203
##
## --------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ----------- ----------------------- -------------------- ---------------- --------- ---------
## 1 age_group Mean (sd) : 2.8 (0.8) 1 : 344 (10.9%) II 3168 40
## [numeric] min < med < max: 2 : 334 (10.5%) II (98.8%) (1.2%)
## 1 < 3 < 4 3 : 2029 (64.0%) IIIIIIIIIIII
## IQR (CV) : 0 (0.3) 4 : 461 (14.6%) II
## --------------------------------------------------------------------------------------------------
More descriptives for age
Can use either below, similar info
descr(study1$age)
## Descriptive Statistics
## study1$age
## N: 3208
##
## age
## ----------------- ---------
## Mean 37.95
## Std.Dev 17.17
## Min 11.00
## Q1 27.00
## Median 34.00
## Q3 48.00
## Max 100.00
## MAD 13.34
## IQR 21.00
## CV 0.45
## Skewness 0.74
## SE.Skewness 0.04
## Kurtosis -0.40
## N.Valid 3168.00
## Pct.Valid 98.75
psych::describe(study1$age)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 3168 37.95 17.17 34 36.55 13.34 11 100 89 0.74 -0.4 0.31
Compute SES
Using Savannah’s code. Recode Education and Parent 1 and 2 education variables, such that university = 3 (high SES), high school or professional/vocational training = 2 (middle SES), and primary school = 1 (low SES).
For participants 18 years or older or those with missing age, use Education variable to determine SES
For participants under 18, use the average of the two parent education variables.
coral <- coral %>%
mutate(T1_over18_SES = ifelse(
T1_eligibility_age > 17 | is.na(T1_eligibility_age),
dplyr::recode(T1_education, "Primary School" = 1, "High School" = 2,"Professional/ Vocational training" = 2, "University" = 3), NA),
T1_Parent1_SES = ifelse(
T1_eligibility_age < 18,
dplyr::recode(T1_parent1_education, "Primary School" = 1, "High School" = 2,"Professional/ Vocational training" = 2, "University" = 3), NA),
T1_Parent2_SES = ifelse(
T1_eligibility_age < 18,
dplyr::recode(T1_parent2_education, "Primary School" = 1, "High School" = 2,"Professional/ Vocational training" = 2, "University" = 3), NA))
coral$T1_Parent_SES_combined <- ifelse(coral$T1_eligibility_age < 18, rowMeans(coral[ ,c("T1_Parent1_SES", "T1_Parent2_SES")], na.rm = T), NA)
coral <- coral %>%
unite(T1_SES, T1_over18_SES, T1_Parent_SES_combined, na.rm = T, remove = T)
coral$T1_SES <- as.numeric(coral$T1_SES)
table(coral$T1_SES)
##
## 1 2 3
## 6 850 1936
T1 demographics table
Calculate key demographic characteristics and get output as dataframe, with n and % in separate columns.
# allow for markdown output
options(qwraps2_markup = 'markdown')
# Create grouped age variable, select relevant variables, and code missing values as 1 (as qwraps is not good at dealing with missing values)
coral_table <- coral %>%
mutate(T1_eligibility_age = case_when(T1_eligibility_age< 18 ~ "11 - 17 years old",
T1_eligibility_age >= 18 & T1_eligibility_age < 25 ~ "18 - 24 years old",
T1_eligibility_age >= 25 & T1_eligibility_age < 65 ~ "25 - 64 years old",
T1_eligibility_age >= 65 ~ "65 - 100 years old")) %>%
select(T1_eligibility_age, T1_gender, T1_eligibility_country, T1_ethnicity, T1_psychiatric_history, T1_SES) %>%
mutate(across(everything(), ~ifelse(is.na(.x), 0, as.character(.x))))
summary_demographics <-
list("Age" =
list("11 - 17 years old" = ~ qwraps2::n_perc(T1_eligibility_age == "11 - 17 years old", na_rm = T, show_denom = "never", show_symbol = F),
"18 - 24 years old" = ~ qwraps2::n_perc(T1_eligibility_age== "18 - 24 years old", na_rm = T, show_denom = "never", show_symbol = F),
"25 - 64 years old" = ~ qwraps2::n_perc(T1_eligibility_age== "25 - 64 years old", na_rm = T, show_denom = "never", show_symbol = F),
"65 - 100 years old" = ~ qwraps2::n_perc(T1_eligibility_age == "65 - 100 years old", na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_eligibility_age== "0", na_rm = T, show_denom = "never", show_symbol = F)),
"Gender" =
list("Female" = ~ qwraps2::n_perc(T1_gender == "Female", na_rm = T, show_denom = "never", show_symbol = F),
"Male" = ~ qwraps2::n_perc(T1_gender == "Male", na_rm = T, show_denom = "never", show_symbol = F),
"Other" = ~ qwraps2::n_perc(T1_gender == "Other", na_rm = T, show_denom = "never", show_symbol = F),
"Prefer not to say" = ~ qwraps2::n_perc(T1_gender == "Prefer not to say", na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_gender == "0", na_rm = T, show_denom = "never", show_symbol = F)),
"Country" =
list("United Kingdom" = ~ qwraps2::n_perc(T1_eligibility_country == "United Kingdom", na_rm = T, show_denom = "never", show_symbol = F),
"United States of America" = ~ qwraps2::n_perc(T1_eligibility_country == "United States of America", na_rm = T, show_denom = "never", show_symbol = F),
"Australia" = ~ qwraps2::n_perc(T1_eligibility_country == "Australia",na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_eligibility_country == "0", na_rm = T, show_denom = "never", show_symbol = F)),
"Ethnicity" =
list("Caucasian" = ~ qwraps2::n_perc(T1_ethnicity == "Caucasian", na_rm = T, show_denom = "never", show_symbol = F),
"Asian" = ~ qwraps2::n_perc(T1_ethnicity == "Asian", na_rm = T, show_denom = "never", show_symbol = F),
"Other" = ~ qwraps2::n_perc(T1_ethnicity == "Other", na_rm = T, show_denom = "never", show_symbol = F),
"Mixed" = ~ qwraps2::n_perc(T1_ethnicity == "Mixed", na_rm = T, show_denom = "never", show_symbol = F),
"Hispanic" = ~ qwraps2::n_perc(T1_ethnicity == "Hispanic", na_rm = T, show_denom = "never", show_symbol = F),
"African" = ~ qwraps2::n_perc(T1_ethnicity == "African", na_rm = T, show_denom = "never", show_symbol = F),
"Aboriginal or Torres Strait Islander" = ~ qwraps2::n_perc(T1_ethnicity == "Aboriginal or Torres Strait Islander", na_rm = T, show_denom = "never", show_symbol = F),
"Prefer not to say" = ~ qwraps2::n_perc(T1_ethnicity == "Prefer not to say", na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_ethnicity == "0", na_rm = T, show_denom = "never", show_symbol = F)),
"History of mental health diagnosis" =
list("Yes" = ~ qwraps2::n_perc(T1_psychiatric_history == "Yes", na_rm = T, show_denom = "never", show_symbol = F),
"No"= ~ qwraps2::n_perc(T1_psychiatric_history == "No", na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_psychiatric_history == "0", na_rm = T, show_denom = "never", show_symbol = F)),
"SES" =
list("High" = ~ qwraps2::n_perc(T1_SES == "3", na_rm = T, show_denom = "never", show_symbol = F),
"Middle"= ~ qwraps2::n_perc(T1_SES == "2", na_rm = T, show_denom = "never", show_symbol = F),
"Low" = ~ qwraps2::n_perc(T1_SES == "1", na_rm = T, show_denom = "never", show_symbol = F),
"Missing" = ~ qwraps2::n_perc(T1_SES == "0", na_rm = T, show_denom = "never", show_symbol = F)))
# format as dataframe with n and % in separate columns.
summary_demographics_table <- summary_table(coral_table, summary_demographics) %>%
as.data.frame() %>%
rename("value" = `coral_table (N = 3,208)`) %>%
mutate(across(c(1), str_replace_all, " ", "_"))%>%
mutate(across(c(1), str_replace_all, "[//(//)]", ""))
summary_demographics_table[c('n', '%')] <- str_split_fixed(summary_demographics_table$value, '_', 2)
# write to csv
summary_demographics_table %>% select(!value) %>% write_csv(here("output", "demo_table.csv"))
Mental Flexibility Questionnaire
Omega total is .92 at T1 & T2, and .93 at T3.
coral %>% select(T1_MFQ_1:T1_MFQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.9
## G.6: 0.9
## Omega Hierarchical: 0.88
## Omega H asymptotic: 0.95
## Omega Total 0.92
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T1_MFQ_1 0.82 0.68 0.32 1.00
## T1_MFQ_2 0.80 0.65 0.35 0.99
## T1_MFQ_3 0.75 0.66 1.00 0.00 0.56
## T1_MFQ_4 0.84 0.71 0.29 1.00
## T1_MFQ_5 0.72 0.28 0.60 0.40 0.86
## T1_MFQ_6 0.62 0.42 0.58 0.42 0.68
## T1_MFQ_7 0.86 0.75 0.25 0.97
## T1_MFQ_8 0.34 0.14 0.86 0.80
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.34 0.00 0.30 0.46
##
## general/max 9.38 max/min = Inf
## mean percent general = 0.86 with sd = 0.17 and cv of 0.19
## Explained Common Variance of the general factor = 0.85
##
## The degrees of freedom are 7 and the fit is 0
## The number of observations was 3208 with Chi Square = 15.77 with prob < 0.027
## The root mean square of the residuals is 0
## The df corrected root mean square of the residuals is 0.01
## RMSEA index = 0.02 and the 10 % confidence intervals are 0.006 0.033
## BIC = -40.75
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.13
## The number of observations was 3208 with Chi Square = 416.01 with prob < 9.7e-76
## The root mean square of the residuals is 0.04
## The df corrected root mean square of the residuals is 0.05
##
## RMSEA index = 0.079 and the 10 % confidence intervals are 0.072 0.085
## BIC = 254.54
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.96 0 0.61 0.95
## Multiple R square of scores with factors 0.92 0 0.37 0.90
## Minimum correlation of factor score estimates 0.84 -1 -0.27 0.80
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.92 NA 0.84 0.91
## Omega general for total scores and subscales 0.88 NA 0.78 0.82
## Omega group for total scores and subscales 0.04 NA 0.06 0.09
coral %>% select(T2_MFQ_1:T2_MFQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.9
## G.6: 0.9
## Omega Hierarchical: 0.87
## Omega H asymptotic: 0.94
## Omega Total 0.92
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T2_MFQ_1 0.81 0.69 0.31 0.94
## T2_MFQ_2 0.77 0.63 0.37 0.93
## T2_MFQ_3 0.77 0.55 0.90 0.10 0.66
## T2_MFQ_4 0.81 0.69 0.31 0.96
## T2_MFQ_5 0.69 0.30 0.57 0.43 0.84
## T2_MFQ_6 0.70 0.40 0.64 0.36 0.75
## T2_MFQ_7 0.84 0.75 0.25 0.95
## T2_MFQ_8 0.36 0.16 0.84 0.81
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.31 0.11 0.29 0.34
##
## general/max 12.86 max/min = 3.18
## mean percent general = 0.86 with sd = 0.11 and cv of 0.13
## Explained Common Variance of the general factor = 0.86
##
## The degrees of freedom are 7 and the fit is 0.02
## The number of observations was 3208 with Chi Square = 66.86 with prob < 6.4e-12
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.052 and the 10 % confidence intervals are 0.041 0.063
## BIC = 10.34
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.15
## The number of observations was 3208 with Chi Square = 479.83 with prob < 4.8e-89
## The root mean square of the residuals is 0.04
## The df corrected root mean square of the residuals is 0.05
##
## RMSEA index = 0.085 and the 10 % confidence intervals are 0.078 0.091
## BIC = 318.36
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.95 0.31 0.58 0.79
## Multiple R square of scores with factors 0.89 0.09 0.34 0.63
## Minimum correlation of factor score estimates 0.79 -0.81 -0.33 0.25
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.92 0.88 0.70 0.85
## Omega general for total scores and subscales 0.87 0.84 0.56 0.70
## Omega group for total scores and subscales 0.04 0.04 0.14 0.15
coral %>% select(T3_MFQ_1:T3_MFQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.91
## G.6: 0.91
## Omega Hierarchical: 0.85
## Omega H asymptotic: 0.91
## Omega Total 0.93
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T3_MFQ_1 0.81 0.29 0.74 0.26 0.88
## T3_MFQ_2 0.74 0.60 0.40 0.93
## T3_MFQ_3 0.80 0.60 1.00 0.00 0.64
## T3_MFQ_4 0.81 0.20 0.70 0.30 0.93
## T3_MFQ_5 0.73 0.42 0.71 0.29 0.75
## T3_MFQ_6 0.69 0.36 0.62 0.38 0.78
## T3_MFQ_7 0.83 0.21 0.76 0.24 0.91
## T3_MFQ_8 0.37 0.19 0.81 0.72
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.33 0.20 0.38 0.39
##
## general/max 11.02 max/min = 1.96
## mean percent general = 0.82 with sd = 0.11 and cv of 0.13
## Explained Common Variance of the general factor = 0.82
##
## The degrees of freedom are 7 and the fit is 0.01
## The number of observations was 3208 with Chi Square = 45.07 with prob < 1.3e-07
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.01
## RMSEA index = 0.041 and the 10 % confidence intervals are 0.03 0.053
## BIC = -11.45
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.22
## The number of observations was 3208 with Chi Square = 700.23 with prob < 2e-135
## The root mean square of the residuals is 0.05
## The df corrected root mean square of the residuals is 0.06
##
## RMSEA index = 0.103 and the 10 % confidence intervals are 0.097 0.11
## BIC = 538.76
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.94 0.44 0.64 0.89
## Multiple R square of scores with factors 0.88 0.20 0.41 0.78
## Minimum correlation of factor score estimates 0.76 -0.61 -0.18 0.57
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.93 0.90 0.73 1.00
## Omega general for total scores and subscales 0.85 0.83 0.56 0.64
## Omega group for total scores and subscales 0.05 0.06 0.17 0.36
Intolerance of Uncertainty Short Scale
Omega total is .94 at T1.
coral %>% select(T1_IUS_1:T1_IUS_12) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.92
## G.6: 0.93
## Omega Hierarchical: 0.76
## Omega H asymptotic: 0.81
## Omega Total 0.94
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T1_IUS_1 0.64 0.20 0.36 0.57 0.43 0.71
## T1_IUS_2 0.56 0.46 0.53 0.47 0.59
## T1_IUS_3 0.66 0.23 0.33 0.60 0.40 0.73
## T1_IUS_4 0.57 0.30 0.20 0.46 0.54 0.70
## T1_IUS_5 0.62 0.24 0.48 0.52 0.80
## T1_IUS_6 0.63 0.59 0.75 0.25 0.53
## T1_IUS_7 0.65 0.49 0.67 0.33 0.62
## T1_IUS_8 0.67 0.33 0.58 0.42 0.79
## T1_IUS_9 0.69 0.26 0.58 0.42 0.82
## T1_IUS_10 0.64 0.48 0.65 0.35 0.64
## T1_IUS_11 0.65 0.40 0.58 0.42 0.72
## T1_IUS_12 0.70 0.32 0.26 0.67 0.33 0.74
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.93 1.11 0.52 0.55
##
## general/max 4.44 max/min = 2.12
## mean percent general = 0.7 with sd = 0.09 and cv of 0.13
## Explained Common Variance of the general factor = 0.69
##
## The degrees of freedom are 33 and the fit is 0.11
## The number of observations was 3208 with Chi Square = 352.2 with prob < 4.5e-55
## The root mean square of the residuals is 0.02
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.055 and the 10 % confidence intervals are 0.05 0.06
## BIC = 85.78
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 54 and the fit is 1.01
## The number of observations was 3208 with Chi Square = 3242.29 with prob < 0
## The root mean square of the residuals is 0.11
## The df corrected root mean square of the residuals is 0.12
##
## RMSEA index = 0.136 and the 10 % confidence intervals are 0.132 0.14
## BIC = 2806.32
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.88 0.74 0.56 0.65
## Multiple R square of scores with factors 0.77 0.55 0.32 0.43
## Minimum correlation of factor score estimates 0.54 0.10 -0.36 -0.15
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.94 0.88 0.81 0.76
## Omega general for total scores and subscales 0.76 0.62 0.65 0.55
## Omega group for total scores and subscales 0.10 0.26 0.16 0.21
Patient Health Questionnaire
Omega total is .93 at T1 and .94 at T2 & T3.
coral %>% select(T1_PHQ_1:T1_PHQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.9
## G.6: 0.9
## Omega Hierarchical: 0.81
## Omega H asymptotic: 0.87
## Omega Total 0.93
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T1_PHQ_1 0.74 0.27 0.65 0.35 0.85
## T1_PHQ_2 0.82 0.58 1.00 0.00 0.67
## T1_PHQ_3 0.64 0.35 0.54 0.46 0.76
## T1_PHQ_4 0.70 0.55 0.80 0.20 0.62
## T1_PHQ_5 0.66 0.22 0.21 0.52 0.48 0.83
## T1_PHQ_6 0.73 0.25 0.62 0.38 0.86
## T1_PHQ_7 0.72 0.32 0.63 0.37 0.83
## T1_PHQ_8 0.55 0.35 0.43 0.57 0.71
##
## With eigenvalues of:
## g F1* F2* F3*
## 3.91 0.50 0.35 0.43
##
## general/max 7.9 max/min = 1.42
## mean percent general = 0.77 with sd = 0.09 and cv of 0.12
## Explained Common Variance of the general factor = 0.75
##
## The degrees of freedom are 7 and the fit is 0.01
## The number of observations was 3208 with Chi Square = 32.28 with prob < 3.6e-05
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.01
## RMSEA index = 0.034 and the 10 % confidence intervals are 0.022 0.046
## BIC = -24.24
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.38
## The number of observations was 3208 with Chi Square = 1204.87 with prob < 6.8e-243
## The root mean square of the residuals is 0.08
## The df corrected root mean square of the residuals is 0.09
##
## RMSEA index = 0.136 and the 10 % confidence intervals are 0.129 0.142
## BIC = 1043.4
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.91 0.71 0.56 0.80
## Multiple R square of scores with factors 0.83 0.51 0.31 0.65
## Minimum correlation of factor score estimates 0.66 0.02 -0.37 0.29
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.93 0.81 0.78 0.89
## Omega general for total scores and subscales 0.81 0.62 0.65 0.69
## Omega group for total scores and subscales 0.07 0.19 0.14 0.20
coral %>% select(T2_PHQ_1:T2_PHQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.91
## G.6: 0.91
## Omega Hierarchical: 0.82
## Omega H asymptotic: 0.87
## Omega Total 0.94
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T2_PHQ_1 0.75 0.27 0.66 0.34 0.85
## T2_PHQ_2 0.79 0.61 1.00 0.00 0.63
## T2_PHQ_3 0.64 0.31 0.52 0.48 0.78
## T2_PHQ_4 0.71 0.71 1.00 0.00 0.50
## T2_PHQ_5 0.68 0.24 0.55 0.45 0.84
## T2_PHQ_6 0.73 0.23 0.62 0.38 0.87
## T2_PHQ_7 0.74 0.30 0.64 0.36 0.85
## T2_PHQ_8 0.63 0.32 0.51 0.49 0.79
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.04 0.35 0.64 0.47
##
## general/max 6.33 max/min = 1.84
## mean percent general = 0.76 with sd = 0.13 and cv of 0.17
## Explained Common Variance of the general factor = 0.74
##
## The degrees of freedom are 7 and the fit is 0.02
## The number of observations was 3208 with Chi Square = 71.21 with prob < 8.4e-13
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.053 and the 10 % confidence intervals are 0.043 0.065
## BIC = 14.69
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.47
## The number of observations was 3208 with Chi Square = 1507.52 with prob < 9.7e-308
## The root mean square of the residuals is 0.08
## The df corrected root mean square of the residuals is 0.09
##
## RMSEA index = 0.152 and the 10 % confidence intervals are 0.146 0.159
## BIC = 1346.05
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.91 0.53 0.91 0.84
## Multiple R square of scores with factors 0.83 0.29 0.83 0.71
## Minimum correlation of factor score estimates 0.66 -0.43 0.66 0.43
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.94 0.84 0.85 0.89
## Omega general for total scores and subscales 0.82 0.72 0.54 0.68
## Omega group for total scores and subscales 0.08 0.11 0.31 0.22
coral %>% select(T3_PHQ_1:T3_PHQ_8) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.92
## G.6: 0.92
## Omega Hierarchical: 0.84
## Omega H asymptotic: 0.9
## Omega Total 0.94
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T3_PHQ_1 0.78 0.27 0.69 0.31 0.87
## T3_PHQ_2 0.85 0.53 1.00 0.00 0.72
## T3_PHQ_3 0.65 0.30 0.53 0.47 0.80
## T3_PHQ_4 0.72 0.67 0.97 0.03 0.54
## T3_PHQ_5 0.70 0.22 0.57 0.43 0.86
## T3_PHQ_6 0.76 0.22 0.64 0.36 0.90
## T3_PHQ_7 0.77 0.28 0.67 0.33 0.88
## T3_PHQ_8 0.60 0.28 0.45 0.55 0.81
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.27 0.28 0.59 0.37
##
## general/max 7.28 max/min = 2.08
## mean percent general = 0.8 with sd = 0.12 and cv of 0.15
## Explained Common Variance of the general factor = 0.77
##
## The degrees of freedom are 7 and the fit is 0.02
## The number of observations was 3208 with Chi Square = 57.82 with prob < 4.1e-10
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.048 and the 10 % confidence intervals are 0.037 0.059
## BIC = 1.3
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20 and the fit is 0.42
## The number of observations was 3208 with Chi Square = 1360.08 with prob < 4e-276
## The root mean square of the residuals is 0.07
## The df corrected root mean square of the residuals is 0.08
##
## RMSEA index = 0.145 and the 10 % confidence intervals are 0.138 0.151
## BIC = 1198.61
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.93 0.52 0.89 0.80
## Multiple R square of scores with factors 0.86 0.27 0.80 0.64
## Minimum correlation of factor score estimates 0.71 -0.46 0.60 0.28
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.94 0.84 0.85 0.91
## Omega general for total scores and subscales 0.84 0.75 0.56 0.73
## Omega group for total scores and subscales 0.06 0.09 0.28 0.18
General Anxiety Disorder Omega total is 0.96 at T1 & T3, and 0.95 at T2.
coral %>% select(T1_GAD_1:T1_GAD_7) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.93
## G.6: 0.93
## Omega Hierarchical: 0.77
## Omega H asymptotic: 0.8
## Omega Total 0.96
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T1_GAD_1 0.75 0.42 0.76 0.24 0.74
## T1_GAD_2 0.79 0.54 0.92 0.08 0.67
## T1_GAD_3 0.77 0.50 0.85 0.15 0.70
## T1_GAD_4 0.76 0.30 0.72 0.28 0.80
## T1_GAD_5 0.76 0.65 1.00 0.00 0.58
## T1_GAD_6 0.65 0.20 0.29 0.56 0.44 0.76
## T1_GAD_7 0.70 0.39 0.65 0.35 0.76
##
## With eigenvalues of:
## g F1* F2* F3*
## 3.85 1.01 0.45 0.15
##
## general/max 3.8 max/min = 6.86
## mean percent general = 0.72 with sd = 0.07 and cv of 0.1
## Explained Common Variance of the general factor = 0.7
##
## The degrees of freedom are 3 and the fit is 0.01
## The number of observations was 3208 with Chi Square = 19.75 with prob < 0.00019
## The root mean square of the residuals is 0
## The df corrected root mean square of the residuals is 0.01
## RMSEA index = 0.042 and the 10 % confidence intervals are 0.025 0.06
## BIC = -4.47
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 14 and the fit is 0.96
## The number of observations was 3208 with Chi Square = 3088.24 with prob < 0
## The root mean square of the residuals is 0.14
## The df corrected root mean square of the residuals is 0.18
##
## RMSEA index = 0.262 and the 10 % confidence intervals are 0.254 0.269
## BIC = 2975.22
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.89 0.69 0.84 0.57
## Multiple R square of scores with factors 0.79 0.47 0.70 0.32
## Minimum correlation of factor score estimates 0.58 -0.05 0.40 -0.35
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.96 0.94 1.00 0.51
## Omega general for total scores and subscales 0.77 0.71 0.57 0.43
## Omega group for total scores and subscales 0.15 0.23 0.42 0.09
coral %>% select(T2_GAD_1:T2_GAD_7) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.93
## G.6: 0.93
## Omega Hierarchical: 0.78
## Omega H asymptotic: 0.82
## Omega Total 0.95
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T2_GAD_1 0.76 0.38 0.75 0.25 0.77
## T2_GAD_2 0.81 0.52 0.93 0.07 0.70
## T2_GAD_3 0.79 0.47 0.85 0.15 0.73
## T2_GAD_4 0.76 0.25 0.24 0.72 0.28 0.81
## T2_GAD_5 0.74 0.66 1.00 0.00 0.56
## T2_GAD_6 0.65 0.26 0.53 0.47 0.78
## T2_GAD_7 0.70 0.36 0.63 0.37 0.79
##
## With eigenvalues of:
## g F1* F2* F3*
## 3.90 0.86 0.48 0.16
##
## general/max 4.56 max/min = 5.49
## mean percent general = 0.73 with sd = 0.09 and cv of 0.12
## Explained Common Variance of the general factor = 0.72
##
## The degrees of freedom are 3 and the fit is 0.01
## The number of observations was 3208 with Chi Square = 23.77 with prob < 2.8e-05
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.01
## RMSEA index = 0.046 and the 10 % confidence intervals are 0.03 0.065
## BIC = -0.45
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 14 and the fit is 0.84
## The number of observations was 3208 with Chi Square = 2685.36 with prob < 0
## The root mean square of the residuals is 0.12
## The df corrected root mean square of the residuals is 0.15
##
## RMSEA index = 0.244 and the 10 % confidence intervals are 0.236 0.252
## BIC = 2572.33
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.89 0.66 0.86 0.58
## Multiple R square of scores with factors 0.80 0.44 0.74 0.34
## Minimum correlation of factor score estimates 0.60 -0.13 0.47 -0.32
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.95 0.94 1.00 0.49
## Omega general for total scores and subscales 0.78 0.74 0.55 0.42
## Omega group for total scores and subscales 0.13 0.20 0.44 0.07
coral %>% select(T3_GAD_1:T3_GAD_7) %>% omega()
## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.93
## G.6: 0.93
## Omega Hierarchical: 0.9
## Omega H asymptotic: 0.94
## Omega Total 0.96
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## T3_GAD_1 0.88 0.80 0.20 0.98
## T3_GAD_2 0.85 0.51 0.98 0.02 0.73
## T3_GAD_3 0.87 0.27 0.82 0.18 0.91
## T3_GAD_4 0.88 0.77 0.23 1.00
## T3_GAD_5 0.69 0.72 1.00 0.00 0.48
## T3_GAD_6 0.74 0.55 0.45 0.99
## T3_GAD_7 0.71 0.22 0.56 0.44 0.90
##
## With eigenvalues of:
## g F1* F2* F3*
## 4.54 0.40 0.00 0.54
##
## general/max 8.35 max/min = Inf
## mean percent general = 0.86 with sd = 0.19 and cv of 0.22
## Explained Common Variance of the general factor = 0.83
##
## The degrees of freedom are 3 and the fit is 0.02
## The number of observations was 3208 with Chi Square = 59.1 with prob < 9.1e-13
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.076 and the 10 % confidence intervals are 0.06 0.094
## BIC = 34.88
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 14 and the fit is 0.42
## The number of observations was 3208 with Chi Square = 1348.28 with prob < 2.2e-279
## The root mean square of the residuals is 0.05
## The df corrected root mean square of the residuals is 0.06
##
## RMSEA index = 0.172 and the 10 % confidence intervals are 0.165 0.18
## BIC = 1235.26
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.96 0.88 0 0.97
## Multiple R square of scores with factors 0.92 0.77 0 0.93
## Minimum correlation of factor score estimates 0.84 0.53 -1 0.86
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.96 0.93 NA 0.90
## Omega general for total scores and subscales 0.90 0.84 NA 0.79
## Omega group for total scores and subscales 0.06 0.10 NA 0.11
Kurtosis and skew
Looking for acceptable values between -/+ 3. All acceptable.
describe(study1$T1_PHQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 2366 9.35 6.32 8 8.95 7.41 0 24 24 0.46 -0.75 0.13
describe(study1$T2_PHQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 844 8.07 6.3 7 7.43 5.93 0 24 24 0.78 -0.26 0.22
describe(study1$T3_PHQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 770 8.52 6.42 7 7.95 5.93 0 24 24 0.66 -0.51 0.23
hist(study1$T1_PHQ)
hist(study1$T2_PHQ)
hist(study1$T3_PHQ)
describe(study1$T1_GAD)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 2352 8.14 6.18 7 7.69 7.41 0 21 21 0.52 -0.85 0.13
describe(study1$T2_GAD)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 841 6.75 5.87 5 6.1 5.93 0 21 21 0.78 -0.4 0.2
describe(study1$T3_GAD)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 770 7.41 6.07 6 6.81 5.93 0 21 21 0.69 -0.53 0.22
hist(study1$T1_GAD)
hist(study1$T2_GAD)
hist(study1$T3_GAD)
describe(study1$T1_IUS)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 2304 35.43 10.38 35 35.27 10.38 12 60 48 0.12 -0.45 0.22
hist(study1$T1_IUS)
describe(study1$T1_MFQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 2153 33.47 7.54 34 33.89 7.41 8 48 40 -0.55 0.23 0.16
describe(study1$T2_MFQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 818 33.82 7.52 35 34.22 7.41 8 48 40 -0.53 0.04 0.26
describe(study1$T3_MFQ)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 747 33.11 7.74 34 33.59 7.41 8 48 40 -0.57 0.02 0.28
hist(study1$T1_MFQ)
hist(study1$T2_MFQ)
hist(study1$T3_MFQ)
Select relevant variables and filter those who did not report age
h1 <- study1 %>%
select(age:T1_MFQ, T1_covid) %>%
filter(!is.na(age_group))
Age group predicts intolerance of uncertainty. Significant linear and quadratic relationship. Younger age associated with higher intolerance of uncertainty. And intolerance of uncertainty peaked in late adolescence and decreased into adulthood. Hypothesis partially supported (would just have expected adolescents to have lower intolerance of uncertainty than emerging adults and adults).
h1$age_group2 <- h1$age_group^2
m1 <- lm(T1_IUS ~ age_group + age_group2 + T1_covid, data = h1)
summary(m1)
##
## Call:
## lm(formula = T1_IUS ~ age_group + age_group2 + T1_covid, data = h1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.0850 -6.8998 0.0604 6.9069 29.5784
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36.7015 1.6200 22.655 < 2e-16 ***
## age_group 3.5505 1.2731 2.789 0.00533 **
## age_group2 -1.3178 0.2467 -5.341 1.02e-07 ***
## T1_covid 0.3016 0.1323 2.279 0.02278 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.01 on 2276 degrees of freedom
## (888 observations deleted due to missingness)
## Multiple R-squared: 0.06509, Adjusted R-squared: 0.06385
## F-statistic: 52.82 on 3 and 2276 DF, p-value: < 2.2e-16
# linear-quadratic model is best
m1_linear <- lm(T1_IUS ~ age_group + T1_covid, data = h1)
AIC(m1, m1_linear)
## df AIC
## m1 5 16981.11
## m1_linear 4 17007.50
Formal model comparison: also says that linear-quadratic model is best
anova(m1_linear, m1)
## Analysis of Variance Table
##
## Model 1: T1_IUS ~ age_group + T1_covid
## Model 2: T1_IUS ~ age_group + age_group2 + T1_covid
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 2277 230954
## 2 2276 228096 1 2858.6 28.523 1.018e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tab_model(m1, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ")
| T 1 IUS | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 36.70 | 1.62 | 33.52, 39.88 | 22.66 | <0.001 |
| age group | 3.55 | 1.27 | 1.05, 6.05 | 2.79 | 0.005 |
| age group2 | -1.32 | 0.25 | -1.80, -0.83 | -5.34 | <0.001 |
| T1 covid | 0.30 | 0.13 | 0.04, 0.56 | 2.28 | 0.023 |
| Observations | 2280 | ||||
| R2 / R2 adjusted | 0.065 / 0.064 | ||||
Age group predicts psychological flexibility. Significant linear relationship, such that psychological flexibility increases with increasing age.
m2 <- lm(T1_MFQ ~ age_group + T1_covid, data = h1)
summary(m2)
##
## Call:
## lm(formula = T1_MFQ ~ age_group + T1_covid, data = h1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.792 -4.579 1.087 5.208 18.637
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 27.6343 0.6384 43.289 <2e-16 ***
## age_group 2.0524 0.2118 9.692 <2e-16 ***
## T1_covid -0.1617 0.1015 -1.593 0.111
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.361 on 2127 degrees of freedom
## (1038 observations deleted due to missingness)
## Multiple R-squared: 0.04341, Adjusted R-squared: 0.04251
## F-statistic: 48.27 on 2 and 2127 DF, p-value: < 2.2e-16
tab_model(m2, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ")
| T 1 MFQ | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 27.63 | 0.64 | 26.38, 28.89 | 43.29 | <0.001 |
| age group | 2.05 | 0.21 | 1.64, 2.47 | 9.69 | <0.001 |
| T1 covid | -0.16 | 0.10 | -0.36, 0.04 | -1.59 | 0.111 |
| Observations | 2130 | ||||
| R2 / R2 adjusted | 0.043 / 0.043 | ||||
Select relevant variables and filter those who did not report age
Select variables for examining cross-sectional associations with DV = dep and DV = anx.
h2_t1 <- study1 %>%
select(age:T1_MFQ, T1_PHQ, T1_GAD, T1_covid) %>%
filter(!is.na(age_group))
Intolerance of uncertainty
No evidence to suggest that the effect of age group on depression at T1 is partially accounted for by intolerance of uncertainty at T1.
m3 <- lm(T1_PHQ ~ age_group * T1_IUS + T1_covid, data = h2_t1)
summary(m3)
##
## Call:
## lm(formula = T1_PHQ ~ age_group * T1_IUS + T1_covid, data = h2_t1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.6625 -3.7049 -0.6286 3.3515 21.9562
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.43385 1.56859 1.552 0.1209
## age_group -1.31212 0.50968 -2.574 0.0101 *
## T1_IUS 0.33285 0.04049 8.220 3.38e-16 ***
## T1_covid 0.16696 0.06839 2.441 0.0147 *
## age_group:T1_IUS -0.01244 0.01353 -0.919 0.3580
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.169 on 2274 degrees of freedom
## (889 observations deleted due to missingness)
## Multiple R-squared: 0.332, Adjusted R-squared: 0.3308
## F-statistic: 282.5 on 4 and 2274 DF, p-value: < 2.2e-16
tab_model(m3, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| T 1 PHQ | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 2.43 | 1.57 | -1.08, 5.95 | 1.55 | 0.121 |
| age group | -1.31 | 0.51 | -2.46, -0.17 | -2.57 | 0.010 |
| T1 IUS | 0.33 | 0.04 | 0.24, 0.42 | 8.22 | <0.001 |
| T1 covid | 0.17 | 0.07 | 0.01, 0.32 | 2.44 | 0.015 |
| age group * T1 IUS | -0.01 | 0.01 | -0.04, 0.02 | -0.92 | 0.358 |
| Observations | 2279 | ||||
| R2 / R2 adjusted | 0.332 / 0.331 | ||||
Psychological flexibility
No evidence to suggest that the effect of age group on depression at T1 is partially accounted for by psychological flexibility at T1.
m4 <- lm(T1_PHQ ~ age_group * T1_MFQ + T1_covid, data = h2_t1)
summary(m4)
##
## Call:
## lm(formula = T1_PHQ ~ age_group * T1_MFQ + T1_covid, data = h2_t1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -15.8819 -3.4626 -0.4936 3.1014 21.8551
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 26.87897 1.77764 15.121 < 2e-16 ***
## age_group -0.72910 0.61307 -1.189 0.23447
## T1_MFQ -0.37788 0.05412 -6.982 3.87e-12 ***
## T1_covid 0.18029 0.06739 2.675 0.00752 **
## age_group:T1_MFQ -0.03062 0.01827 -1.676 0.09393 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.883 on 2124 degrees of freedom
## (1039 observations deleted due to missingness)
## Multiple R-squared: 0.4022, Adjusted R-squared: 0.4011
## F-statistic: 357.2 on 4 and 2124 DF, p-value: < 2.2e-16
tab_model(m4, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| T 1 PHQ | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 26.88 | 1.78 | 22.89, 30.87 | 15.12 | <0.001 |
| age group | -0.73 | 0.61 | -2.10, 0.65 | -1.19 | 0.234 |
| T1 MFQ | -0.38 | 0.05 | -0.50, -0.26 | -6.98 | <0.001 |
| T1 covid | 0.18 | 0.07 | 0.03, 0.33 | 2.68 | 0.008 |
| age group * T1 MFQ | -0.03 | 0.02 | -0.07, 0.01 | -1.68 | 0.094 |
| Observations | 2129 | ||||
| R2 / R2 adjusted | 0.402 / 0.401 | ||||
Filter those who did not report age
h2_longitudinal <- study1_long %>%
filter(!is.na(age_group))
Intolerance of uncertainty
No evidence to suggest that the effect of age group on depression across time (T1-T3) is partially accounted for by intolerance of uncertainty at T1.
m5 <- lmer(PHQ ~ time + T1_IUS*age_group + (1|ID) + covid, data = h2_longitudinal, REML = FALSE)
summary(m5)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: PHQ ~ time + T1_IUS * age_group + (1 | ID) + covid
## Data: h2_longitudinal
##
## AIC BIC logLik deviance df.resid
## 22631.9 22681.9 -11308.0 22615.9 3799
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4953 -0.4721 -0.0843 0.4386 3.8607
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 17.55 4.189
## Residual 10.36 3.218
## Number of obs: 3807, groups: ID, 2254
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 2.62833 1.50828 1.743
## time -0.36060 0.07664 -4.705
## T1_IUS 0.33516 0.03893 8.610
## age_group -1.11862 0.48761 -2.294
## covid 0.12398 0.04725 2.624
## T1_IUS:age_group -0.01744 0.01296 -1.345
##
## Correlation of Fixed Effects:
## (Intr) time T1_IUS ag_grp covid
## time -0.049
## T1_IUS -0.959 -0.012
## age_group -0.966 -0.023 0.942
## covid -0.007 -0.178 -0.001 0.000
## T1_IUS:g_gr 0.912 0.015 -0.965 -0.958 -0.007
parameters::model_parameters(m5, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## -----------------------------------------------------------------------------------
## (Intercept) | 2.63 | 1.51 | [-0.33, 5.59] | 1.74 | 2353.88 | 0.082
## time | -0.36 | 0.08 | [-0.51, -0.21] | -4.71 | 2037.19 | < .001
## T1 IUS | 0.34 | 0.04 | [ 0.26, 0.41] | 8.61 | 2346.57 | < .001
## age group | -1.12 | 0.49 | [-2.07, -0.16] | -2.29 | 2323.74 | 0.022
## covid | 0.12 | 0.05 | [ 0.03, 0.22] | 2.62 | 3681.36 | 0.009
## T1 IUS * age group | -0.02 | 0.01 | [-0.04, 0.01] | -1.35 | 2335.60 | 0.179
sjstats::r2(m5)
## # R2 for Mixed Models
##
## Conditional R2: 0.743
## Marginal R2: 0.307
tab_model(m5, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| PHQ | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 2.63 | 1.51 | -0.75, 6.01 | 1.74 | 0.081 |
| time | -0.36 | 0.08 | -0.53, -0.19 | -4.71 | <0.001 |
| T1 IUS | 0.34 | 0.04 | 0.25, 0.42 | 8.61 | <0.001 |
| age group | -1.12 | 0.49 | -2.21, -0.03 | -2.29 | 0.022 |
| covid | 0.12 | 0.05 | 0.02, 0.23 | 2.62 | 0.009 |
| T1 IUS * age group | -0.02 | 0.01 | -0.05, 0.01 | -1.35 | 0.179 |
| Random Effects | |||||
| σ2 | 10.36 | ||||
| τ00 ID | 17.55 | ||||
| ICC | 0.63 | ||||
| N ID | 2254 | ||||
| Observations | 3807 | ||||
| Marginal R2 / Conditional R2 | 0.307 / 0.743 | ||||
Psychological flexibility
No evidence to suggest that the effect of age group on depression across time (T1-T3) is partially accounted for by psychological flexibility across time (T1-T3).
m6 <- lmer(PHQ ~ time + MFQ*age_group + (1|ID) + covid, data = h2_longitudinal, REML = FALSE)
summary(m6)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: PHQ ~ time + MFQ * age_group + (1 | ID) + covid
## Data: h2_longitudinal
##
## AIC BIC logLik deviance df.resid
## 21504.8 21554.5 -10744.4 21488.8 3673
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.1889 -0.4901 -0.0766 0.4593 4.3113
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 14.15 3.762
## Residual 10.07 3.173
## Number of obs: 3681, groups: ID, 2192
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 26.96647 1.35931 19.838
## time -0.42560 0.07592 -5.606
## MFQ -0.36576 0.04143 -8.828
## age_group -1.33059 0.46628 -2.854
## covid 0.14825 0.04599 3.224
## MFQ:age_group -0.01391 0.01396 -0.996
##
## Correlation of Fixed Effects:
## (Intr) time MFQ ag_grp covid
## time -0.104
## MFQ -0.957 0.031
## age_group -0.956 0.021 0.913
## covid -0.009 -0.177 0.000 -0.010
## MFQ:age_grp 0.932 -0.026 -0.964 -0.962 0.004
parameters::model_parameters(m6, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## --------------------------------------------------------------------------------
## (Intercept) | 26.97 | 1.36 | [24.30, 29.63] | 19.84 | 3469.00 | < .001
## time | -0.43 | 0.08 | [-0.57, -0.28] | -5.61 | 2019.77 | < .001
## MFQ | -0.37 | 0.04 | [-0.45, -0.28] | -8.83 | 3502.22 | < .001
## age group | -1.33 | 0.47 | [-2.24, -0.42] | -2.85 | 3463.84 | 0.004
## covid | 0.15 | 0.05 | [ 0.06, 0.24] | 3.22 | 3634.26 | 0.001
## MFQ * age group | -0.01 | 0.01 | [-0.04, 0.01] | -1.00 | 3505.58 | 0.319
sjstats::r2(m6)
## # R2 for Mixed Models
##
## Conditional R2: 0.732
## Marginal R2: 0.355
tab_model(m6, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| PHQ | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 26.97 | 1.36 | 23.92, 30.01 | 19.84 | <0.001 |
| time | -0.43 | 0.08 | -0.60, -0.26 | -5.61 | <0.001 |
| MFQ | -0.37 | 0.04 | -0.46, -0.27 | -8.83 | <0.001 |
| age group | -1.33 | 0.47 | -2.38, -0.29 | -2.85 | 0.004 |
| covid | 0.15 | 0.05 | 0.05, 0.25 | 3.22 | 0.001 |
| MFQ * age group | -0.01 | 0.01 | -0.05, 0.02 | -1.00 | 0.319 |
| Random Effects | |||||
| σ2 | 10.07 | ||||
| τ00 ID | 14.15 | ||||
| ICC | 0.58 | ||||
| N ID | 2192 | ||||
| Observations | 3681 | ||||
| Marginal R2 / Conditional R2 | 0.355 / 0.732 | ||||
Intolerance of uncertainty
No evidence to suggest that the effect of age group on anxiety at T1 is partially accounted for by intolerance of uncertainty at T1.
m7 <- lm(T1_GAD ~ age_group * T1_IUS + T1_covid, data = h2_t1)
summary(m7)
##
## Call:
## lm(formula = T1_GAD ~ age_group * T1_IUS + T1_covid, data = h2_t1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.0249 -3.4384 -0.5225 3.2259 21.0156
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.775054 1.480223 -0.524 0.60060
## age_group -1.084026 0.480946 -2.254 0.02429 *
## T1_IUS 0.343015 0.038212 8.977 < 2e-16 ***
## T1_covid 0.195958 0.064582 3.034 0.00244 **
## age_group:T1_IUS -0.002906 0.012771 -0.228 0.82002
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.877 on 2273 degrees of freedom
## (890 observations deleted due to missingness)
## Multiple R-squared: 0.3779, Adjusted R-squared: 0.3768
## F-statistic: 345.1 on 4 and 2273 DF, p-value: < 2.2e-16
tab_model(m7, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| T 1 GAD | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | -0.78 | 1.48 | -4.10, 2.54 | -0.52 | 0.601 |
| age group | -1.08 | 0.48 | -2.16, -0.01 | -2.25 | 0.024 |
| T1 IUS | 0.34 | 0.04 | 0.26, 0.43 | 8.98 | <0.001 |
| T1 covid | 0.20 | 0.06 | 0.05, 0.34 | 3.03 | 0.002 |
| age group * T1 IUS | -0.00 | 0.01 | -0.03, 0.03 | -0.23 | 0.820 |
| Observations | 2278 | ||||
| R2 / R2 adjusted | 0.378 / 0.377 | ||||
Psychological flexibility
Effect of age group on anxiety at T1 is partially accounted for by psychological flexibility at T1.
m8 <- lm(T1_GAD ~ age_group * T1_MFQ + T1_covid, data = h2_t1)
summary(m8)
##
## Call:
## lm(formula = T1_GAD ~ age_group * T1_MFQ + T1_covid, data = h2_t1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -13.210 -3.393 -0.624 2.956 20.248
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 22.91227 1.71900 13.329 < 2e-16 ***
## age_group 0.39381 0.59283 0.664 0.50658
## T1_MFQ -0.33739 0.05234 -6.447 1.41e-10 ***
## T1_covid 0.18321 0.06522 2.809 0.00501 **
## age_group:T1_MFQ -0.04963 0.01767 -2.809 0.00501 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.721 on 2123 degrees of freedom
## (1040 observations deleted due to missingness)
## Multiple R-squared: 0.4099, Adjusted R-squared: 0.4088
## F-statistic: 368.7 on 4 and 2123 DF, p-value: < 2.2e-16
To further examine the significant interaction, look at effect of psychological flexibility on anxiety in each age group separately.
For adolescents, significant effect of psychological flexibility on anxiety.
h2_t1_adolescents <- h2_t1 %>% filter(age_group == 1)
m8_adols <- lm(T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_adolescents)
summary(m8_adols)
##
## Call:
## lm(formula = T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_adolescents)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.7574 -3.8087 0.1249 3.6895 10.4768
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.05364 1.53571 15.012 < 2e-16 ***
## T1_MFQ -0.41203 0.04874 -8.454 1.23e-14 ***
## T1_covid 0.48477 0.22052 2.198 0.0293 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.913 on 170 degrees of freedom
## (171 observations deleted due to missingness)
## Multiple R-squared: 0.3119, Adjusted R-squared: 0.3038
## F-statistic: 38.53 on 2 and 170 DF, p-value: 1.584e-14
confint(m8_adols, level=0.975)
## 1.25 % 98.75 %
## (Intercept) 19.58074962 26.5265397
## T1_MFQ -0.52223868 -0.3018143
## T1_covid -0.01392341 0.9834653
For emerging adults, significant effect of psychological flexibility on anxiety.
h2_t1_emerging_adults <- h2_t1 %>% filter(age_group == 2)
m8_emerging <- lm(T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_emerging_adults)
summary(m8_emerging)
##
## Call:
## lm(formula = T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_emerging_adults)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.9809 -3.5179 -0.6301 2.9145 16.1477
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.34714 1.58137 14.764 < 2e-16 ***
## T1_MFQ -0.39870 0.04826 -8.261 1.81e-14 ***
## T1_covid 0.06973 0.26791 0.260 0.795
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.338 on 204 degrees of freedom
## (127 observations deleted due to missingness)
## Multiple R-squared: 0.2508, Adjusted R-squared: 0.2435
## F-statistic: 34.15 on 2 and 204 DF, p-value: 1.616e-13
confint(m8_emerging, level=0.975)
## 1.25 % 98.75 %
## (Intercept) 19.7763017 26.9179686
## T1_MFQ -0.5076847 -0.2897163
## T1_covid -0.5352336 0.6746925
For adults, significant effect of psychological flexibility on anxiety.
h2_t1_adults <- h2_t1 %>% filter(age_group == 3)
m8_adults <- lm(T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_adults)
summary(m8_adults)
##
## Call:
## lm(formula = T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_adults)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.6159 -3.5497 -0.6061 2.9597 20.3637
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 24.45555 0.58284 41.959 <2e-16 ***
## T1_MFQ -0.49624 0.01687 -29.418 <2e-16 ***
## T1_covid 0.20015 0.08299 2.412 0.016 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.71 on 1413 degrees of freedom
## (613 observations deleted due to missingness)
## Multiple R-squared: 0.3835, Adjusted R-squared: 0.3826
## F-statistic: 439.4 on 2 and 1413 DF, p-value: < 2.2e-16
confint(m8_adults, level=0.975)
## 1.25 % 98.75 %
## (Intercept) 23.14777688 25.7633217
## T1_MFQ -0.53408410 -0.4583865
## T1_covid 0.01393958 0.3863573
For older adults, significant effect of psychological flexibility on anxiety.
h2_t1_older_adults <- h2_t1 %>% filter(age_group == 4)
m8_older <- lm(T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_older_adults)
summary(m8_older)
##
## Call:
## lm(formula = T1_GAD ~ T1_MFQ + T1_covid, data = h2_t1_older_adults)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.8976 -3.0059 -0.6408 2.0484 15.9874
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 22.45228 1.28980 17.408 <2e-16 ***
## T1_MFQ -0.48562 0.03459 -14.038 <2e-16 ***
## T1_covid 0.08540 0.12448 0.686 0.493
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.157 on 329 degrees of freedom
## (129 observations deleted due to missingness)
## Multiple R-squared: 0.3768, Adjusted R-squared: 0.373
## F-statistic: 99.46 on 2 and 329 DF, p-value: < 2.2e-16
confint(m8_older, level=0.975)
## 1.25 % 98.75 %
## (Intercept) 19.5480222 25.3565399
## T1_MFQ -0.5635177 -0.4077247
## T1_covid -0.1948986 0.3657024
(Unstandardised) estimates for each age group were as follows: Adolescents = -0.41, emerging adults = -0.40, adults = -0.50, older adults = -0.49. The negative association between psychological flexibility and anxiety is stronger in older people compared to younger people.
tab_model(m8, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| T 1 GAD | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 22.91 | 1.72 | 19.06, 26.77 | 13.33 | <0.001 |
| age group | 0.39 | 0.59 | -0.94, 1.72 | 0.66 | 0.507 |
| T1 MFQ | -0.34 | 0.05 | -0.45, -0.22 | -6.45 | <0.001 |
| T1 covid | 0.18 | 0.07 | 0.04, 0.33 | 2.81 | 0.005 |
| age group * T1 MFQ | -0.05 | 0.02 | -0.09, -0.01 | -2.81 | 0.005 |
| Observations | 2128 | ||||
| R2 / R2 adjusted | 0.410 / 0.409 | ||||
Intolerance of uncertainty
No evidence to suggest that the effect of age group on anxiety across time (T1-T3) is partially accounted for by intolerance of uncertainty at T1.
m9 <- lmer(GAD ~ time + T1_IUS*age_group + (1|ID) + covid, data = h2_longitudinal, REML = FALSE)
summary(m9)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: GAD ~ time + T1_IUS * age_group + (1 | ID) + covid
## Data: h2_longitudinal
##
## AIC BIC logLik deviance df.resid
## 22195.7 22245.6 -11089.8 22179.7 3796
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5725 -0.4678 -0.0727 0.4641 3.4425
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 14.821 3.85
## Residual 9.669 3.11
## Number of obs: 3804, groups: ID, 2254
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) -0.13486 1.40756 -0.096
## time -0.31531 0.07378 -4.274
## T1_IUS 0.33499 0.03633 9.221
## age_group -0.97690 0.45493 -2.147
## covid 0.15168 0.04504 3.368
## T1_IUS:age_group -0.00667 0.01209 -0.551
##
## Correlation of Fixed Effects:
## (Intr) time T1_IUS ag_grp covid
## time -0.051
## T1_IUS -0.959 -0.013
## age_group -0.965 -0.024 0.942
## covid -0.008 -0.177 -0.001 0.001
## T1_IUS:g_gr 0.912 0.016 -0.965 -0.958 -0.008
parameters::model_parameters(m9, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## -----------------------------------------------------------------------------------
## (Intercept) | -0.13 | 1.41 | [-2.90, 2.63] | -0.10 | 2327.05 | 0.924
## time | -0.32 | 0.07 | [-0.46, -0.17] | -4.27 | 2053.08 | < .001
## T1 IUS | 0.33 | 0.04 | [ 0.26, 0.41] | 9.22 | 2320.09 | < .001
## age group | -0.98 | 0.45 | [-1.87, -0.08] | -2.15 | 2293.21 | 0.032
## covid | 0.15 | 0.05 | [ 0.06, 0.24] | 3.37 | 3729.13 | < .001
## T1 IUS * age group | -6.67e-03 | 0.01 | [-0.03, 0.02] | -0.55 | 2305.84 | 0.581
sjstats::r2(m9)
## # R2 for Mixed Models
##
## Conditional R2: 0.742
## Marginal R2: 0.346
tab_model(m9, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| GAD | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | -0.13 | 1.41 | -3.29, 3.02 | -0.10 | 0.924 |
| time | -0.32 | 0.07 | -0.48, -0.15 | -4.27 | <0.001 |
| T1 IUS | 0.33 | 0.04 | 0.25, 0.42 | 9.22 | <0.001 |
| age group | -0.98 | 0.45 | -2.00, 0.04 | -2.15 | 0.032 |
| covid | 0.15 | 0.05 | 0.05, 0.25 | 3.37 | 0.001 |
| T1 IUS * age group | -0.01 | 0.01 | -0.03, 0.02 | -0.55 | 0.581 |
| Random Effects | |||||
| σ2 | 9.67 | ||||
| τ00 ID | 14.82 | ||||
| ICC | 0.61 | ||||
| N ID | 2254 | ||||
| Observations | 3804 | ||||
| Marginal R2 / Conditional R2 | 0.346 / 0.742 | ||||
Psychological flexibility
The effect of age group on anxiety across time (T1-T3) is partially accounted for by psychological flexibility across time (T1-T3).
m10 <- lmer(GAD ~ time + MFQ*age_group + (1|ID) + covid, data = h2_longitudinal, REML = FALSE)
parameters::model_parameters(m10, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## --------------------------------------------------------------------------------
## (Intercept) | 22.31 | 1.31 | [19.75, 24.87] | 17.06 | 3446.90 | < .001
## time | -0.38 | 0.07 | [-0.52, -0.24] | -5.18 | 1991.09 | < .001
## MFQ | -0.30 | 0.04 | [-0.37, -0.22] | -7.43 | 3481.62 | < .001
## age group | -0.27 | 0.45 | [-1.15, 0.61] | -0.60 | 3440.36 | 0.549
## covid | 0.16 | 0.04 | [ 0.07, 0.25] | 3.63 | 3643.33 | < .001
## MFQ * age group | -0.03 | 0.01 | [-0.06, -0.01] | -2.58 | 3485.00 | 0.010
sjstats::r2(m10)
## # R2 for Mixed Models
##
## Conditional R2: 0.722
## Marginal R2: 0.344
tab_model(m10, use.viewer = FALSE, show.stat = TRUE, show.se = TRUE, ci.hyphen = ", ", show.ci = .975)
| GAD | |||||
|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | CI | Statistic | p |
| (Intercept) | 22.31 | 1.31 | 19.38, 25.24 | 17.06 | <0.001 |
| time | -0.38 | 0.07 | -0.54, -0.22 | -5.18 | <0.001 |
| MFQ | -0.30 | 0.04 | -0.39, -0.21 | -7.43 | <0.001 |
| age group | -0.27 | 0.45 | -1.27, 0.74 | -0.60 | 0.549 |
| covid | 0.16 | 0.04 | 0.06, 0.26 | 3.63 | <0.001 |
| MFQ * age group | -0.03 | 0.01 | -0.06, -0.00 | -2.58 | 0.010 |
| Random Effects | |||||
| σ2 | 9.46 | ||||
| τ00 ID | 12.88 | ||||
| ICC | 0.58 | ||||
| N ID | 2192 | ||||
| Observations | 3682 | ||||
| Marginal R2 / Conditional R2 | 0.344 / 0.722 | ||||
To further examine the significant interaction, look at effect of psychological flexibility on anxiety in each age group separately. For adolescents, significant effect of psychological flexibility across time on anxiety across time.
h2_longitudinal_adolescents <- h2_longitudinal %>% filter(age_group == 1)
m10_adols <- lmer(GAD ~ time + MFQ + (1|ID) + covid, data = h2_longitudinal_adolescents, REML = FALSE)
parameters::model_parameters(m10_adols, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## ---------------------------------------------------------------------------
## (Intercept) | 21.72 | 1.33 | [19.10, 24.33] | 16.34 | 306.24 | < .001
## time | -0.34 | 0.30 | [-0.93, 0.26] | -1.11 | 190.38 | 0.267
## MFQ | -0.36 | 0.04 | [-0.44, -0.29] | -9.45 | 288.73 | < .001
## covid | 0.58 | 0.19 | [ 0.21, 0.96] | 3.07 | 295.56 | 0.002
sjstats::r2(m10_adols)
## # R2 for Mixed Models
##
## Conditional R2: 0.604
## Marginal R2: 0.258
confint(m10_adols, level=0.975)
## 1.25 % 98.75 %
## .sig01 2.5605557 4.2857757
## .sigma 3.1894021 4.3129900
## (Intercept) 18.5820042 24.8176804
## time -1.0167675 0.3489636
## MFQ -0.4510299 -0.2673915
## covid 0.1535290 1.0121019
For emerging adults, significant effect of psychological flexibility across time on anxiety across time.
h2_longitudinal_emerging_adults <- h2_longitudinal %>% filter(age_group == 2)
m10_emerging <- lmer(GAD ~ time + MFQ + (1|ID) + covid, data = h2_longitudinal_emerging_adults, REML = FALSE)
parameters::model_parameters(m10_emerging, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## ---------------------------------------------------------------------------
## (Intercept) | 22.27 | 1.32 | [19.67, 24.86] | 16.89 | 337.40 | < .001
## time | -0.30 | 0.26 | [-0.81, 0.21] | -1.15 | 155.18 | 0.253
## MFQ | -0.35 | 0.04 | [-0.43, -0.28] | -9.09 | 334.64 | < .001
## covid | -0.10 | 0.18 | [-0.44, 0.25] | -0.54 | 324.08 | 0.590
sjstats::r2(m10_emerging)
## # R2 for Mixed Models
##
## Conditional R2: 0.739
## Marginal R2: 0.206
confint(m10_emerging, level=0.975)
## 1.25 % 98.75 %
## .sig01 3.6107047 5.0434487
## .sigma 2.6151326 3.5214902
## (Intercept) 19.1935854 25.3328124
## time -0.8868722 0.2851755
## MFQ -0.4429376 -0.2618734
## covid -0.4928583 0.3034862
For adults, significant effect of psychological flexibility across time on anxiety across time.
h2_longitudinal_adults <- h2_longitudinal %>% filter(age_group == 3)
m10_adults <- lmer(GAD ~ time + MFQ + (1|ID) + covid, data = h2_longitudinal_adults, REML = FALSE)
parameters::model_parameters(m10_adults, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## -----------------------------------------------------------------------------
## (Intercept) | 22.07 | 0.47 | [21.14, 23.00] | 46.66 | 2378.54 | < .001
## time | -0.38 | 0.09 | [-0.56, -0.19] | -3.99 | 1314.60 | < .001
## MFQ | -0.42 | 0.01 | [-0.44, -0.39] | -31.88 | 2384.97 | < .001
## covid | 0.20 | 0.06 | [ 0.08, 0.31] | 3.39 | 2360.95 | < .001
sjstats::r2(m10_adults)
## # R2 for Mixed Models
##
## Conditional R2: 0.690
## Marginal R2: 0.301
confint(m10_adults, level=0.975)
## 1.25 % 98.75 %
## .sig01 3.28821732 3.7915521
## .sigma 3.00013745 3.3281671
## (Intercept) 20.96363020 23.1737306
## time -0.58636996 -0.1646191
## MFQ -0.44587627 -0.3846002
## covid 0.06648989 0.3258501
For older adults, significant effect of psychological flexibility across time on anxiety across time.
h2_longitudinal_older_adults <- h2_longitudinal %>% filter(age_group == 4)
m10_older <- lmer(GAD ~ time + MFQ + (1|ID) + covid, data = h2_longitudinal_older_adults, REML = FALSE)
parameters::model_parameters(m10_older, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## ----------------------------------------------------------------------------
## (Intercept) | 18.28 | 0.95 | [16.42, 20.14] | 19.32 | 616.51 | < .001
## time | -0.35 | 0.13 | [-0.62, -0.09] | -2.61 | 365.10 | 0.009
## MFQ | -0.36 | 0.02 | [-0.41, -0.32] | -14.82 | 605.64 | < .001
## covid | 0.07 | 0.07 | [-0.07, 0.21] | 1.00 | 640.73 | 0.317
sjstats::r2(m10_older)
## # R2 for Mixed Models
##
## Conditional R2: 0.712
## Marginal R2: 0.284
confint(m10_older, level=0.975)
## 1.25 % 98.75 %
## .sig01 2.64840684 3.46140403
## .sigma 2.27335944 2.74234651
## (Intercept) 16.02997420 20.50801271
## time -0.65841072 -0.04969199
## MFQ -0.42212255 -0.30565315
## covid -0.08963796 0.23392548
(Unstandardised) estimates for each age group were as follows: Adolescents = -0.36, emerging adults = -0.35, adults = -0.42, older adults = -0.36. The negative association between psychological flexibility across time and anxiety across time is strongest in adults compared to other age groups.
First look at association between intolerance of uncertainty and psychological flexibility
IUS_MFQ <- lm(T1_IUS ~ T1_MFQ, data = study1)
summary(IUS_MFQ)
##
## Call:
## lm(formula = T1_IUS ~ T1_MFQ, data = study1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.1795 -5.9882 -0.0437 5.7156 30.0674
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 61.56231 0.84536 72.82 <2e-16 ***
## T1_MFQ -0.78395 0.02464 -31.82 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.6 on 2147 degrees of freedom
## (1059 observations deleted due to missingness)
## Multiple R-squared: 0.3204, Adjusted R-squared: 0.3201
## F-statistic: 1012 on 1 and 2147 DF, p-value: < 2.2e-16
Change in psychological flexibility
Create variable for change in psychological flexibility and select relevant variables
h3 <- study1 %>%
mutate(MFQ_change = T3_MFQ - T1_MFQ) %>%
select(T1_IUS, T1_covid, T1_PHQ, T3_PHQ, T1_GAD, T3_GAD, MFQ_change)
No evidence to suggest that change in psychological flexibility from T1 to T3 mediates the association between intolerance of uncertainty at T1 and depression at T3.
m11 <-
'# regressions
T3_PHQ ~ c*T1_IUS
MFQ_change ~ a*T1_IUS
T3_PHQ ~ b*MFQ_change
# covariates
T3_PHQ ~ T1_PHQ + T1_covid
MFQ_change ~ T1_PHQ + T1_covid
# indirect effect (a*b)
ab := a*b
#direct effect (c)
direct := c
# total effect
total := c + (a*b)'
fit_m11 <- sem(m11, data = h3, std.lv = T, std.ov = T, missing = 'fiml', se = 'robust', estimator = 'mlr', auto.var = T) # robust estimators, proper missing data method etc.
summary(fit_m11, standardized = T, rsquare = T) # use standardized variables and request R2
## lavaan 0.6-10 ended normally after 30 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 11
##
## Used Total
## Number of observations 2303 3208
## Number of missing patterns 4
##
## Model Test User Model:
## Standard Robust
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## T3_PHQ ~
## T1_IUS (c) 0.011 0.003 3.538 0.000 0.011 0.115
## MFQ_change ~
## T1_IUS (a) 0.000 0.005 0.001 0.999 0.000 0.000
## T3_PHQ ~
## MFQ_change (b) -0.247 0.033 -7.543 0.000 -0.247 -0.242
## T1_PHQ 0.112 0.005 23.772 0.000 0.112 0.695
## T1_covid -0.012 0.016 -0.705 0.481 -0.012 -0.018
## MFQ_change ~
## T1_PHQ 0.019 0.008 2.421 0.015 0.019 0.120
## T1_covid 0.052 0.024 2.116 0.034 0.052 0.082
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_PHQ -1.375 0.089 -15.374 0.000 -1.375 -1.349
## .MFQ_change -0.202 0.138 -1.463 0.144 -0.202 -0.202
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_PHQ 0.421 0.027 15.344 0.000 0.421 0.405
## .MFQ_change 0.975 0.067 14.654 0.000 0.975 0.978
##
## R-Square:
## Estimate
## T3_PHQ 0.595
## MFQ_change 0.022
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab -0.000 0.001 -0.001 0.999 -0.000 -0.000
## direct 0.011 0.003 3.538 0.000 0.011 0.115
## total 0.011 0.003 3.347 0.001 0.011 0.115
fitMeasures(fit_m11, fit.measures = c("chisq.scaled","df.scaled","pvalue.scaled", "rmsea.scaled","rmsea.ci.lower.scaled","rmsea.ci.upper.scaled","cfi.scaled","srmr","aic"))
## chisq.scaled df.scaled pvalue.scaled
## 0.000 0.000 NA
## rmsea.scaled rmsea.ci.lower.scaled rmsea.ci.upper.scaled
## 0.000 0.000 0.000
## cfi.scaled srmr aic
## 1.000 0.000 3416.125
No evidence to suggest that change in psychological flexibility from T1 to T3 mediates the association between intolerance of uncertainty at T1 and anxiety at T3.
m12 <-
'# regressions
T3_GAD ~ c*T1_IUS
MFQ_change ~ a*T1_IUS
T3_GAD ~ b*MFQ_change
# covariates
T3_GAD ~ T1_GAD + T1_covid
MFQ_change ~ T1_GAD + T1_covid
# indirect effect (a*b)
ab := a*b
#direct effect (c)
direct := c
# total effect
total := c + (a*b)'
fit_m12 <- sem(m12, data = h3, std.lv = T, std.ov = T, missing = 'fiml', se = 'robust', estimator = 'mlr', auto.var = T)
summary(fit_m12, standardized = T, rsquare = T)
## lavaan 0.6-10 ended normally after 29 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 11
##
## Used Total
## Number of observations 2302 3208
## Number of missing patterns 3
##
## Model Test User Model:
## Standard Robust
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## T3_GAD ~
## T1_IUS (c) 0.013 0.003 3.735 0.000 0.013 0.130
## MFQ_change ~
## T1_IUS (a) 0.001 0.005 0.164 0.870 0.001 0.008
## T3_GAD ~
## MFQ_change (b) -0.227 0.032 -7.027 0.000 -0.227 -0.224
## T1_GAD 0.109 0.005 20.178 0.000 0.109 0.664
## T1_covid -0.021 0.016 -1.384 0.166 -0.021 -0.034
## MFQ_change ~
## T1_GAD 0.013 0.008 1.558 0.119 0.013 0.080
## T1_covid 0.049 0.024 2.027 0.043 0.049 0.078
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_GAD -1.251 0.097 -12.931 0.000 -1.251 -1.232
## .MFQ_change -0.160 0.142 -1.130 0.259 -0.160 -0.160
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_GAD 0.433 0.027 16.237 0.000 0.433 0.420
## .MFQ_change 0.986 0.069 14.186 0.000 0.986 0.986
##
## R-Square:
## Estimate
## T3_GAD 0.580
## MFQ_change 0.014
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab -0.000 0.001 -0.164 0.870 -0.000 -0.002
## direct 0.013 0.003 3.735 0.000 0.013 0.130
## total 0.012 0.004 3.490 0.000 0.012 0.128
fitMeasures(fit_m12, fit.measures = c("chisq.scaled","df.scaled","pvalue.scaled", "rmsea.scaled","rmsea.ci.lower.scaled","rmsea.ci.upper.scaled","cfi.scaled","srmr","aic"))
## chisq.scaled df.scaled pvalue.scaled
## 0.000 0.000 NA
## rmsea.scaled rmsea.ci.lower.scaled rmsea.ci.upper.scaled
## 0.000 0.000 0.000
## cfi.scaled srmr aic
## 1.000 0.000 3438.629
As psychological flexibility did not change over time.
pf_change <- lmer(MFQ ~ time + (1|ID), data = study1_long, REML = FALSE)
parameters::model_parameters(pf_change, effects = "fixed", ci_method = "satterthwaite")
## # Fixed Effects
##
## Parameter | Coefficient | SE | 95% CI | t | df | p
## -----------------------------------------------------------------------------
## (Intercept) | 33.57 | 0.22 | [33.13, 34.00] | 150.53 | 3594.58 | < .001
## time | -0.14 | 0.11 | [-0.35, 0.08] | -1.24 | 1943.69 | 0.215
sjstats::r2(pf_change)
## # R2 for Mixed Models
##
## Conditional R2: 0.631
## Marginal R2: 0.000
T1 psychological flexibility mediated the association between T1 intolerance of uncertainty and T3 depression.
m11.1 <-
'# regressions
T3_PHQ ~ c*T1_IUS
T1_MFQ ~ a*T1_IUS
T3_PHQ ~ b*T1_MFQ
# covariates
T3_PHQ ~ T1_covid
T1_MFQ ~ T1_covid
# indirect effect (a*b)
ab := a*b
#direct effect (c)
direct := c
# total effect
total := c + (a*b)'
fit_m11.1 <- sem(m11.1, data = study1, std.lv = T, std.ov = T, missing = 'fiml', se = 'robust', estimator = 'mlr', auto.var = T)
summary(fit_m11.1, standardized = T, rsquare = T)
## lavaan 0.6-10 ended normally after 26 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Used Total
## Number of observations 2304 3208
## Number of missing patterns 4
##
## Model Test User Model:
## Standard Robust
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## T3_PHQ ~
## T1_IUS (c) 0.025 0.004 6.195 0.000 0.025 0.254
## T1_MFQ ~
## T1_IUS (a) -0.054 0.002 -29.773 0.000 -0.054 -0.564
## T3_PHQ ~
## T1_MFQ (b) -0.367 0.041 -8.867 0.000 -0.367 -0.364
## T1_covid -0.002 0.019 -0.110 0.912 -0.002 -0.003
## T1_MFQ ~
## T1_covid -0.006 0.011 -0.592 0.554 -0.006 -0.010
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_PHQ -0.863 0.137 -6.280 0.000 -0.863 -0.856
## .T1_MFQ 1.920 0.063 30.457 0.000 1.920 1.923
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_PHQ 0.710 0.037 19.400 0.000 0.710 0.699
## .T1_MFQ 0.679 0.024 28.745 0.000 0.679 0.681
##
## R-Square:
## Estimate
## T3_PHQ 0.301
## T1_MFQ 0.319
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab 0.020 0.002 8.635 0.000 0.020 0.205
## direct 0.025 0.004 6.195 0.000 0.025 0.254
## total 0.045 0.003 13.655 0.000 0.045 0.459
fitMeasures(fit_m11.1, fit.measures = c("chisq.scaled","df.scaled","pvalue.scaled", "rmsea.scaled","rmsea.ci.lower.scaled","rmsea.ci.upper.scaled","cfi.scaled","srmr","aic"))
## chisq.scaled df.scaled pvalue.scaled
## 0.000 0.000 NA
## rmsea.scaled rmsea.ci.lower.scaled rmsea.ci.upper.scaled
## 0.000 0.000 0.000
## cfi.scaled srmr aic
## 1.000 0.000 7112.955
T1 psychological flexibility mediated the association between T1 intolerance of uncertainty and T3 anxiety.
m12.1 <-
'# regressions
T3_GAD ~ c*T1_IUS
T1_MFQ ~ a*T1_IUS
T3_GAD ~ b*T1_MFQ
# covariates
T3_GAD ~ T1_covid
T1_MFQ ~ T1_covid
# indirect effect (a*b)
ab := a*b
#direct effect (c)
direct := c
# total effect
total := c + (a*b)'
fit_m12.1 <- sem(m12.1, data = study1, std.lv = T, std.ov = T, missing = 'fiml', se = 'robust', estimator = 'mlr', auto.var = T)
summary(fit_m12.1, standardized = T, rsquare = T)
## lavaan 0.6-10 ended normally after 29 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Used Total
## Number of observations 2304 3208
## Number of missing patterns 4
##
## Model Test User Model:
## Standard Robust
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## T3_GAD ~
## T1_IUS (c) 0.032 0.004 8.049 0.000 0.032 0.328
## T1_MFQ ~
## T1_IUS (a) -0.054 0.002 -29.780 0.000 -0.054 -0.564
## T3_GAD ~
## T1_MFQ (b) -0.316 0.042 -7.486 0.000 -0.316 -0.312
## T1_covid -0.006 0.019 -0.336 0.737 -0.006 -0.010
## T1_MFQ ~
## T1_covid -0.007 0.011 -0.653 0.514 -0.007 -0.011
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_GAD -1.109 0.137 -8.114 0.000 -1.109 -1.099
## .T1_MFQ 1.921 0.063 30.477 0.000 1.921 1.924
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .T3_GAD 0.692 0.037 18.467 0.000 0.692 0.680
## .T1_MFQ 0.679 0.024 28.749 0.000 0.679 0.681
##
## R-Square:
## Estimate
## T3_GAD 0.320
## T1_MFQ 0.319
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab 0.017 0.002 7.306 0.000 0.017 0.176
## direct 0.032 0.004 8.049 0.000 0.032 0.328
## total 0.049 0.003 15.209 0.000 0.049 0.504
fitMeasures(fit_m12.1, fit.measures = c("chisq.scaled","df.scaled","pvalue.scaled", "rmsea.scaled","rmsea.ci.lower.scaled","rmsea.ci.upper.scaled","cfi.scaled","srmr","aic"))
## chisq.scaled df.scaled pvalue.scaled
## 0.000 0.000 NA
## rmsea.scaled rmsea.ci.lower.scaled rmsea.ci.upper.scaled
## 0.000 0.000 0.000
## cfi.scaled srmr aic
## 1.000 0.000 7092.443
Source code for geom_flat_violin function
base_path <- paste0(here::here())
source(paste0(base_path, "/preprocessing/R_rainclouds.R"))
Set figure theme
raincloud_theme = theme(
text = element_text(size = 10),
axis.title.x = element_text(size = 14, face = "bold"),
axis.title.y = element_text(size = 14, face = "bold"),
axis.text = element_text(size = 10)) +
theme_classic()
# reverse order of age groups for visualisation
h1$age_group_factor <- ordered(h1$age_group_factor, levels = c("older_adults", "adults", "emerging_adults", "adolescents"))
h1 %>%
ggplot(mapping = aes(x = age_group_factor, y = T1_IUS, fill = age_group_factor)) +
geom_flat_violin(position = position_nudge(x = .2, y = 0), alpha = .8) +
geom_point(mapping = aes(y = T1_IUS, color = age_group_factor), position = position_jitter(width = .15), size = .5, alpha = 0.8) +
geom_boxplot(width = .1, guides = FALSE, outlier.shape = NA, alpha = 0.5) +
guides(fill = FALSE) +
guides(color = FALSE) +
scale_x_discrete(name = "Age Group", labels = paste0(c("Older Adult", "Adult","Late Adolescent", "Early-to-mid \nAdolescent"))) +
scale_y_continuous(name = "T1 Intolerance of Uncertainty Score") +
scale_fill_brewer(palette = "Spectral", direction = -1) +
scale_color_brewer(palette = "Spectral", direction = -1) +
coord_flip() +
raincloud_theme
ggsave(filename = here("output","T1_IUS.png"), width = 7, height = 5)
h1 %>%
ggplot(mapping = aes(x = age_group_factor, y = T1_MFQ, fill = age_group_factor)) +
geom_flat_violin(position = position_nudge(x = .2, y = 0), alpha = .8) +
geom_point(mapping = aes(y = T1_MFQ, color = age_group_factor), position = position_jitter(width = .15), size = .5, alpha = 0.8) +
geom_boxplot(width = .1, guides = FALSE, outlier.shape = NA, alpha = 0.5)+
guides(fill = FALSE) +
guides(color = FALSE) +
scale_x_discrete(name = "Age Group", labels = paste0(c("Older Adult", "Adult","Late Adolescent", "Early-to-mid \nAdolescent"))) +
scale_y_continuous(name = "T1 Psychological Flexibility Score") +
scale_fill_brewer(palette = "Spectral", direction = -1) +
scale_color_brewer(palette = "Spectral", direction = -1) +
coord_flip() +
raincloud_theme
ggsave(filename = here("output","T1_MFQ.png"), width = 7, height = 5)
To see this visually, need to change age group to unordered factor.
m8_vis <- h2_t1 %>%
mutate(age_group_factor = case_when(
age_group_factor == "adolescents" ~ "Early-to-mid Adolescent",
age_group_factor == "emerging_adults" ~ "Late Adolescent",
age_group_factor == "adults" ~ "Adult",
age_group_factor == "older_adults" ~ "Older Adult"))
m8_vis$age_group_factor <- factor(m8_vis$age_group_factor, ordered = FALSE)
m8.factor <- lm(T1_GAD ~ age_group_factor * T1_MFQ + T1_covid, data = m8_vis)
interact_plot(m8.factor, pred = T1_MFQ, modx = age_group_factor, modx.values = c("Early-to-mid Adolescent","Late Adolescent", "Adult", "Older Adult"), interval = TRUE, x.label = "T1 Psychological Flexibility", y.label = "T1 Anxiety", main.title = "",legend.main = "Age Group", colors = "Spectral")
ggsave(filename = here("output","m8_PF_age_anx.png"), width = 7, height = 5)
m10_vis <- h2_longitudinal %>%
mutate(age_group_factor = case_when(
age_group_factor == "adolescents" ~ "Early-to-mid Adolescent",
age_group_factor == "emerging_adults" ~ "Late Adolescent",
age_group_factor == "adults" ~ "Adult",
age_group_factor == "older_adults" ~ "Older Adult"))
m10.factor <- lmer(GAD ~ time + MFQ*age_group_factor + (1|ID) + covid, data = m10_vis, REML = FALSE)
interact_plot(m10.factor, pred = MFQ, modx = age_group_factor, modx.values = c("Early-to-mid Adolescent","Late Adolescent", "Adult", "Older Adult"), interval = TRUE, x.label = "Psychological Flexibility Across Time", y.label = "Anxiety Across Time", main.title = "",legend.main = "Age Group", colors = "Spectral")
ggsave(filename = here("output","m10_PF_age_anx.png"), width = 7, height = 5)