[Bug] The PROCESS function incorrectly displays the coefficients of covariates as coefficients of direct effects.
Closed this issue · 1 comments
Dear bruce,
I am using PROCESS in bruceR for modelling, however I have found a problem with the display. When I run model 7, the values of the covariates are incorrectly substituting the values of the direct effects. You can see this in the code below,I have used the example dataset data
from your help file for this example
As you can see in the section Direct Effect: "parent_edu" (X) ==> "score" (Y)
it shows a coefficient of -0.444, which should be the coefficient of partjob. Not the coefficient of the direct effect, which is 3.581 instead.
> PROCESS(data, y="score", x="parent_edu",
+ meds=c("family_inc"),
+ mod.path = c("x-m"),
+ mods="gender",
+ covs=c("partjob"))
************ PART 1. Regression Model Summary ************
PROCESS Model Code : 7 (Hayes, 2018; www.guilford.com/p/hayes3)
PROCESS Model Type : Moderated Mediation
- Outcome (Y) : score
- Predictor (X) : parent_edu
- Mediators (M) : family_inc
- Moderators (W) : gender
- Covariates (C) : partjob
- Level-2 Clusters : -
All numeric predictors have been mean-centered.
Formula of Mediator:
- family_inc ~ partjob + parent_edu*gender
Formula of Outcome:
- score ~ partjob + parent_edu + gender + family_inc
Model Summary
─────────────────────────────────────────────────────────────────
(1) score (2) family_inc (3) score
─────────────────────────────────────────────────────────────────
(Intercept) 51.912 *** 9.207 *** 51.261 ***
(0.094) (0.030) (0.126)
partjob -0.298 0.132 ** -0.444 *
(0.194) (0.045) (0.187)
parent_edu 5.546 *** 1.786 *** 3.581 ***
(0.190) (0.061) (0.199)
genderMale 0.107 * 1.358 ***
(0.044) (0.182)
parent_edu:genderMale 0.021
(0.089)
family_inc 1.086 ***
(0.042)
─────────────────────────────────────────────────────────────────
R^2 0.081 0.146 0.145
Adj. R^2 0.081 0.146 0.145
Num. obs. 9679 9679 9679
─────────────────────────────────────────────────────────────────
Note. * p < .05, ** p < .01, *** p < .001.
************ PART 2. Mediation/Moderation Effect Estimate ************
Package Use : ‘mediation’ (v4.5.0), ‘interactions’ (v1.1.5)
Effect Type : Moderated Mediation (Model 7)
Sample Size : 9679
Random Seed : set.seed()
Simulations : 100 (Bootstrap)
Warning: nsim=1000 (or larger) is suggested!
Direct Effect: "parent_edu" (X) ==> "score" (Y)
────────────────────────────────────────────────────────────────────
Effect S.E. t p [95% CI]
────────────────────────────────────────────────────────────────────
Direct (c') -0.444 (0.187) -2.372 .018 * [-0.811, -0.077]
────────────────────────────────────────────────────────────────────
Interaction Effect on "family_inc" (M)
──────────────────────────────────────────────────
F df1 df2 p
──────────────────────────────────────────────────
parent_edu x gender 0.05 1 9674 .815
──────────────────────────────────────────────────
Simple Slopes: "parent_edu" (X) ==> "family_inc" (M)
(Conditional Effects [a] of X on M)
───────────────────────────────────────────────────────────────
"gender" Effect S.E. t p [95% CI]
───────────────────────────────────────────────────────────────
Female 1.786 (0.061) 29.104 <.001 *** [1.665, 1.906]
Male 1.806 (0.064) 28.294 <.001 *** [1.681, 1.932]
───────────────────────────────────────────────────────────────
Running 100 * 2 simulations...
Indirect Path: "parent_edu" (X) ==> "family_inc" (M) ==> "score" (Y)
(Conditional Indirect Effects [ab] of X through M on Y)
───────────────────────────────────────────────────────────────
"gender" Effect S.E. z p [Boot 95% CI]
───────────────────────────────────────────────────────────────
Female 1.940 (0.110) 17.650 <.001 *** [1.725, 2.109]
Male 1.962 (0.085) 23.009 <.001 *** [1.825, 2.149]
───────────────────────────────────────────────────────────────
Percentile Bootstrap Confidence Interval
(SE and CI are estimated based on 100 Bootstrap samples.)
Note. The results based on bootstrapping or other random processes
are unlikely identical to other statistical software (e.g., SPSS).
To make results reproducible, you need to set a seed (any number).
Please see the help page for details: help(PROCESS)
Ignore this note if you have already set a seed. :)
Hopeing this will help you.
Thanks. The latest update in GitHub (version 0.8.2-1) has fixed this bug.
Note that this bug was only related to models with some covariates but without "x-y"
in mod.path
(e.g., Model 7). Below are detailed changes for this bug fix.
Before (wrong if there is any covariate):
de=as.data.frame(coef(summary(model.y)))[2,]
After:
de=as.data.frame(coef(summary(model.y)))
de=de[which(row.names(de)==x),]
Since this bug has been fixed, I will close this issue.