Skip to content

Commit 163847a

Browse files
20251114 - absolute value of total effect
1 parent 1610bf5 commit 163847a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sem.Rmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,10 +2030,11 @@ mediationModel <- '
20302030
indirect := a*b
20312031
20322032
# total effect (c)
2033-
total := abs(direct) + abs(indirect)
2033+
total := direct + indirect
2034+
totalAbs := abs(direct) + abs(indirect)
20342035
20352036
# proportion mediated
2036-
Pm := abs(indirect) / total
2037+
Pm := abs(indirect) / totalAbs
20372038
'
20382039
```
20392040

@@ -2139,7 +2140,7 @@ Effect size: Proportion mediated (*P*<sub>*M*</sub>); i.e., the proportion of th
21392140

21402141
```{r}
21412142
mediationFit_total <- mediationFit_estimates %>%
2142-
filter(label == "total") %>%
2143+
filter(label == "totalAbs") %>%
21432144
select(std.all) %>%
21442145
as.numeric
21452146

0 commit comments

Comments
 (0)