2
$\begingroup$

I have a set of paired observations, corresponding to patient blood pressure before and after a treatment. I'd like to test for the significance of the treatment by conducting a paired t-test (or Wilcoxon signed-rank test) on the paired differences in blood pressures.

For each patient, I have multiple pairs of observations, each corresponding to a specific measuring condition (e.g., sitting down, standing up, after light exercise, after eating). From what I understand, one of the necessary assumptions to conduct any paired test is that the set of paired differences must be independent from one another. If I directly use all pairs of observations on all patients, I would be violating this assumption.

Is there a method that accounts for this dependence? I have looked into mixed effect models, and it seems quite different from the traditional paired t-tests. How would I formulate my hypothesis in the context of mixed effect models? What other methods should I consider?

$\endgroup$

1 Answer 1

1
$\begingroup$

Hypothesis Testing

A mixed model would probably be best, simply because all of your measures are repeated and seem related to each other in some sense. If the measures you are considering always have two measures (pre and post), you can just model time as a fixed effect and subject variation between those time points as random. The specification would go something like this:

fit <- lmer(blood_pressure ~ posture + exercise + diet + time + (1|subject), data = data)

The hypotheses would still largely be the same (e.g. "Does sitting increase blood pressure?"), the only difference is you are modeling the random effects as separate specifications in a statistical sense. In terms of other methods, there are some other ways you could test this in a nonlinear mixed model universe (GAMMs, GAMLSS, etc.) but they may not be super necessary depending on what you're doing here.

Simulated Example

As an example with simulated data below in R (with some very basic dummy coding of the factors you mentioned):

#### Load Library and Seed ####
library(lme4)
set.seed(123)

#### Simulate Variables ####
n <- 100
posture <- rbinom(n, 1, 0.5)
diet <- rbinom(n, 1, 0.5)
exercise <- rbinom(n, 1, 0.5)
time <- rep(c("pre", "post"), each = n)

#### Random Effects ####
subject_intercept <- rnorm(n)
subject_time_effect <- rnorm(n)

#### Construct DV ####
blood_pressure <- 120 + 10*posture + 15*diet + 5*exercise + 
  20*(time == "post") + subject_intercept + 
  subject_time_effect*(time == "post") + rnorm(2*n)

#### Combine Data ####
df <- data.frame(subject = rep(1:n, 2),
                 time = time,
                 posture = rep(posture, 2),
                 diet = rep(diet, 2),
                 exercise = rep(exercise, 2),
                 blood_pressure = blood_pressure)

#### Fit Model ####
model <- lmer(blood_pressure 
              ~ factor(posture)
              + factor(diet) 
              + factor(exercise) 
              + time  
              + (1 |subject), 
              data = df)

#### Print Summary ####
summary(model)

The summary here shows that subject variance in BP is around $0.9556$ and the fixed effects have considerable influences on BP (you can use lmerTest here if you want $p$ values, but I omit them here since the raw estimates tell a clear picture already). For example, if the posture coefficient here represents sitting, then sitting increases blood pressure by an additional 10 points.

Linear mixed model fit by REML ['lmerMod']
Formula: 
blood_pressure ~ factor(posture) + factor(diet) + factor(exercise) +  
    time + (1 | subject)
   Data: df

REML criterion at convergence: 724.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.2212 -0.5229  0.0219  0.6379  2.1290 

Random effects:
 Groups   Name        Variance Std.Dev.
 subject  (Intercept) 0.9556   0.9776  
 Residual             1.4228   1.1928  
Number of obs: 200, groups:  subject, 100

Fixed effects:
                  Estimate Std. Error t value
(Intercept)       140.1837     0.2856  490.89
factor(posture)1   10.0141     0.2608   38.40
factor(diet)1      15.3726     0.2608   58.94
factor(exercise)1   4.8258     0.2619   18.42
timepre           -20.3479     0.1687 -120.62

Correlation of Fixed Effects:
            (Intr) fctr(p)1 fctr(d)1 fctr(x)1
fctr(pstr)1 -0.511                           
factor(dt)1 -0.544  0.073                    
fctr(xrcs)1 -0.546  0.111    0.127           
timepre     -0.295  0.000    0.000    0.000  

For accessible discussions on mixed models, I provide some useful articles below (Harrison et al. is particularly a good read because it uses a lot less statistical language and uses good visualizations of random effects).

References

  • Bates, D., Mächler, M., Bolker, B., & Walker, S. (2015). Fitting linear mixed-effects models using lme4. Journal of Statistical Software, 67(1). https://doi.org/10.18637/jss.v067.i01
  • Harrison, X. A., Donaldson, L., Correa-Cano, M. E., Evans, J., Fisher, D. N., Goodwin, C. E. D., Robinson, B. S., Hodgson, D. J., & Inger, R. (2018). A brief introduction to mixed effects modelling and multi-model inference in ecology. PeerJ, 6, e4794. https://doi.org/10.7717/peerj.4794
  • Meteyard, L., & Davies, R. A. I. (2020). Best practice guidance for linear mixed-effects models in psychological science. Journal of Memory and Language, 112, 104092. https://doi.org/10.1016/j.jml.2020.104092
$\endgroup$
2
  • $\begingroup$ Thanks Shawn! Your response was very helpful. I'll read through the links you shared. I just made this account and I realized that I can't cast upvotes due to limited reputation, but I appreciate your help! $\endgroup$ Nov 11, 2023 at 1:44
  • 1
    $\begingroup$ No worries. If you feel I have sufficiently answered your question after reading the material, you may choose to accept the answer by clicking the checkmark next to it. Otherwise you are free to take this info and consider your options. Indeed, others may chime in and you may also consider their answers too. You may also search through my posts about my other answers related to mixed models. $\endgroup$ Nov 11, 2023 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.