This example from Roczniewska & Higgins () is an instance of moderated mediation model with two postulated mediators. While such models can be fitted with the PROCESS macros (), we illustrate below the postulated causal diagram, the nonparametric bootstrap. We pay particular attention to verification of the linear model assumptions.

The context of the research is a natural experiment (or quasi-experiment): the authors study changes in behaviour due to modifications in the schooling system.

The statistical model in Roczniewska & Higgins () can be implicitly deduced from Table 2: the manipulated variable is the message framing and there are three postulated mediators (message fluency, message engagement, process fairness), the latter of which interacts or moderate with the change in outcome, and two moderators assumed to impact both mediators through linear interactions, termed promotion focus and prevention focus.

The mean response from the linear models are

(1)E(PF)=α0+α1Fram+α2Prom+α3Prev+α4Fram×Prom+α5Fram×Prev

(2)E(ME)=β0+β1Fram+β2Prom+β3Prev+β4Fram×Prom+β5Fram×Prev

(3)E(MF)=α0+α1Fram+α2Prom+α3Prev+α4Fram×Prom+α5Fram×Prev

(4)E(Open)=γ0+γ1Fram+γ2Prom+γ3Prev+γ4Fram×Prom+γ5Fram×Prev+γ6PF+γ7ME+γ8MF+γ9CO+γ10ME×CO++γ11PF×CO++γ12MF×CO

yielding a total of 31 coefficients for n=198 observations.

Code
data(RH19_S1, package = "hecedsm")
set.seed(80667)
joint_reg <- function(data, indices = 1:nrow(data)){
  mod1 <- lm(fairness ~ 
               regfocus * (promem + prevem), 
             data = data[indices,])
  mod2 <- lm(engagement ~ 
               regfocus * (promem + prevem), 
             data = data[indices,])
  mod3 <- lm(fluency ~ 
               regfocus * (promem + prevem), 
             data = data[indices,])
  resp <- lm(dopenness ~
               regfocus * (promem + prevem) +
               (fairness + fluency + 
       engagement) * change,
             data = data[indices,])
  coefs <- c(coef(mod1), 
             coef(mod2), 
             coef(mod3), 
             coef(resp))
  return(coefs)
}
npboot <- boot::boot(
  data = RH19_S1, 
  statistic = joint_reg,
  R = 9999, # number of bootstrap replicates
  sim = "ordinary")
results <- rbind(
  npboot$t0, 
  apply(npboot$t, 2, 
        quantile, c(0.025, 0.975)))
Code
testImplications <- function( covariance.matrix, sample.size ){
    library(ggm)
    tst <- function(i){ pcor.test( pcor(i,covariance.matrix), length(i)-2, sample.size )$pvalue }
tos <- function(i){ paste(i,collapse=" ") }
implications <- list(c("M1","M2","V1","V2","X"),
        c("M1","M3","V1","V2","X"),
        c("M1","W"),
        c("M2","M3","V1","V2","X"),
        c("M2","W"),
        c("M3","W"),
        c("V1","V2"),
        c("V1","W"),
        c("V1","X"),
        c("V2","W"),
        c("V2","X"),
        c("W","X"))
    data.frame( implication=unlist(lapply(implications,tos)),
        pvalue=unlist( lapply( implications, tst ) ) )

}

References

Hayes, A. F. (2022). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach (3rd ed.). Guilford Press.
Roczniewska, M., & Higgins, E. T. (2019). Messaging organizational change: How regulatory fit relates to openness to change through fairness perceptions. Journal of Experimental Social Psychology, 85, 103882. https://doi.org/10.1016/j.jesp.2019.103882