I am currently working on a control-case study where patients and controls are assessed at five different time intervals. The aim of the study is to assess possible differences in the response variable between Healthy and Patients at each phase of the experiment. I have implemented a linear mixed model using the lme4 package in R to analyze the data. I have a few questions regarding the interpretation of the results.
Find below the code to reproduce the results
library(lme4) library(emmeans) set.seed(534) n_subjects <- 50 # number of subjects n_timepoints <- 5 # number of repeated measurements per subject subject_ids <- rep(1:n_subjects, each = n_timepoints) timepoints <- rep(1:n_timepoints, times = n_subjects) group <- character(length = length(subject_ids)) group <- rep(sample(c("Healthy", "Patient"), size = n_subjects, replace = TRUE), each = n_timepoints) random_intercepts <- rnorm(n_subjects, mean = 0, sd = 2) response <- rnorm(n_subjects * n_timepoints) + random_intercepts # Create a data frame simulated_data <- data.frame( SubjectID = factor(subject_ids), Timepoint = factor(timepoints), Group = factor(group), Response = response ) # Fit a linear mixed model lmm_model <- lmer(Response ~ Group*Timepoint + (1|SubjectID), data = simulated_data) summary(lmm_model) emmip(lmm_model, Group ~ Timepoint , data = simulated_data, CIs = TRUE, xlab="PHASE") # Display contrasts for PHASE within each level of Sailors emm <- emmeans(lmm_model, ~ Group * Timepoint) contrasts_phases <- pairs(emm, simple="each", adjust="Bonferroni") print(contrasts_phases) I'm struggling interpreting the results as I've not found similar examples online.
Looking at the results I only have a significant interaction, namely GroupPatient:Timepoint4, which is telling me how much greater is the difference between Healthy and Patients in the phase 4 compared to the phase 1 (interpretation of interaction-term in linear regression, with and without main-effect).
> summary(lmm_model) ... Fixed effects: Estimate Std. Error df t value Pr(>|t|) (Intercept) 0.1503 0.4807 240.0000 0.313 0.7548 GroupPatient 0.7639 0.6798 240.0000 1.124 0.2622 Timepoint2 -0.9397 0.6798 240.0000 -1.382 0.1681 Timepoint3 -0.7947 0.6613 240.0000 -1.202 0.2307 Timepoint4 0.6256 0.6732 240.0000 0.929 0.3537 Timepoint5 0.7200 0.6868 240.0000 1.048 0.2955 GroupPatient:Timepoint2 -0.8411 0.9613 240.0000 -0.875 0.3825 GroupPatient:Timepoint3 -0.2299 0.9648 240.0000 -0.238 0.8119 GroupPatient:Timepoint4 -2.3312 0.9617 240.0000 -2.424 0.0161 * GroupPatient:Timepoint5 -0.9183 0.9617 240.0000 -0.955 0.3406 Examining the marginal means reveals a significant stacked difference between the Healthy and Patient groups specifically in phase 4 of the experiment. Can I confidently infer that the data demonstrate a distinction between the two groups solely in this phase, or should additional checks be conducted to validate this conclusion? Also, I am a bit lost concerning if the contrast method is correct, as many times I see this in pairwise comparison, which are displaying all possible contrasts.
> contrasts_phases <- pairs(emm, simple="each", adjust="Bonferroni") > print(contrasts_phases) $`simple contrasts for Group` Timepoint = 1: contrast estimate SE df t.ratio p.value Healthy - Patient -0.7639 0.685 240 -1.114 0.2662 Timepoint = 2: contrast estimate SE df t.ratio p.value Healthy - Patient 0.0771 0.685 240 0.113 0.9105 Timepoint = 3: contrast estimate SE df t.ratio p.value Healthy - Patient -0.5340 0.690 240 -0.774 0.4400 Timepoint = 4: contrast estimate SE df t.ratio p.value Healthy - Patient 1.5673 0.686 240 2.285 0.0232 Timepoint = 5: contrast estimate SE df t.ratio p.value Healthy - Patient 0.1543 0.686 240 0.225 0.8222 