Multiplicative and additive interaction in multiple imputed datasets #685
AngeloArias97
started this conversation in
Impute, analyse and pool
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m looking for help on analyzing additive and multiplicative interactions between a Polygenic Risk Score (PRS-SCZ) and an environmental risk score (ES-SCZ). For multiplicative interactions, I included interaction terms in my MICE code, accounting for multiple imputed datasets. This worked as expected, providing pooled coefficients using Rubin’s rules.
However, for additive interactions, I’m using the interactionR package to calculate RERI and confidence intervals via the delta method. The challenge is that I can only obtain results (coefficients and other parameters) from one imputed dataset, not pooled results across all imputations.
How can I correctly pool the results for additive interactions in MICE?
Thank you in advance for your help!
------------------------------------------------------- START CODE --------------------------------------------------------------------
library(mice)
library(interactionR)
#Generate test dataset
set.seed(123)
n <- 100
df_PE18 <- data.frame(
PE_18 = rbinom(n, 1, 0.5), # Binary outcome
PRS_SCZ = rnorm(n), # Continuous polygenic risk score
bullying = rbinom(n, 1, 0.3),
sexual_abuse = rbinom(n, 1, 0.2),
emotional_neglect = rbinom(n, 1, 0.25),
emotional_abuse = rbinom(n, 1, 0.3),
physical_abuse = rbinom(n, 1, 0.2),
hearing_impairment = rbinom(n, 1, 0.1),
cannabis_use = rbinom(n, 1, 0.35),
winter_birth = rbinom(n, 1, 0.5),
sex = factor(rbinom(n, 1, 0.5), labels = c("Male", "Female")),
PC1 = rnorm(n),
PC2 = rnorm(n),
PC3 = rnorm(n),
PC4 = rnorm(n),
PC5 = rnorm(n),
PC6 = rnorm(n),
PC7 = rnorm(n),
PC8 = rnorm(n),
PC9 = rnorm(n),
PC10 = rnorm(n)
)
#Introduce missingness
set.seed(123)
cols_with_missing <- c("bullying", "sexual_abuse", "emotional_abuse", "physical_abuse", "cannabis_use")
for (col in cols_with_missing) {
missing_indices <- sample(1:n, size = n * 0.1)
df_PE18[[col]][missing_indices] <- NA
}
#Establish methods and run imputation
methods <- setNames(rep("", ncol(df_PE18)), colnames(df_PE18))
logreg_vars <- c("bullying", "sexual_abuse", "emotional_neglect",
"emotional_abuse", "physical_abuse", "hearing_impairment", "cannabis_use")
methods[logreg_vars] <- "logreg"
print(methods)
imp <- mice(df_PE18, method = methods, m = 10, maxit=20, seed = 123)
#Calculate ES-SCZ and analysis
exposome_factors <- c("cannabis_use", "winter_birth", "hearing_impairment",
"emotional_abuse", "physical_abuse", "sexual_abuse",
"emotional_neglect", "bullying")
coefficients <- c(1.31, 0.03, 1.18, 0.78, -0.39, 0.86, 0.44, 1.35) #same order as exposome factors
model3 <- with(imp, {
data <- data.frame(
lapply(seq_along(exposome_factors), function(i) {
as.numeric(get(exposome_factors[i])) * coefficients[i]
})
)
colnames(data) <- exposome_factors
data$ES_SCZ <- rowSums(data) + 2
data$ES_SCZ <- scale(data$ES_SCZ)
data$PRS_SCZ <- scale(PRS_SCZ)
data$ES_SCZ <- ifelse(data$ES_SCZ >= quantile(data$ES_SCZ, 0.75, na.rm = TRUE), 1, 0)
data$PRS_SCZ <- ifelse(data$PRS_SCZ >= quantile(data$PRS_SCZ, 0.75, na.rm = TRUE), 1, 0)
fit <- glm(PE_18 ~ ES_SCZ * PRS_SCZ + sex + PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 +
PC8 + PC9 + PC10, data = data, family = binomial)
interaction_results <- interactionR(
model = fit,
exposure_names = c("PRS_SCZ", "ES_SCZ"),
ci.type = "delta",
ci.level = 0.95,
em = FALSE
)
list(fit = fit, interaction_results = interaction_results)
})
models_only <- lapply(model3$analyses, function(res) res$fit)
pooled_results3 <- pool(models_only)
summary_pooled <- summary(pooled_results3, conf.int = TRUE)
print(summary_pooled)
interaction_summaries <- lapply(model3$analyses, function(res) res$interaction_results)
interaction_summaries[[1]]
Beta Was this translation helpful? Give feedback.
All reactions