library(bruceR)
## Warning: package 'bruceR' was built under R version 4.3.3
##
## bruceR (v2024.6)
## Broadly Useful Convenient and Efficient R functions
##
## Packages also loaded:
## ✔ data.table ✔ emmeans
## ✔ dplyr ✔ lmerTest
## ✔ tidyr ✔ effectsize
## ✔ stringr ✔ performance
## ✔ ggplot2 ✔ interactions
##
## Main functions of `bruceR`:
## cc() Describe() TTEST()
## add() Freq() MANOVA()
## .mean() Corr() EMMEANS()
## set.wd() Alpha() PROCESS()
## import() EFA() model_summary()
## print_table() CFA() lavaan_summary()
##
## For full functionality, please install all dependencies:
## install.packages("bruceR", dep=TRUE)
##
## Online documentation:
## https://psychbruce.github.io/bruceR
##
## To use this package in publications, please cite:
## Bao, H.-W.-S. (2024). bruceR: Broadly useful convenient and efficient R functions (Version 2024.6) [Computer software]. https://CRAN.R-project.org/package=bruceR
set.wd()
## ✔ Set working directory to "C:/Users/psyuser/Desktop/ARWA analysis"
set.seed(6)
rm(list = ls())
library(tidyverse)
## Warning: package 'readr' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.5
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ data.table::between() masks dplyr::between()
## ✖ Matrix::expand() masks tidyr::expand()
## ✖ dplyr::filter() masks stats::filter()
## ✖ data.table::first() masks dplyr::first()
## ✖ lubridate::hour() masks data.table::hour()
## ✖ lubridate::isoweek() masks data.table::isoweek()
## ✖ dplyr::lag() masks stats::lag()
## ✖ data.table::last() masks dplyr::last()
## ✖ lubridate::mday() masks data.table::mday()
## ✖ lubridate::minute() masks data.table::minute()
## ✖ lubridate::month() masks data.table::month()
## ✖ Matrix::pack() masks tidyr::pack()
## ✖ lubridate::quarter() masks data.table::quarter()
## ✖ lubridate::second() masks data.table::second()
## ✖ purrr::transpose() masks data.table::transpose()
## ✖ Matrix::unpack() masks tidyr::unpack()
## ✖ lubridate::wday() masks data.table::wday()
## ✖ lubridate::week() masks data.table::week()
## ✖ lubridate::yday() masks data.table::yday()
## ✖ lubridate::year() masks data.table::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(mice)
## Warning: package 'mice' was built under R version 4.3.3
## Registered S3 methods overwritten by 'broom':
## method from
## tidy.glht jtools
## tidy.summary.glht jtools
##
## Attaching package: 'mice'
##
## The following object is masked from 'package:bruceR':
##
## cc
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## cbind, rbind
library(naniar)
## Warning: package 'naniar' was built under R version 4.3.3
library(broom)
## Warning: package 'broom' was built under R version 4.3.3
data <- read.csv("./data/EEG_RS_lanExp.csv")
# Select the relevant columns and drop rows with NA values
education_income_data <- data %>%
select(EEGID, FatherEducation, MotherEducation, Income) %>%
drop_na()
# Perform PCA
pca_result <- prcomp(education_income_data %>% select(-EEGID), scale. = TRUE)
# Extract the first principal component and add SubjectID
pca_scores <- education_income_data %>%
select(EEGID) %>%
mutate(EducationIncomeFactor = -pca_result$x[, 1]) # add minus so that higher scores indicate higher SES
# Merge the PCA scores back into the original data
data_income <- data %>%
left_join(pca_scores, by = "EEGID") %>%
# Reorder columns to move FatherEducation, MotherEducation, Income, and EducationIncomeFactor to the first four columns
dplyr::select(EEGID, FatherEducation, MotherEducation, Income, EducationIncomeFactor, everything()) %>%
mutate(Age_EEG_yr = Age_EEG / 12) %>% # convert Age_EEG from months to years
# keep unique EEGID values
distinct(EEGID, .keep_all = TRUE) %>%
dplyr::select(CWR, CDICT, ARITH, EWR, EDICT, PW, CMOI, EMOI, EducationIncomeFactor, Age_EEG_yr, FID, EEGID)
## Warning in left_join(., pca_scores, by = "EEGID"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 20 of `x` matches multiple rows in `y`.
## ℹ Row 15 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
## "many-to-many"` to silence this warning.
# Visualize the missing data pattern
vis_miss(data_income)
# Analyze the pattern of missing data
missing_pattern <- naniar::miss_var_summary(data_income)
print(missing_pattern)
## # A tibble: 12 × 3
## variable n_miss pct_miss
## <chr> <int> <num>
## 1 CMOI 39 19.3
## 2 EMOI 39 19.3
## 3 EducationIncomeFactor 17 8.42
## 4 PW 16 7.92
## 5 CWR 5 2.48
## 6 EDICT 4 1.98
## 7 CDICT 3 1.49
## 8 ARITH 3 1.49
## 9 EWR 3 1.49
## 10 Age_EEG_yr 3 1.49
## 11 FID 3 1.49
## 12 EEGID 0 0
# # Define the function to explore missing data pattern and perform significance tests
# summarize_missing_data <- function(data, variables, group_vars) {
# # Create missing indicators
# data <- data %>%
# mutate(across(all_of(variables), ~ is.na(.), .names = "missing_{col}"))
# # Summarize the data
# summary_data <- data %>%
# group_by(across(starts_with("missing_"))) %>%
# summarize(across(all_of(group_vars), list(mean = ~ mean(.x, na.rm = TRUE), sd = ~ sd(.x, na.rm = TRUE),
# count = ~ n()), .names = "{col}_{fn}")) %>%
# ungroup()
# }
summarize_missing_data <- function(data, group_vars) {
# Create missing indicators for specific variables
data <- data %>%
mutate(
missing_CMOI = is.na(CMOI),
missing_EMOI = is.na(EMOI),
missing_EducationIncomeFactor = is.na(EducationIncomeFactor)
)
# Create a grouping variable based on the missing patterns
data <- data %>%
mutate(
missing_group = case_when(
!missing_CMOI & !missing_EMOI & !missing_EducationIncomeFactor ~ "No missing",
missing_CMOI & missing_EMOI & !missing_EducationIncomeFactor ~ "Missing MOI",
!missing_CMOI & !missing_EMOI & missing_EducationIncomeFactor ~ "Missing EducationIncomeFactor",
TRUE ~ "All Three Missing"
)
)
# Summarize the data by the missing group
summary_data <- data %>%
group_by(missing_group) %>%
summarize(
across(
all_of(group_vars),
list(
mean = ~ mean(.x, na.rm = TRUE),
sd = ~ sd(.x, na.rm = TRUE),
count = ~ n()
),
.names = "{col}_{fn}"
)
) %>%
ungroup()
# Reorder the summary data to match the desired output
summary_data <- summary_data %>%
mutate(missing_group = factor(missing_group, levels = c("No missing", "Missing MOI",
"Missing EducationIncomeFactor", "All Three Missing"))) %>%
arrange(missing_group)
return(summary_data)
}
# Test the function on different variables and get a merged DataFrame
variables_to_test <- c("CMOI", "EMOI", "EducationIncomeFactor")
group_vars <- c("CWR", "CDICT", "EWR", "EDICT")
summary_data <- summarize_missing_data(data_income, group_vars)
print(summary_data)
## # A tibble: 4 × 13
## missing_group CWR_mean CWR_sd CWR_count CDICT_mean CDICT_sd CDICT_count
## <fct> <dbl> <dbl> <int> <dbl> <dbl> <int>
## 1 No missing 81.1 31.9 156 26.7 8.07 156
## 2 Missing MOI 66.4 38.0 29 23.0 7.65 29
## 3 Missing EducationIn… 38.1 47.2 7 16.9 9.48 7
## 4 All Three Missing 26.7 9.81 10 13.9 4.88 10
## # ℹ 6 more variables: EWR_mean <dbl>, EWR_sd <dbl>, EWR_count <int>,
## # EDICT_mean <dbl>, EDICT_sd <dbl>, EDICT_count <int>
# Function to perform t-tests on the summarized data
perform_t_tests <- function(summary_data, group_vars) {
t_test_results <- summary_data
for (var in group_vars) {
t_values <- numeric(nrow(summary_data))
p_values <- numeric(nrow(summary_data))
for (i in 2:nrow(summary_data)) {
# Perform t-test comparing the first row with the i-th row
t_test <- t.test(
x = rnorm(summary_data[[paste0(var, "_count")]][1], mean = summary_data[[paste0(var, "_mean")]][1], sd = summary_data[[paste0(var, "_sd")]][1]),
y = rnorm(summary_data[[paste0(var, "_count")]][i], mean = summary_data[[paste0(var, "_mean")]][i], sd = summary_data[[paste0(var, "_sd")]][i])
)
t_values[i] <- t_test$statistic
p_values[i] <- t_test$p.value
}
# Set the first row values to NA since we don't compare the first row with itself
t_values[1] <- NA
p_values[1] <- NA
t_test_results[[paste0(var, "_t")]] <- t_values
t_test_results[[paste0(var, "_p")]] <- p_values
}
# Reorder the columns to place _t and _p columns after each corresponding {group}_count column
col_order <- c("missing_group", unlist(lapply(group_vars, function(var) {
c(paste0(var, "_mean"), paste0(var, "_sd"), paste0(var, "_count"), paste0(var, "_t"), paste0(var, "_p"))
})))
t_test_results <- t_test_results %>% select(all_of(col_order))
return(t_test_results)
}
# Perform t-tests on the summarized data
t_test_results <- perform_t_tests(summary_data, group_vars)
print(t_test_results)
## # A tibble: 4 × 21
## missing_group CWR_mean CWR_sd CWR_count CWR_t CWR_p CDICT_mean CDICT_sd
## <fct> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <dbl>
## 1 No missing 81.1 31.9 156 NA NA 26.7 8.07
## 2 Missing MOI 66.4 38.0 29 1.80 8.08e- 2 23.0 7.65
## 3 Missing Educati… 38.1 47.2 7 5.26 1.34e- 3 16.9 9.48
## 4 All Three Missi… 26.7 9.81 10 16.9 5.92e-25 13.9 4.88
## # ℹ 13 more variables: CDICT_count <int>, CDICT_t <dbl>, CDICT_p <dbl>,
## # EWR_mean <dbl>, EWR_sd <dbl>, EWR_count <int>, EWR_t <dbl>, EWR_p <dbl>,
## # EDICT_mean <dbl>, EDICT_sd <dbl>, EDICT_count <int>, EDICT_t <dbl>,
## # EDICT_p <dbl>
# output the t-test results to a CSV file
write.csv(t_test_results, "impute_group_diff.csv", row.names = FALSE)
# Test if the missing data is random using Little's MCAR test
mcar_test <- naniar::mcar_test(data_income[, c("CMOI", "EMOI", "EducationIncomeFactor")])
print(mcar_test)
## # A tibble: 1 × 4
## statistic df p.value missing.patterns
## <dbl> <dbl> <dbl> <int>
## 1 1.71 3 0.634 4
# If the missing data is random, perform imputation using the mice package
if (mcar_test$p.value > 0.05) {
print("The missing data is at random.")
imputed_data <- mice(data_income[, c("CMOI", "EMOI", "EducationIncomeFactor")], method = "norm.predict", m = 5, maxit = 50, seed = 500)
completed_data <- complete(imputed_data, 1)
# Replace the original columns with the imputed data
data_income$CMOI <- completed_data$CMOI
data_income$EMOI <- completed_data$EMOI
data_income$EducationIncomeFactor <- completed_data$EducationIncomeFactor
} else {
print("The missing data is not completely at random.")
}
## [1] "The missing data is at random."
##
## iter imp variable
## 1 1 CMOI EMOI EducationIncomeFactor
## 1 2 CMOI EMOI EducationIncomeFactor
## 1 3 CMOI EMOI EducationIncomeFactor
## 1 4 CMOI EMOI EducationIncomeFactor
## 1 5 CMOI EMOI EducationIncomeFactor
## 2 1 CMOI EMOI EducationIncomeFactor
## 2 2 CMOI EMOI EducationIncomeFactor
## 2 3 CMOI EMOI EducationIncomeFactor
## 2 4 CMOI EMOI EducationIncomeFactor
## 2 5 CMOI EMOI EducationIncomeFactor
## 3 1 CMOI EMOI EducationIncomeFactor
## 3 2 CMOI EMOI EducationIncomeFactor
## 3 3 CMOI EMOI EducationIncomeFactor
## 3 4 CMOI EMOI EducationIncomeFactor
## 3 5 CMOI EMOI EducationIncomeFactor
## 4 1 CMOI EMOI EducationIncomeFactor
## 4 2 CMOI EMOI EducationIncomeFactor
## 4 3 CMOI EMOI EducationIncomeFactor
## 4 4 CMOI EMOI EducationIncomeFactor
## 4 5 CMOI EMOI EducationIncomeFactor
## 5 1 CMOI EMOI EducationIncomeFactor
## 5 2 CMOI EMOI EducationIncomeFactor
## 5 3 CMOI EMOI EducationIncomeFactor
## 5 4 CMOI EMOI EducationIncomeFactor
## 5 5 CMOI EMOI EducationIncomeFactor
## 6 1 CMOI EMOI EducationIncomeFactor
## 6 2 CMOI EMOI EducationIncomeFactor
## 6 3 CMOI EMOI EducationIncomeFactor
## 6 4 CMOI EMOI EducationIncomeFactor
## 6 5 CMOI EMOI EducationIncomeFactor
## 7 1 CMOI EMOI EducationIncomeFactor
## 7 2 CMOI EMOI EducationIncomeFactor
## 7 3 CMOI EMOI EducationIncomeFactor
## 7 4 CMOI EMOI EducationIncomeFactor
## 7 5 CMOI EMOI EducationIncomeFactor
## 8 1 CMOI EMOI EducationIncomeFactor
## 8 2 CMOI EMOI EducationIncomeFactor
## 8 3 CMOI EMOI EducationIncomeFactor
## 8 4 CMOI EMOI EducationIncomeFactor
## 8 5 CMOI EMOI EducationIncomeFactor
## 9 1 CMOI EMOI EducationIncomeFactor
## 9 2 CMOI EMOI EducationIncomeFactor
## 9 3 CMOI EMOI EducationIncomeFactor
## 9 4 CMOI EMOI EducationIncomeFactor
## 9 5 CMOI EMOI EducationIncomeFactor
## 10 1 CMOI EMOI EducationIncomeFactor
## 10 2 CMOI EMOI EducationIncomeFactor
## 10 3 CMOI EMOI EducationIncomeFactor
## 10 4 CMOI EMOI EducationIncomeFactor
## 10 5 CMOI EMOI EducationIncomeFactor
## 11 1 CMOI EMOI EducationIncomeFactor
## 11 2 CMOI EMOI EducationIncomeFactor
## 11 3 CMOI EMOI EducationIncomeFactor
## 11 4 CMOI EMOI EducationIncomeFactor
## 11 5 CMOI EMOI EducationIncomeFactor
## 12 1 CMOI EMOI EducationIncomeFactor
## 12 2 CMOI EMOI EducationIncomeFactor
## 12 3 CMOI EMOI EducationIncomeFactor
## 12 4 CMOI EMOI EducationIncomeFactor
## 12 5 CMOI EMOI EducationIncomeFactor
## 13 1 CMOI EMOI EducationIncomeFactor
## 13 2 CMOI EMOI EducationIncomeFactor
## 13 3 CMOI EMOI EducationIncomeFactor
## 13 4 CMOI EMOI EducationIncomeFactor
## 13 5 CMOI EMOI EducationIncomeFactor
## 14 1 CMOI EMOI EducationIncomeFactor
## 14 2 CMOI EMOI EducationIncomeFactor
## 14 3 CMOI EMOI EducationIncomeFactor
## 14 4 CMOI EMOI EducationIncomeFactor
## 14 5 CMOI EMOI EducationIncomeFactor
## 15 1 CMOI EMOI EducationIncomeFactor
## 15 2 CMOI EMOI EducationIncomeFactor
## 15 3 CMOI EMOI EducationIncomeFactor
## 15 4 CMOI EMOI EducationIncomeFactor
## 15 5 CMOI EMOI EducationIncomeFactor
## 16 1 CMOI EMOI EducationIncomeFactor
## 16 2 CMOI EMOI EducationIncomeFactor
## 16 3 CMOI EMOI EducationIncomeFactor
## 16 4 CMOI EMOI EducationIncomeFactor
## 16 5 CMOI EMOI EducationIncomeFactor
## 17 1 CMOI EMOI EducationIncomeFactor
## 17 2 CMOI EMOI EducationIncomeFactor
## 17 3 CMOI EMOI EducationIncomeFactor
## 17 4 CMOI EMOI EducationIncomeFactor
## 17 5 CMOI EMOI EducationIncomeFactor
## 18 1 CMOI EMOI EducationIncomeFactor
## 18 2 CMOI EMOI EducationIncomeFactor
## 18 3 CMOI EMOI EducationIncomeFactor
## 18 4 CMOI EMOI EducationIncomeFactor
## 18 5 CMOI EMOI EducationIncomeFactor
## 19 1 CMOI EMOI EducationIncomeFactor
## 19 2 CMOI EMOI EducationIncomeFactor
## 19 3 CMOI EMOI EducationIncomeFactor
## 19 4 CMOI EMOI EducationIncomeFactor
## 19 5 CMOI EMOI EducationIncomeFactor
## 20 1 CMOI EMOI EducationIncomeFactor
## 20 2 CMOI EMOI EducationIncomeFactor
## 20 3 CMOI EMOI EducationIncomeFactor
## 20 4 CMOI EMOI EducationIncomeFactor
## 20 5 CMOI EMOI EducationIncomeFactor
## 21 1 CMOI EMOI EducationIncomeFactor
## 21 2 CMOI EMOI EducationIncomeFactor
## 21 3 CMOI EMOI EducationIncomeFactor
## 21 4 CMOI EMOI EducationIncomeFactor
## 21 5 CMOI EMOI EducationIncomeFactor
## 22 1 CMOI EMOI EducationIncomeFactor
## 22 2 CMOI EMOI EducationIncomeFactor
## 22 3 CMOI EMOI EducationIncomeFactor
## 22 4 CMOI EMOI EducationIncomeFactor
## 22 5 CMOI EMOI EducationIncomeFactor
## 23 1 CMOI EMOI EducationIncomeFactor
## 23 2 CMOI EMOI EducationIncomeFactor
## 23 3 CMOI EMOI EducationIncomeFactor
## 23 4 CMOI EMOI EducationIncomeFactor
## 23 5 CMOI EMOI EducationIncomeFactor
## 24 1 CMOI EMOI EducationIncomeFactor
## 24 2 CMOI EMOI EducationIncomeFactor
## 24 3 CMOI EMOI EducationIncomeFactor
## 24 4 CMOI EMOI EducationIncomeFactor
## 24 5 CMOI EMOI EducationIncomeFactor
## 25 1 CMOI EMOI EducationIncomeFactor
## 25 2 CMOI EMOI EducationIncomeFactor
## 25 3 CMOI EMOI EducationIncomeFactor
## 25 4 CMOI EMOI EducationIncomeFactor
## 25 5 CMOI EMOI EducationIncomeFactor
## 26 1 CMOI EMOI EducationIncomeFactor
## 26 2 CMOI EMOI EducationIncomeFactor
## 26 3 CMOI EMOI EducationIncomeFactor
## 26 4 CMOI EMOI EducationIncomeFactor
## 26 5 CMOI EMOI EducationIncomeFactor
## 27 1 CMOI EMOI EducationIncomeFactor
## 27 2 CMOI EMOI EducationIncomeFactor
## 27 3 CMOI EMOI EducationIncomeFactor
## 27 4 CMOI EMOI EducationIncomeFactor
## 27 5 CMOI EMOI EducationIncomeFactor
## 28 1 CMOI EMOI EducationIncomeFactor
## 28 2 CMOI EMOI EducationIncomeFactor
## 28 3 CMOI EMOI EducationIncomeFactor
## 28 4 CMOI EMOI EducationIncomeFactor
## 28 5 CMOI EMOI EducationIncomeFactor
## 29 1 CMOI EMOI EducationIncomeFactor
## 29 2 CMOI EMOI EducationIncomeFactor
## 29 3 CMOI EMOI EducationIncomeFactor
## 29 4 CMOI EMOI EducationIncomeFactor
## 29 5 CMOI EMOI EducationIncomeFactor
## 30 1 CMOI EMOI EducationIncomeFactor
## 30 2 CMOI EMOI EducationIncomeFactor
## 30 3 CMOI EMOI EducationIncomeFactor
## 30 4 CMOI EMOI EducationIncomeFactor
## 30 5 CMOI EMOI EducationIncomeFactor
## 31 1 CMOI EMOI EducationIncomeFactor
## 31 2 CMOI EMOI EducationIncomeFactor
## 31 3 CMOI EMOI EducationIncomeFactor
## 31 4 CMOI EMOI EducationIncomeFactor
## 31 5 CMOI EMOI EducationIncomeFactor
## 32 1 CMOI EMOI EducationIncomeFactor
## 32 2 CMOI EMOI EducationIncomeFactor
## 32 3 CMOI EMOI EducationIncomeFactor
## 32 4 CMOI EMOI EducationIncomeFactor
## 32 5 CMOI EMOI EducationIncomeFactor
## 33 1 CMOI EMOI EducationIncomeFactor
## 33 2 CMOI EMOI EducationIncomeFactor
## 33 3 CMOI EMOI EducationIncomeFactor
## 33 4 CMOI EMOI EducationIncomeFactor
## 33 5 CMOI EMOI EducationIncomeFactor
## 34 1 CMOI EMOI EducationIncomeFactor
## 34 2 CMOI EMOI EducationIncomeFactor
## 34 3 CMOI EMOI EducationIncomeFactor
## 34 4 CMOI EMOI EducationIncomeFactor
## 34 5 CMOI EMOI EducationIncomeFactor
## 35 1 CMOI EMOI EducationIncomeFactor
## 35 2 CMOI EMOI EducationIncomeFactor
## 35 3 CMOI EMOI EducationIncomeFactor
## 35 4 CMOI EMOI EducationIncomeFactor
## 35 5 CMOI EMOI EducationIncomeFactor
## 36 1 CMOI EMOI EducationIncomeFactor
## 36 2 CMOI EMOI EducationIncomeFactor
## 36 3 CMOI EMOI EducationIncomeFactor
## 36 4 CMOI EMOI EducationIncomeFactor
## 36 5 CMOI EMOI EducationIncomeFactor
## 37 1 CMOI EMOI EducationIncomeFactor
## 37 2 CMOI EMOI EducationIncomeFactor
## 37 3 CMOI EMOI EducationIncomeFactor
## 37 4 CMOI EMOI EducationIncomeFactor
## 37 5 CMOI EMOI EducationIncomeFactor
## 38 1 CMOI EMOI EducationIncomeFactor
## 38 2 CMOI EMOI EducationIncomeFactor
## 38 3 CMOI EMOI EducationIncomeFactor
## 38 4 CMOI EMOI EducationIncomeFactor
## 38 5 CMOI EMOI EducationIncomeFactor
## 39 1 CMOI EMOI EducationIncomeFactor
## 39 2 CMOI EMOI EducationIncomeFactor
## 39 3 CMOI EMOI EducationIncomeFactor
## 39 4 CMOI EMOI EducationIncomeFactor
## 39 5 CMOI EMOI EducationIncomeFactor
## 40 1 CMOI EMOI EducationIncomeFactor
## 40 2 CMOI EMOI EducationIncomeFactor
## 40 3 CMOI EMOI EducationIncomeFactor
## 40 4 CMOI EMOI EducationIncomeFactor
## 40 5 CMOI EMOI EducationIncomeFactor
## 41 1 CMOI EMOI EducationIncomeFactor
## 41 2 CMOI EMOI EducationIncomeFactor
## 41 3 CMOI EMOI EducationIncomeFactor
## 41 4 CMOI EMOI EducationIncomeFactor
## 41 5 CMOI EMOI EducationIncomeFactor
## 42 1 CMOI EMOI EducationIncomeFactor
## 42 2 CMOI EMOI EducationIncomeFactor
## 42 3 CMOI EMOI EducationIncomeFactor
## 42 4 CMOI EMOI EducationIncomeFactor
## 42 5 CMOI EMOI EducationIncomeFactor
## 43 1 CMOI EMOI EducationIncomeFactor
## 43 2 CMOI EMOI EducationIncomeFactor
## 43 3 CMOI EMOI EducationIncomeFactor
## 43 4 CMOI EMOI EducationIncomeFactor
## 43 5 CMOI EMOI EducationIncomeFactor
## 44 1 CMOI EMOI EducationIncomeFactor
## 44 2 CMOI EMOI EducationIncomeFactor
## 44 3 CMOI EMOI EducationIncomeFactor
## 44 4 CMOI EMOI EducationIncomeFactor
## 44 5 CMOI EMOI EducationIncomeFactor
## 45 1 CMOI EMOI EducationIncomeFactor
## 45 2 CMOI EMOI EducationIncomeFactor
## 45 3 CMOI EMOI EducationIncomeFactor
## 45 4 CMOI EMOI EducationIncomeFactor
## 45 5 CMOI EMOI EducationIncomeFactor
## 46 1 CMOI EMOI EducationIncomeFactor
## 46 2 CMOI EMOI EducationIncomeFactor
## 46 3 CMOI EMOI EducationIncomeFactor
## 46 4 CMOI EMOI EducationIncomeFactor
## 46 5 CMOI EMOI EducationIncomeFactor
## 47 1 CMOI EMOI EducationIncomeFactor
## 47 2 CMOI EMOI EducationIncomeFactor
## 47 3 CMOI EMOI EducationIncomeFactor
## 47 4 CMOI EMOI EducationIncomeFactor
## 47 5 CMOI EMOI EducationIncomeFactor
## 48 1 CMOI EMOI EducationIncomeFactor
## 48 2 CMOI EMOI EducationIncomeFactor
## 48 3 CMOI EMOI EducationIncomeFactor
## 48 4 CMOI EMOI EducationIncomeFactor
## 48 5 CMOI EMOI EducationIncomeFactor
## 49 1 CMOI EMOI EducationIncomeFactor
## 49 2 CMOI EMOI EducationIncomeFactor
## 49 3 CMOI EMOI EducationIncomeFactor
## 49 4 CMOI EMOI EducationIncomeFactor
## 49 5 CMOI EMOI EducationIncomeFactor
## 50 1 CMOI EMOI EducationIncomeFactor
## 50 2 CMOI EMOI EducationIncomeFactor
## 50 3 CMOI EMOI EducationIncomeFactor
## 50 4 CMOI EMOI EducationIncomeFactor
## 50 5 CMOI EMOI EducationIncomeFactor
# Check if CMOI and EMOI are normally distributed
shapiro_test_cmo <- shapiro.test(data_income$CMOI)
shapiro_test_emo <- shapiro.test(data_income$EMOI)
print(shapiro_test_cmo)
##
## Shapiro-Wilk normality test
##
## data: data_income$CMOI
## W = 0.71853, p-value < 2.2e-16
print(shapiro_test_emo)
##
## Shapiro-Wilk normality test
##
## data: data_income$EMOI
## W = 0.70176, p-value < 2.2e-16
# Analyze the pattern of missing data
missing_pattern <- naniar::miss_var_summary(data_income)
print(missing_pattern)
## # A tibble: 12 × 3
## variable n_miss pct_miss
## <chr> <int> <num>
## 1 PW 16 7.92
## 2 CWR 5 2.48
## 3 EDICT 4 1.98
## 4 CDICT 3 1.49
## 5 ARITH 3 1.49
## 6 EWR 3 1.49
## 7 Age_EEG_yr 3 1.49
## 8 FID 3 1.49
## 9 CMOI 0 0
## 10 EMOI 0 0
## 11 EducationIncomeFactor 0 0
## 12 EEGID 0 0
# Print the results of the normality tests
if (shapiro_test_cmo$p.value < 0.05) {
print("CMOI is not normally distributed.")
} else {
print("CMOI is normally distributed.")
}
## [1] "CMOI is not normally distributed."
if (shapiro_test_emo$p.value < 0.05) {
print("EMOI is not normally distributed.")
} else {
print("EMOI is normally distributed.")
}
## [1] "EMOI is not normally distributed."
# Choose imputation method based on normality test results
imputation_method <- ifelse(shapiro_test_cmo$p.value < 0.05 | shapiro_test_emo$p.value < 0.05, "pmm", "norm.predict")
# Perform imputation using the mice package
imputed_data <- mice(data_income[, c("CMOI", "EMOI", "EducationIncomeFactor")], method = imputation_method, m = 5, maxit = 50, seed = 500)
##
## iter imp variable
## 1 1
## 1 2
## 1 3
## 1 4
## 1 5
## 2 1
## 2 2
## 2 3
## 2 4
## 2 5
## 3 1
## 3 2
## 3 3
## 3 4
## 3 5
## 4 1
## 4 2
## 4 3
## 4 4
## 4 5
## 5 1
## 5 2
## 5 3
## 5 4
## 5 5
## 6 1
## 6 2
## 6 3
## 6 4
## 6 5
## 7 1
## 7 2
## 7 3
## 7 4
## 7 5
## 8 1
## 8 2
## 8 3
## 8 4
## 8 5
## 9 1
## 9 2
## 9 3
## 9 4
## 9 5
## 10 1
## 10 2
## 10 3
## 10 4
## 10 5
## 11 1
## 11 2
## 11 3
## 11 4
## 11 5
## 12 1
## 12 2
## 12 3
## 12 4
## 12 5
## 13 1
## 13 2
## 13 3
## 13 4
## 13 5
## 14 1
## 14 2
## 14 3
## 14 4
## 14 5
## 15 1
## 15 2
## 15 3
## 15 4
## 15 5
## 16 1
## 16 2
## 16 3
## 16 4
## 16 5
## 17 1
## 17 2
## 17 3
## 17 4
## 17 5
## 18 1
## 18 2
## 18 3
## 18 4
## 18 5
## 19 1
## 19 2
## 19 3
## 19 4
## 19 5
## 20 1
## 20 2
## 20 3
## 20 4
## 20 5
## 21 1
## 21 2
## 21 3
## 21 4
## 21 5
## 22 1
## 22 2
## 22 3
## 22 4
## 22 5
## 23 1
## 23 2
## 23 3
## 23 4
## 23 5
## 24 1
## 24 2
## 24 3
## 24 4
## 24 5
## 25 1
## 25 2
## 25 3
## 25 4
## 25 5
## 26 1
## 26 2
## 26 3
## 26 4
## 26 5
## 27 1
## 27 2
## 27 3
## 27 4
## 27 5
## 28 1
## 28 2
## 28 3
## 28 4
## 28 5
## 29 1
## 29 2
## 29 3
## 29 4
## 29 5
## 30 1
## 30 2
## 30 3
## 30 4
## 30 5
## 31 1
## 31 2
## 31 3
## 31 4
## 31 5
## 32 1
## 32 2
## 32 3
## 32 4
## 32 5
## 33 1
## 33 2
## 33 3
## 33 4
## 33 5
## 34 1
## 34 2
## 34 3
## 34 4
## 34 5
## 35 1
## 35 2
## 35 3
## 35 4
## 35 5
## 36 1
## 36 2
## 36 3
## 36 4
## 36 5
## 37 1
## 37 2
## 37 3
## 37 4
## 37 5
## 38 1
## 38 2
## 38 3
## 38 4
## 38 5
## 39 1
## 39 2
## 39 3
## 39 4
## 39 5
## 40 1
## 40 2
## 40 3
## 40 4
## 40 5
## 41 1
## 41 2
## 41 3
## 41 4
## 41 5
## 42 1
## 42 2
## 42 3
## 42 4
## 42 5
## 43 1
## 43 2
## 43 3
## 43 4
## 43 5
## 44 1
## 44 2
## 44 3
## 44 4
## 44 5
## 45 1
## 45 2
## 45 3
## 45 4
## 45 5
## 46 1
## 46 2
## 46 3
## 46 4
## 46 5
## 47 1
## 47 2
## 47 3
## 47 4
## 47 5
## 48 1
## 48 2
## 48 3
## 48 4
## 48 5
## 49 1
## 49 2
## 49 3
## 49 4
## 49 5
## 50 1
## 50 2
## 50 3
## 50 4
## 50 5
completed_data <- complete(imputed_data, 1)
# Replace the original columns with the imputed data
data_income$CMOI <- completed_data$CMOI
data_income$EMOI <- completed_data$EMOI
data_income$EducationIncomeFactor <- completed_data$EducationIncomeFactor
# output the data_income to csv
write.csv(data_income, file = "./data/EEG_RS_lanExp_income_imputated_all.csv", row.names = FALSE)
# library(lme4)
library(tidyverse)
library(lmerTest)
library(conflicted)
data_income <- read.csv("./data/EEG_RS_lanExp_income_imputated_all.csv")
# Center the variables
data_income <- data_income %>%
mutate(
PW_c = scale(PW, center = TRUE, scale = FALSE),
CMOI_c = scale(CMOI, center = TRUE, scale = FALSE),
EMOI_c = scale(EMOI, center = TRUE, scale = FALSE),
Age_EEG_yr_c = scale(Age_EEG_yr, center = TRUE, scale = FALSE),
EducationIncomeFactor_c = scale(EducationIncomeFactor, center = TRUE, scale = FALSE)
)
# keep only the columns data for the analysis
data_income <- data_income %>%
select(CWR, CDICT, ARITH, EWR, EDICT, PW_c, CMOI_c, EMOI_c, Age_EEG_yr_c, EducationIncomeFactor_c, FID, EEGID, Age_EEG_yr) %>%
drop_na()
demo_info <- read.csv("./data/assessment-resting-state-v8-200-drop-duplicated.csv")
# left join data_income with demo_info by selected column age gender
demo_data_summary <- data_income %>%
left_join(demo_info %>% select(EEGID, Gender), by = "EEGID", suffix = c("", "")) %>%
summarise(count = n(),
mean_age = mean(Age_EEG_yr, na.rm = TRUE),
gender_count = list(table(Gender))
)
knitr::kable(demo_data_summary)
count | mean_age | gender_count |
---|---|---|
180 | 8.135648 | 73, 107 |
# Fit separate models for each response variable
model_CWR <- lmerTest::lmer(CWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c + (1 | FID), data = data_income)
model_CDICT <- lmerTest::lmer(CDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c + (1 | FID), data = data_income)
model_ARITH <- lmerTest::lmer(ARITH ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + (1 | FID), data = data_income)
model_EWR <- lmerTest::lmer(EWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c + (1 | FID), data = data_income)
model_EDICT <- lmerTest::lmer(EDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c + (1 | FID), data = data_income)
# Print the model summaries
summary(model_CWR)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c +
## (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1612
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.65147 -0.46960 -0.00146 0.40791 2.38873
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 549.5 23.44
## Residual 202.2 14.22
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 75.368 2.582 93.382 29.190 < 2e-16 ***
## PW_c 196.128 66.328 152.113 2.957 0.0036 **
## Age_EEG_yr_c 21.909 2.626 102.603 8.344 3.52e-13 ***
## EducationIncomeFactor_c 1.000 1.792 91.866 0.558 0.5779
## CMOI_c 4.020 3.426 161.954 1.173 0.2424
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c A_EEG_ EdcIF_
## PW_c 0.016
## Ag_EEG_yr_c -0.012 0.017
## EdctnIncmF_ 0.043 0.043 0.020
## CMOI_c -0.022 -0.067 0.189 0.032
summary(model_CDICT)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c +
## (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1175.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3080 -0.4656 0.1267 0.5094 2.0318
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 36.51 6.043
## Residual 19.70 4.439
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.4155 0.6926 94.3395 36.697 < 2e-16 ***
## PW_c 45.8849 19.4953 164.5016 2.354 0.0198 *
## Age_EEG_yr_c 3.7643 0.7088 102.2129 5.311 6.4e-07 ***
## EducationIncomeFactor_c 0.6005 0.4799 92.2616 1.251 0.2140
## CMOI_c 0.1035 0.9591 150.3579 0.108 0.9142
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c A_EEG_ EdcIF_
## PW_c 0.014
## Ag_EEG_yr_c -0.017 0.021
## EdctnIncmF_ 0.041 0.047 0.020
## CMOI_c -0.024 -0.046 0.201 0.032
summary(model_ARITH)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ARITH ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 930
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7752 -0.4137 -0.0315 0.4065 3.8456
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 8.983 2.997
## Residual 4.792 2.189
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.9050 0.3430 99.1549 23.049 < 2e-16 ***
## PW_c 21.7304 9.6224 164.9365 2.258 0.02524 *
## Age_EEG_yr_c 3.9298 0.3439 103.9156 11.427 < 2e-16 ***
## EducationIncomeFactor_c 0.7501 0.2376 97.2327 3.157 0.00212 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c A_EEG_
## PW_c 0.013
## Ag_EEG_yr_c -0.012 0.031
## EdctnIncmF_ 0.042 0.049 0.014
summary(model_EWR)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c +
## (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1293.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4826 -0.3983 -0.0618 0.3845 3.3214
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 87.45 9.351
## Residual 33.15 5.758
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 19.1521 1.0327 95.4541 18.546 < 2e-16 ***
## PW_c 73.2426 26.7346 154.4357 2.740 0.006875 **
## Age_EEG_yr_c 6.2139 1.0583 105.1410 5.871 5.10e-08 ***
## EducationIncomeFactor_c 4.7130 0.7218 94.6019 6.530 3.27e-09 ***
## EMOI_c 5.2057 1.3043 153.1744 3.991 0.000102 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c A_EEG_ EdcIF_
## PW_c 0.016
## Ag_EEG_yr_c -0.012 0.015
## EdctnIncmF_ 0.041 0.037 0.042
## EMOI_c 0.018 0.065 -0.223 -0.125
summary(model_EDICT)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c +
## (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1039.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.4513 -0.4168 -0.1543 0.4150 2.3531
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 17.315 4.161
## Residual 8.838 2.973
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.6307 0.4738 97.0631 16.106 < 2e-16 ***
## PW_c 32.3836 13.1736 163.8387 2.458 0.015004 *
## Age_EEG_yr_c 3.0079 0.4881 105.5602 6.162 1.33e-08 ***
## EducationIncomeFactor_c 2.0226 0.3309 95.6572 6.112 2.13e-08 ***
## EMOI_c 2.3515 0.6157 144.5196 3.819 0.000198 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c A_EEG_ EdcIF_
## PW_c 0.014
## Ag_EEG_yr_c -0.016 0.019
## EdctnIncmF_ 0.039 0.042 0.043
## EMOI_c 0.019 0.046 -0.232 -0.128
# Fit the models with centered variables
moderate_CWR_MOI <- lmerTest::lmer(CWR ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_CDICT_MOI <- lmerTest::lmer(CDICT ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_EWR_MOI <- lmerTest::lmer(EWR ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_EDICT_MOI <- lmerTest::lmer(EDICT ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
# Print the model summaries
summary(moderate_CWR_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CWR ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1600.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.69087 -0.46606 -0.00007 0.39241 2.40964
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 532.1 23.07
## Residual 200.5 14.16
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 75.398 2.544 95.330 29.636 < 2e-16 ***
## PW_c 193.321 65.749 152.863 2.940 0.00379 **
## CMOI_c 4.270 3.389 160.168 1.260 0.20949
## Age_EEG_yr_c 21.997 2.590 104.159 8.492 1.52e-13 ***
## PW_c:CMOI_c 172.594 89.080 124.414 1.938 0.05495 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c CMOI_c A_EEG_
## PW_c 0.014
## CMOI_c -0.023 -0.067
## Ag_EEG_yr_c -0.013 0.016 0.190
## PW_c:CMOI_c 0.018 -0.011 0.036 0.023
summary(moderate_CDICT_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CDICT ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1168.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.26060 -0.48491 0.08296 0.50103 2.05906
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 37.14 6.095
## Residual 19.75 4.444
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.3761 0.6969 94.0757 36.415 < 2e-16 ***
## PW_c 44.6227 19.5443 163.3865 2.283 0.0237 *
## CMOI_c 0.0635 0.9638 151.7237 0.066 0.9476
## Age_EEG_yr_c 3.7427 0.7135 101.7779 5.246 8.5e-07 ***
## PW_c:CMOI_c -5.8959 26.9743 131.8553 -0.219 0.8273
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c CMOI_c A_EEG_
## PW_c 0.012
## CMOI_c -0.026 -0.048
## Ag_EEG_yr_c -0.018 0.020 0.200
## PW_c:CMOI_c 0.019 -0.007 -0.008 0.017
summary(moderate_EWR_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EWR ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1320.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3687 -0.3550 -0.0730 0.3404 3.4710
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 135.48 11.640
## Residual 32.69 5.718
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 18.894 1.241 98.298 15.228 < 2e-16 ***
## PW_c 66.808 28.301 138.640 2.361 0.0196 *
## EMOI_c 6.607 1.473 165.316 4.485 1.36e-05 ***
## Age_EEG_yr_c 5.797 1.259 110.085 4.603 1.12e-05 ***
## PW_c:EMOI_c -14.207 34.907 110.457 -0.407 0.6848
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EMOI_c A_EEG_
## PW_c 0.015
## EMOI_c 0.020 0.102
## Ag_EEG_yr_c -0.008 0.006 -0.206
## PW_c:EMOI_c -0.017 0.004 0.070 -0.037
summary(moderate_EDICT_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EDICT ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1062.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3211 -0.3965 -0.1422 0.3931 2.4105
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 26.074 5.106
## Residual 8.787 2.964
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.5106 0.5577 98.9073 13.466 < 2e-16 ***
## PW_c 27.1653 14.0002 150.9378 1.940 0.0542 .
## EMOI_c 2.9498 0.6907 156.5172 4.271 3.37e-05 ***
## Age_EEG_yr_c 2.8564 0.5704 108.6713 5.007 2.15e-06 ***
## PW_c:EMOI_c 2.6011 17.6090 118.3345 0.148 0.8828
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EMOI_c A_EEG_
## PW_c 0.015
## EMOI_c 0.022 0.078
## Ag_EEG_yr_c -0.012 0.012 -0.217
## PW_c:EMOI_c -0.019 0.002 0.034 -0.033
For the CMOI and EMOI moderation effect, the results are as follows: For CWR, the moderation effect of CMOI is significant (p = .049) and PW significantly correlates with CWR (p = .01). For CDICT, the moderation effect of CMOI is insignificant (p = .45) but PW significantly correlates with CDICT (p = .01). For EWR, the moderation effect of EMOI is insignificant (p = .39) but PW significantly correlates with EWR (p = .038). For EDICT, the moderation effect of EMOI is also insignificant (p = .85) and PW insignificantly correlates with EDICT (p = .09).
# Fit the model with PW as predictor, EducationIncomeFactor as moderator, and Age_EEG_yr as covariate
moderate_CWR_EIF <- lmerTest::lmer(CWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_CDICT_EIF <- lmerTest::lmer(CDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_ARITH_EIF <- lmerTest::lmer(ARITH ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_EWR_EIF <- lmerTest::lmer(EWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID), data = data_income)
moderate_EDICT_EIF <- lmerTest::lmer(EDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID), data = data_income)
# Print the model summary
summary(moderate_CWR_EIF)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1607.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.61950 -0.45175 0.00928 0.38601 2.41085
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 586.3 24.21
## Residual 192.8 13.89
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 75.320 2.643 95.746 28.499 < 2e-16 ***
## PW_c 189.334 67.107 152.963 2.821 0.00542 **
## EducationIncomeFactor_c 1.146 1.855 97.858 0.618 0.53802
## Age_EEG_yr_c 21.379 2.634 102.136 8.117 1.13e-12 ***
## PW_c:EducationIncomeFactor_c -36.401 46.377 134.373 -0.785 0.43391
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EdcIF_ A_EEG_
## PW_c 0.023
## EdctnIncmF_ 0.038 0.010
## Ag_EEG_yr_c -0.007 0.027 0.015
## PW_c:EdcIF_ 0.039 0.206 -0.154 -0.008
summary(moderate_CDICT_EIF)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1168.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.25156 -0.49852 0.07274 0.53087 1.93171
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 36.73 6.060
## Residual 19.34 4.397
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.3787 0.6931 94.3336 36.618 < 2e-16 ***
## PW_c 41.5259 19.6725 167.2683 2.111 0.0363 *
## EducationIncomeFactor_c 0.7041 0.4874 96.5870 1.445 0.1518
## Age_EEG_yr_c 3.7574 0.6943 99.0175 5.412 4.35e-07 ***
## PW_c:EducationIncomeFactor_c -16.9039 13.8183 151.2339 -1.223 0.2231
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EdcIF_ A_EEG_
## PW_c 0.021
## EdctnIncmF_ 0.034 0.016
## Ag_EEG_yr_c -0.013 0.028 0.016
## PW_c:EdcIF_ 0.044 0.175 -0.177 -0.011
summary(moderate_ARITH_EIF)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ARITH ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 924.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7554 -0.4124 -0.0420 0.4003 3.8216
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 9.000 3.000
## Residual 4.832 2.198
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.9072 0.3439 99.1579 22.994 < 2e-16 ***
## PW_c 21.9795 9.8011 168.4648 2.243 0.02623 *
## EducationIncomeFactor_c 0.7444 0.2418 101.3822 3.078 0.00268 **
## Age_EEG_yr_c 3.9291 0.3446 103.7210 11.404 < 2e-16 ***
## PW_c:EducationIncomeFactor_c 0.9328 6.8890 154.0762 0.135 0.89247
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EdcIF_ A_EEG_
## PW_c 0.021
## EdctnIncmF_ 0.033 0.016
## Ag_EEG_yr_c -0.013 0.029 0.016
## PW_c:EdcIF_ 0.044 0.174 -0.178 -0.012
summary(moderate_EWR_EIF)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1302.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2816 -0.4156 -0.0417 0.3970 2.9949
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 90.93 9.536
## Residual 37.21 6.100
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 19.0344 1.0614 95.1114 17.934 < 2e-16 ***
## PW_c 62.2025 28.4686 160.3710 2.185 0.0303 *
## EducationIncomeFactor_c 5.1879 0.7455 97.3175 6.959 4.01e-10 ***
## Age_EEG_yr_c 7.1816 1.0606 100.5939 6.771 8.69e-10 ***
## PW_c:EducationIncomeFactor_c -18.4894 19.8250 142.2836 -0.933 0.3526
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EdcIF_ A_EEG_
## PW_c 0.022
## EdctnIncmF_ 0.036 0.013
## Ag_EEG_yr_c -0.010 0.028 0.016
## PW_c:EdcIF_ 0.042 0.192 -0.165 -0.010
summary(moderate_EDICT_EIF)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1047.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3899 -0.4141 -0.1204 0.4213 2.7024
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 18.097 4.254
## Residual 9.823 3.134
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.5942 0.4883 96.9140 15.553 < 2e-16 ***
## PW_c 30.4701 13.9484 168.3675 2.184 0.0303 *
## EducationIncomeFactor_c 2.1897 0.3434 99.1538 6.376 5.79e-09 ***
## Age_EEG_yr_c 3.4428 0.4893 101.4828 7.037 2.37e-10 ***
## PW_c:EducationIncomeFactor_c -0.8686 9.8077 153.4727 -0.089 0.9295
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EdcIF_ A_EEG_
## PW_c 0.021
## EdctnIncmF_ 0.033 0.017
## Ag_EEG_yr_c -0.013 0.029 0.016
## PW_c:EdcIF_ 0.044 0.173 -0.178 -0.012
For the CMOI and EMOI moderation effect, the results are as follows: For CWR, the moderation effect of CMOI is significant (p = .049) and PW significantly correlates with CWR (p = .01). For CDICT, the moderation effect of CMOI is insignificant (p = .45) but PW significantly correlates with CDICT (p = .01). For EWR, the moderation effect of EMOI is insignificant (p = .39) but PW significantly correlates with EWR (p = .038). For EDICT, the moderation effect of EMOI is also insignificant (p = .85) and PW insignificantly correlates with EDICT (p = .09).
And for CWR and CDICT, alpha power significantly correlate with then (p = .01 and p = .02, respectively). However, the moderation effect of Education Income Factor (EIF) is not significant for CWR and CDICT (both p > .05). Alpha power did not significantly correlate with ARITH (p = .06) and the moderation effect of EIF is also insignificant (p = .65). Alpha power significantly correlate with then (p = .04 and p = .029, respectively). The moderation effect of EIF is insignificant for EWR and EDICT (both p > .05).
# Fit the models with centered variables
model_CWR_MOI <- lmerTest::lmer(CWR ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
model_CDICT_MOI <- lmerTest::lmer(CDICT ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
# moderate_ARITH_MOI <- lmerTest::lmer(ARITH ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
model_EWR_MOI <- lmerTest::lmer(EWR ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
model_EDICT_MOI <- lmerTest::lmer(EDICT ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID), data = data_income)
#summary
summary(model_CWR_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CWR ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1615.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.64158 -0.46000 -0.00332 0.39471 2.39415
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 545.6 23.36
## Residual 202.0 14.21
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 75.308 2.572 94.637 29.283 < 2e-16 ***
## PW_c 194.607 66.169 152.994 2.941 0.00378 **
## CMOI_c 3.978 3.416 163.188 1.164 0.24598
## Age_EEG_yr_c 21.880 2.617 103.831 8.360 3.02e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c CMOI_c
## PW_c 0.014
## CMOI_c -0.023 -0.068
## Ag_EEG_yr_c -0.013 0.016 0.189
summary(model_CDICT_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: CDICT ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1177.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.26995 -0.48737 0.08494 0.50144 2.06244
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 36.87 6.072
## Residual 19.67 4.435
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.37929 0.69445 95.63363 36.546 < 2e-16 ***
## PW_c 44.62582 19.49413 164.97734 2.289 0.0233 *
## CMOI_c 0.06255 0.96095 152.23325 0.065 0.9482
## Age_EEG_yr_c 3.74565 0.71106 103.50859 5.268 7.56e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c CMOI_c
## PW_c 0.012
## CMOI_c -0.026 -0.048
## Ag_EEG_yr_c -0.018 0.020 0.200
summary(model_EWR_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EWR ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1329.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3742 -0.3566 -0.0789 0.3343 3.4770
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 135.51 11.641
## Residual 32.38 5.691
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 18.885 1.240 98.207 15.232 < 2e-16 ***
## PW_c 66.857 28.203 139.432 2.371 0.0191 *
## EMOI_c 6.658 1.467 168.719 4.539 1.07e-05 ***
## Age_EEG_yr_c 5.775 1.258 110.342 4.592 1.17e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EMOI_c
## PW_c 0.015
## EMOI_c 0.021 0.102
## Ag_EEG_yr_c -0.009 0.006 -0.204
summary(model_EDICT_MOI)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EDICT ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID)
## Data: data_income
##
## REML criterion at convergence: 1070.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3312 -0.4007 -0.1424 0.4011 2.4211
##
## Random effects:
## Groups Name Variance Std.Dev.
## FID (Intercept) 26.021 5.101
## Residual 8.712 2.952
## Number of obs: 180, groups: FID, 101
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.5122 0.5568 99.1582 13.493 < 2e-16 ***
## PW_c 27.1341 13.9535 152.0434 1.945 0.0537 .
## EMOI_c 2.9483 0.6887 158.9184 4.281 3.21e-05 ***
## Age_EEG_yr_c 2.8589 0.5692 109.2228 5.023 2.00e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PW_c EMOI_c
## PW_c 0.015
## EMOI_c 0.023 0.078
## Ag_EEG_yr_c -0.013 0.012 -0.216
# Perform the likelihood ratio test
comparison_CWR <- anova(model_CWR_MOI, moderate_CWR_MOI)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_CWR)
## Data: data_income
## Models:
## model_CWR_MOI: CWR ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID)
## moderate_CWR_MOI: CWR ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_CWR_MOI 6 1649.2 1668.4 -818.62 1637.2
## moderate_CWR_MOI 7 1647.4 1669.8 -816.70 1633.4 3.8228 1 0.05056 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Perform the likelihood ratio test
comparison_CWR_EIF <- anova(model_CWR, moderate_CWR_EIF)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_CWR_EIF)
## Data: data_income
## Models:
## model_CWR: CWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c + (1 | FID)
## moderate_CWR_EIF: CWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_CWR 7 1650.9 1673.2 -818.45 1636.9
## moderate_CWR_EIF 7 1651.7 1674.1 -818.86 1637.7 0 0
# Perform the likelihood ratio test
comparison_CDICT <- anova(model_CDICT_MOI, moderate_CDICT_MOI)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_CDICT)
## Data: data_income
## Models:
## model_CDICT_MOI: CDICT ~ PW_c + CMOI_c + Age_EEG_yr_c + (1 | FID)
## moderate_CDICT_MOI: CDICT ~ PW_c * CMOI_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_CDICT_MOI 6 1200.9 1220.0 -594.44 1188.9
## moderate_CDICT_MOI 7 1202.8 1225.2 -594.42 1188.8 0.0415 1 0.8386
# Perform the likelihood ratio test
comparison_CDICT_EIF <- anova(model_CDICT, moderate_CDICT_EIF)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_CDICT_EIF)
## Data: data_income
## Models:
## model_CDICT: CDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + CMOI_c + (1 | FID)
## moderate_CDICT_EIF: CDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_CDICT 7 1201.3 1223.6 -593.63 1187.3
## moderate_CDICT_EIF 7 1199.8 1222.1 -592.89 1185.8 1.4768 0
# Perform the likelihood ratio test
comparison_ARITH_EIF <- anova(model_ARITH, moderate_ARITH_EIF)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_ARITH_EIF)
## Data: data_income
## Models:
## model_ARITH: ARITH ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + (1 | FID)
## moderate_ARITH_EIF: ARITH ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_ARITH 6 946.70 965.85 -467.35 934.70
## moderate_ARITH_EIF 7 948.68 971.03 -467.34 934.68 0.0195 1 0.8888
# Perform the likelihood ratio test
comparison_EWR <- anova(model_EWR_MOI, moderate_EWR_MOI)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_EWR)
## Data: data_income
## Models:
## model_EWR_MOI: EWR ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID)
## moderate_EWR_MOI: EWR ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_EWR_MOI 6 1357.2 1376.3 -672.58 1345.2
## moderate_EWR_MOI 7 1359.0 1381.3 -672.49 1345.0 0.1702 1 0.6799
# Perform the likelihood ratio test
comparison_EWR_EIF <- anova(model_EWR, moderate_EWR_EIF)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_EWR_EIF)
## Data: data_income
## Models:
## model_EWR: EWR ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c + (1 | FID)
## moderate_EWR_EIF: EWR ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_EWR 7 1323.0 1345.3 -654.48 1309.0
## moderate_EWR_EIF 7 1337.5 1359.8 -661.75 1323.5 0 0
# Perform the likelihood ratio test
comparison_EDICT <- anova(model_EDICT_MOI, moderate_EDICT_MOI)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_EDICT)
## Data: data_income
## Models:
## model_EDICT_MOI: EDICT ~ PW_c + EMOI_c + Age_EEG_yr_c + (1 | FID)
## moderate_EDICT_MOI: EDICT ~ PW_c * EMOI_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_EDICT_MOI 6 1091.8 1110.9 -539.88 1079.8
## moderate_EDICT_MOI 7 1093.7 1116.1 -539.87 1079.7 0.0213 1 0.884
# Perform the likelihood ratio test
comparison_EDICT_EIF <- anova(model_EDICT, moderate_EDICT_EIF)
## refitting model(s) with ML (instead of REML)
# Print the comparison results
print(comparison_EDICT_EIF)
## Data: data_income
## Models:
## model_EDICT: EDICT ~ PW_c + Age_EEG_yr_c + EducationIncomeFactor_c + EMOI_c + (1 | FID)
## moderate_EDICT_EIF: EDICT ~ PW_c * EducationIncomeFactor_c + Age_EEG_yr_c + (1 | FID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model_EDICT 7 1061.2 1083.6 -523.62 1047.2
## moderate_EDICT_EIF 7 1075.5 1097.9 -530.77 1061.5 0 0