# Testing Conditional Indirect Effects/Mediation in R

This post builds on a previous post on

Testing Indirect Effects/Mediation in R.

## What is mediation?

There are many ways to define mediation and mediators. Here’s one way: Mediation is the process by which one variable transmits an effect onto another through one or more mediating variables. For example, as room temperature increases, people get thirstier, and then they drink more water. In this case, thirst transmits the effect of room temperature on water drinking.

## What is an indirect effect?

The indirect effect quantifies a mediation effect, if such an effect exists. Referring to the thirst example above, in statistical terms, the indirect effect quantifies the extent to which room temperature is associated with water drinking indirectly through thirstiness. If you’re familiar with interpreting regression coefficients and the idea of controlling for other variables, then you might find it intuitive to think of the indirect effect as the decrease in the relationship between room temperature and water drinking after you’ve partialed out the association between room temperature and thirtiness. In other words, how much does the coefficient for room temperature decrease when you control for thirstiness?

## What is moderation?

Moderation refers to how some variable modifies the direction or the strength of the association between two variables. In other words, a moderator variable qualifies the relation between two variables. A moderator is not a part of some proposed causal process; instead, it interacts with the relation between two variables in such a way that their relation is stronger, weaker, or opposite in direction—depending on values of the moderator. For example, as room temperature increases, people may report feeling thirstier. But that may depend on how physically fit people are. Maybe physically fit people don’t report feeling thirsty as room temperature increases, or maybe physically fit people—compared to less physically fit people—have a higher room temperature threshold at which they start feeling thirstier. In this example, the product of one predictor variables and the moderator—their interaction—quantifies the moderator’s effect. Statistically, the product term accounts for variability in thirst or water drinking independently of either predictor variable by itself.

## What is a conditional indirect effect (i.e., moderated mediation)?

The conditional indirect concept combines moderation and mediation. Think back to the idea behind a simple indirect effect: It quantifies the extent to which two variables are related through a third variable, the mediator. Coneptually, the conditional indirect effect quantifies the indirect effect at different values of a moderator. In this sense, an indirect effect may be stronger, weaker, or opposite in sign, depending on values of a moderator. Importantly, a moderator may qualify any relation that’s a part of some proposed mediation model. For example, physical fitness might qualify the association between room temperature and thirstiness, between thirstiness and water drinking, or both.

## What is the Index of Moderated Mediation?

Much like the product or interaction term in a linear regression analysis quantifies the relation between a predictor and a moderator, the index of moderated mediation quantifies the relationship between the indirect effect and a moderator. An index of moderated mediation that is significantly different from zero implies that any two conditional indirect effects are smaller, larger, or opposite in sign at different levels of the moderator.

## Model and Conceptual Assumptions

Correct functional form.Your model variables share linear relationships and don’t interact with eachother.No omitted influences.This one is hard: Your model accounts for all relevant influences on the variables included. All models are wrong, but how wrong is yours?Accurate measurement.Your measurements are valid and reliable. Note that unreliable measures can’t be valid, and reliable measures don’t necessairly measure just one construct or even your construct.Well-behaved residuals.Residuals (i.e., prediction errors) aren’t correlated with predictor variables or eachother, and residuals have constant variance across values of your predictor variables. Also, residual error terms aren’t correlated across regression equations. This could happen if, for example, some omitted variable causes both thirst and water drinking.

## Libraries

```
# install.packages("tidyverse")
# install.packages("knitr")
# install.packages("lavaan")
# install.packages("psych")
library(tidyverse)
library(knitr)
library(lavaan)
library(psych)
```

## Data

I combined the data from Table 3.1 in Mackinnon (2008, p. 56) [

mackinnon_2008_t3.1.csv] with those from Table 10.1 in Mackinnon (2008, p. 291) [mackinnon_2008_t10.1.csv.csv]

```
thirst.normal <- read_csv("data/mackinnon_2008_t3.1.csv")
thirst.fit <- read_csv("data/mackinnon_2008_t10.1.csv")
```

## Code new IDs for fit data

`thirst.fit$id <- 51:100`

## Add column in both datasets that identifies fitness group

Unfit = -0.5 and Fit = 0.5

```
thirst.normal$phys_fit <- -0.5
thirst.fit$phys_fit <- 0.5
```

## Bind unfit and fit data by rows

Imagine stacking these datasets on top of eachother

`thirst.data <- bind_rows(thirst.normal, thirst.fit)`

## Mean-center predictors

i.e., mean-center everything but the consume variable

```
thirst.data <- thirst.data %>%
mutate(id = factor(id),
room_temp_c = room_temp - mean(room_temp),
thirst_c = thirst - mean(thirst))
```

## Compute interaction terms

```
thirst.data <- thirst.data %>%
mutate(tmp_fit = room_temp_c * phys_fit,
thrst_fit = thirst_c * phys_fit)
```

### Print first and last five observations

```
thirst.data %>%
headTail() %>%
kable()
```

id | room_temp | thirst | consume | phys_fit | room_temp_c | thirst_c | tmp_fit | thrst_fit |
---|---|---|---|---|---|---|---|---|

1 | 70 | 4 | 3 | -0.5 | -0.13 | 0.87 | 0.06 | -0.44 |

2 | 71 | 4 | 3 | -0.5 | 0.87 | 0.87 | -0.44 | -0.44 |

3 | 69 | 1 | 3 | -0.5 | -1.13 | -2.13 | 0.56 | 1.06 |

4 | 70 | 1 | 3 | -0.5 | -0.13 | -2.13 | 0.06 | 1.06 |

NA | … | … | … | … | … | … | … | … |

97 | 71 | 4 | 4 | 0.5 | 0.87 | 0.87 | 0.44 | 0.44 |

98 | 71 | 4 | 5 | 0.5 | 0.87 | 0.87 | 0.44 | 0.44 |

99 | 70 | 3 | 3 | 0.5 | -0.13 | -0.13 | -0.06 | -0.06 |

100 | 71 | 4 | 3 | 0.5 | 0.87 | 0.87 | 0.44 | 0.44 |

### Save to data folder

```
thirst.data %>%
write_csv(path = "data/thirst.data.csv")
```

## Visualize relationships

It’s always a good idea to look at your data. Check some assumptions. See

`help(pairs.panels)`

for details.

```
thirst.data %>%
select(room_temp, room_temp_c, thirst, thirst_c, consume, phys_fit, tmp_fit, thrst_fit) %>%
pairs.panels(scale = FALSE, pch = ".")
```

## Conceptual Diagram

## Write model to test conditional indirect effect using `sem()`

from lavaan

`~`

= Regress onto …- Within the regression models, I label coefficients with the astrix.
`:=`

= Define a new parameter. Note when you define a new parameter with`:=`

, you can use the astrix to multiply values- For more details about lavaan syntax, see the tutorials tab at the lavaan website (linked in Resources below)

```
mod1 <- "# a path
thirst_c ~ 1 + a1 * room_temp_c
thirst_c ~ a2 * phys_fit
thirst_c ~ a3 * tmp_fit
# b paths
consume ~ b1 * thirst_c
# c prime path
consume ~ 1 + cp * room_temp_c
# index of moderated mediation and conditional indirect effects
b1a3 := b1 * a3
normss := a1 + a3 * -0.5
fitss := a1 + a3 * 0.5
norm := a1 * b1 + b1a3 * -0.5
fit := a1 * b1 + b1a3 * 0.5"
```

## Set random seed so results can be reproduced

`set.seed(1234)`

## Fit model

You must specify bootstrapping in the

`sem()`

function

`sem.fit1 <- sem(mod1, data = thirst.data, se = "bootstrap", bootstrap = 10000, likelihood = "wishart")`

## Summarize model

`standardized = TRUE`

adds standardized estimate to the model output. Also, see`help("standardizedsolution")`

`summary(sem.fit1, standardized = TRUE, fit.measures = TRUE)`

```
## lavaan 0.6-3 ended normally after 18 iterations
##
## Optimization method NLMINB
## Number of free parameters 9
##
## Number of observations 100
##
## Estimator ML
## Model Fit Test Statistic 2.800
## Degrees of freedom 2
## P-value (Chi-square) 0.247
##
## Model test baseline model:
##
## Minimum Function Test Statistic 52.141
## Degrees of freedom 7
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.982
## Tucker-Lewis Index (TLI) 0.938
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -284.018
## Loglikelihood unrestricted model (H1) -282.604
##
## Number of free parameters 9
## Akaike (AIC) 586.037
## Bayesian (BIC) 609.483
## Sample-size adjusted Bayesian (BIC) 581.059
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.064
## 90 Percent Confidence Interval 0.000 0.220
## P-value RMSEA <= 0.05 0.329
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.032
##
## Parameter Estimates:
##
## Standard Errors Bootstrap
## Number of requested bootstrap draws 10000
## Number of successful bootstrap draws 10000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## thirst_c ~
## rom_tmp_c (a1) 0.550 0.091 6.062 0.000 0.550 0.495
## phys_fit (a2) 0.195 0.199 0.979 0.328 0.195 0.086
## tmp_fit (a3) 0.422 0.182 2.322 0.020 0.422 0.190
## consume ~
## thirst_c (b1) 0.361 0.102 3.536 0.000 0.361 0.361
## rom_tmp_c (cp) 0.162 0.111 1.459 0.145 0.162 0.146
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .thirst_c 0.011 0.100 0.105 0.916 0.011 0.009
## .consume 3.130 0.103 30.507 0.000 3.130 2.760
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .thirst_c 0.975 0.111 8.826 0.000 0.975 0.759
## .consume 1.030 0.139 7.391 0.000 1.030 0.801
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## b1a3 0.153 0.084 1.824 0.068 0.153 0.069
## normss 0.339 0.103 3.294 0.001 0.339 0.400
## fitss 0.761 0.149 5.118 0.000 0.761 0.590
## norm 0.122 0.050 2.458 0.014 0.122 0.145
## fit 0.275 0.098 2.814 0.005 0.275 0.213
```

## Print all model parameters

in the

`boot.ci.type`

argument, I ask for bia-corrected and accelerated confidence intervals

```
parameterestimates(sem.fit1, boot.ci.type = "bca.simple", standardized = TRUE) %>%
kable()
```

lhs | op | rhs | label | est | se | z | pvalue | ci.lower | ci.upper | std.lv | std.all | std.nox |
---|---|---|---|---|---|---|---|---|---|---|---|---|

thirst_c | ~1 | 0.0105624 | 0.1002602 | 0.1053499 | 0.9160981 | -0.1862491 | 0.2032403 | 0.0105624 | 0.0093143 | 0.0093143 | ||

thirst_c | ~ | room_temp_c | a1 | 0.5498407 | 0.0906969 | 6.0623951 | 0.0000000 | 0.3721695 | 0.7288016 | 0.5498407 | 0.4953096 | 0.4848676 |

thirst_c | ~ | phys_fit | a2 | 0.1949841 | 0.1992617 | 0.9785328 | 0.3278109 | -0.1830427 | 0.5837960 | 0.1949841 | 0.0864048 | 0.1719434 |

thirst_c | ~ | tmp_fit | a3 | 0.4224961 | 0.1819807 | 2.3216538 | 0.0202516 | 0.0637116 | 0.7788684 | 0.4224961 | 0.1900669 | 0.3725710 |

consume | ~ | thirst_c | b1 | 0.3611336 | 0.1021207 | 3.5363404 | 0.0004057 | 0.1600216 | 0.5569571 | 0.3611336 | 0.3611336 | 0.3611336 |

consume | ~1 | 3.1300000 | 0.1025979 | 30.5074478 | 0.0000000 | 2.9287894 | 3.3330492 | 3.1300000 | 2.7601372 | 2.7601372 | ||

consume | ~ | room_temp_c | cp | 0.1624260 | 0.1113214 | 1.4590725 | 0.1445452 | -0.0600536 | 0.3759545 | 0.1624260 | 0.1463173 | 0.1432326 |

thirst_c | ~~ | thirst_c | 0.9754437 | 0.1105240 | 8.8256241 | 0.0000000 | 0.7970862 | 1.2282433 | 0.9754437 | 0.7585337 | 0.7585337 | |

consume | ~~ | consume | 1.0299148 | 0.1393513 | 7.3907821 | 0.0000000 | 0.8026152 | 1.3585829 | 1.0299148 | 0.8008921 | 0.8008921 | |

room_temp_c | ~~ | room_temp_c | 1.0435354 | 0.0000000 | NA | NA | 1.0435354 | 1.0435354 | 1.0435354 | 1.0000000 | 1.0435354 | |

room_temp_c | ~~ | phys_fit | -0.0252525 | 0.0000000 | NA | NA | -0.0252525 | -0.0252525 | -0.0252525 | -0.0491925 | -0.0252525 | |

room_temp_c | ~~ | tmp_fit | -0.1196970 | 0.0000000 | NA | NA | -0.1196970 | -0.1196970 | -0.1196970 | -0.2296847 | -0.1196970 | |

phys_fit | ~~ | phys_fit | 0.2525253 | 0.0000000 | NA | NA | 0.2525253 | 0.2525253 | 0.2525253 | 1.0000000 | 0.2525253 | |

phys_fit | ~~ | tmp_fit | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | |

tmp_fit | ~~ | tmp_fit | 0.2602525 | 0.0000000 | NA | NA | 0.2602525 | 0.2602525 | 0.2602525 | 1.0000000 | 0.2602525 | |

room_temp_c | ~1 | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | ||

phys_fit | ~1 | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | ||

tmp_fit | ~1 | -0.0250000 | 0.0000000 | NA | NA | -0.0250000 | -0.0250000 | -0.0250000 | -0.0490052 | -0.0250000 | ||

b1a3 | := | b1*a3 | b1a3 | 0.1525775 | 0.0836278 | 1.8244836 | 0.0680790 | 0.0263707 | 0.3565040 | 0.1525775 | 0.0686396 | 0.1345479 |

normss | := | a1+a3*-0.5 | normss | 0.3385926 | 0.1027928 | 3.2939329 | 0.0009880 | 0.1288965 | 0.5308572 | 0.3385926 | 0.4002762 | 0.2985821 |

fitss | := | a1+a3*0.5 | fitss | 0.7610887 | 0.1487184 | 5.1176511 | 0.0000003 | 0.4684899 | 1.0587656 | 0.7610887 | 0.5903431 | 0.6711531 |

norm | := | a1b1+b1a3-0.5 | norm | 0.1222772 | 0.0497408 | 2.4582868 | 0.0139602 | 0.0432260 | 0.2426515 | 0.1222772 | 0.1445532 | 0.1078280 |

fit | := | a1b1+b1a30.5 | fit | 0.2748547 | 0.0976629 | 2.8143210 | 0.0048880 | 0.1132200 | 0.5028420 | 0.2748547 | 0.2131927 | 0.2423760 |

## Interpretation

There was no sufficient evidence that physically fit people were thirstier than normal people,

a= 0.19 (_{2}S.E.= 0.2). Every 1°F increase in room temperature was associated with ana= 0.55 (_{1}S.E.= 0.09) increase in thirstiness units. However, this association was different between physically fit people and normal people,a= 0.42 (_{3}S.E.= 0.18). Adjusting for room temperature, every 1-unit increase in thirstiness was associated with drinkingb= 0.36 (_{1}S.E.= 0.1) more deciliters of water. Increases in room temperature were associated with increases in water drinking indirectly through increases in thirstiness, but there was no sufficient evidence that this indirect effect was different between physically fit and normal people,b= 0.15 (_{1}a_{3}S.E.= 0.08); a bias-corrected bootstrapped confidence interval with 10,000 samples for the index of moderated mediation captured zero, 95% CI []. Among normal people, for everya= 0.55 unit increase in the association between room temperature and thirstiness, there was an_{1}a= 0.12 (_{1}b_{1}+ a_{1}b_{3}S.E.= 0.05) increase in deciliters of water people drank. Among physically fit people, for everya= 0.55 unit increase in the association between room temperature and thirstiness, there was an_{1}a= 0.27 (_{1}b_{1}+ a_{1}b_{3}S.E.= 0.1) increase in deciliters of water people drank. Last, there was no sufficient evidence that room temperature was associated with how many deciliters of water people drank independent of its association with thirstiness,c’= 0.16 (S.E.= 0.11).

## Conceptual Diagram

## Write model to test conditional indirect effect using `sem()`

from lavaan

`~`

= Regress onto …- Within the regression models, I label coefficients with the astrix.
`:=`

= Define a new parameter. Note when you define a new parameter with`:=`

, you can use the astrix to multiply values- For more details about lavaan syntax, see the tutorials tab at the lavaan website (linked in Resources below)

```
mod2 <- "# a path
thirst_c ~ 1 + a1 * room_temp_c
# b paths
consume ~ 1 + b1 * thirst_c
consume ~ b2 * phys_fit
consume ~ b3 * thrst_fit
# c prime path
consume ~ cp * room_temp_c
# index of moderated mediation and conditional indirect effects
a1b3 := a1 * b3
normie := a1 * b1 + a1b3 * -0.5
fitie := a1 * b1 + a1b3 * 0.5"
```

## Fit model

You must specify bootstrapping in the

`sem()`

function

`sem.fit2 <- sem(mod2, data = thirst.data, se = "bootstrap", bootstrap = 10000)`

## Summarize model

`standardized = TRUE`

adds standardized estimate to the model output. Also, see`help("standardizedsolution")`

`summary(sem.fit2, standardized = TRUE, fit.measures = TRUE)`

```
## lavaan 0.6-3 ended normally after 17 iterations
##
## Optimization method NLMINB
## Number of free parameters 9
##
## Number of observations 100
##
## Estimator ML
## Model Fit Test Statistic 3.132
## Degrees of freedom 2
## P-value (Chi-square) 0.209
##
## Model test baseline model:
##
## Minimum Function Test Statistic 50.217
## Degrees of freedom 7
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.974
## Tucker-Lewis Index (TLI) 0.908
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -284.391
## Loglikelihood unrestricted model (H1) -282.825
##
## Number of free parameters 9
## Akaike (AIC) 586.782
## Bayesian (BIC) 610.228
## Sample-size adjusted Bayesian (BIC) 581.804
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.075
## 90 Percent Confidence Interval 0.000 0.226
## P-value RMSEA <= 0.05 0.288
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.038
##
## Parameter Estimates:
##
## Standard Errors Bootstrap
## Number of requested bootstrap draws 10000
## Number of successful bootstrap draws 10000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## thirst_c ~
## rom_tmp_c (a1) 0.497 0.086 5.765 0.000 0.497 0.447
## consume ~
## thirst_c (b1) 0.388 0.100 3.879 0.000 0.388 0.384
## phys_fit (b2) -0.259 0.201 -1.291 0.197 -0.259 -0.114
## thrst_fit (b3) -0.174 0.181 -0.956 0.339 -0.174 -0.086
## rom_tmp_c (cp) 0.150 0.109 1.382 0.167 0.150 0.134
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .thirst_c -0.000 0.100 -0.000 1.000 -0.000 -0.000
## .consume 3.136 0.103 30.342 0.000 3.136 2.757
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .thirst_c 1.018 0.114 8.963 0.000 1.018 0.800
## .consume 0.994 0.127 7.857 0.000 0.994 0.768
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## a1b3 -0.086 0.090 -0.960 0.337 -0.086 -0.038
## normie 0.236 0.080 2.938 0.003 0.236 0.191
## fitie 0.149 0.069 2.170 0.030 0.149 0.153
```

## Print all model parameters

in the

`boot.ci.type`

argument, I ask for bia-corrected and accelerated confidence intervals

```
parameterestimates(sem.fit2, boot.ci.type = "bca.simple", standardized = TRUE) %>%
kable()
```

lhs | op | rhs | label | est | se | z | pvalue | ci.lower | ci.upper | std.lv | std.all | std.nox |
---|---|---|---|---|---|---|---|---|---|---|---|---|

thirst_c | ~1 | 0.0000000 | 0.1004896 | 0.0000000 | 1.0000000 | -0.1977053 | 0.1995289 | 0.0000000 | 0.0000000 | 0.0000000 | ||

thirst_c | ~ | room_temp_c | a1 | 0.4966606 | 0.0861541 | 5.7647915 | 0.0000000 | 0.3222940 | 0.6611484 | 0.4966606 | 0.4474037 | 0.4401781 |

consume | ~1 | 3.1360731 | 0.1033571 | 30.3421015 | 0.0000000 | 2.9325325 | 3.3381810 | 3.1360731 | 2.7569399 | 2.7569399 | ||

consume | ~ | thirst_c | b1 | 0.3875517 | 0.0999001 | 3.8793904 | 0.0001047 | 0.1948483 | 0.5862785 | 0.3875517 | 0.3844165 | 0.3844165 |

consume | ~ | phys_fit | b2 | -0.2592200 | 0.2008515 | -1.2906054 | 0.1968405 | -0.6762858 | 0.1283304 | -0.2592200 | -0.1139409 | -0.2278818 |

consume | ~ | thrst_fit | b3 | -0.1735151 | 0.1814711 | -0.9561584 | 0.3389922 | -0.5541755 | 0.1553659 | -0.1735151 | -0.0858899 | -0.1525381 |

consume | ~ | room_temp_c | cp | 0.1503720 | 0.1087761 | 1.3823991 | 0.1668492 | -0.0709681 | 0.3587755 | 0.1503720 | 0.1343629 | 0.1321929 |

thirst_c | ~~ | thirst_c | 1.0182634 | 0.1136086 | 8.9629044 | 0.0000000 | 0.8157393 | 1.2675968 | 1.0182634 | 0.7998299 | 0.7998299 | |

consume | ~~ | consume | 0.9939832 | 0.1265148 | 7.8566577 | 0.0000000 | 0.8005745 | 1.3374866 | 0.9939832 | 0.7681770 | 0.7681770 | |

room_temp_c | ~~ | room_temp_c | 1.0331000 | 0.0000000 | NA | NA | 1.0331000 | 1.0331000 | 1.0331000 | 1.0000000 | 1.0331000 | |

room_temp_c | ~~ | phys_fit | -0.0250000 | 0.0000000 | NA | NA | -0.0250000 | -0.0250000 | -0.0250000 | -0.0491925 | -0.0250000 | |

room_temp_c | ~~ | thrst_fit | 0.0437000 | 0.0000000 | NA | NA | 0.0437000 | 0.0437000 | 0.0437000 | 0.0763566 | 0.0437000 | |

phys_fit | ~~ | phys_fit | 0.2500000 | 0.0000000 | NA | NA | 0.2500000 | 0.2500000 | 0.2500000 | 1.0000000 | 0.2500000 | |

phys_fit | ~~ | thrst_fit | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | |

thrst_fit | ~~ | thrst_fit | 0.3170500 | 0.0000000 | NA | NA | 0.3170500 | 0.3170500 | 0.3170500 | 1.0000000 | 0.3170500 | |

room_temp_c | ~1 | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | ||

phys_fit | ~1 | 0.0000000 | 0.0000000 | NA | NA | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | ||

thrst_fit | ~1 | 0.0350000 | 0.0000000 | NA | NA | 0.0350000 | 0.0350000 | 0.0350000 | 0.0621590 | 0.0350000 | ||

a1b3 | := | a1*b3 | a1b3 | -0.0861781 | 0.0897744 | -0.9599413 | 0.3370848 | -0.2818982 | 0.0733223 | -0.0861781 | -0.0384275 | -0.0671439 |

normie | := | a1b1+a1b3-0.5 | normie | 0.2355707 | 0.0801761 | 2.9381647 | 0.0033016 | 0.1030349 | 0.4261215 | 0.2355707 | 0.1912031 | 0.2027837 |

fitie | := | a1b1+a1b30.5 | fitie | 0.1493926 | 0.0688598 | 2.1695176 | 0.0300434 | 0.0249656 | 0.2984616 | 0.1493926 | 0.1527756 | 0.1356397 |

## Interpretation

Every 1°F increase in room temperature was associated with an

a= 0.5 (_{1}S.E.= 0.09) increase in thirstiness units. Adjusting for all other predictors, every 1-unit increase in thirstiness was associated with drinkingb= 0.39 (_{1}S.E.= 0.1) more deciliters of water. Also, adjusting for all other predictors, there was no sufficient evidence that physically fit people drank less water than normal people,b= -0.26 (_{2}S.E.= 0.2). There was also no sufficient evidence that the relation between thirstiness and water drinking depended on physical fitness group,b= -0.17 (_{3}S.E.= 0.18). Increases in room temperature were associated with increases in water drinking indirectly through increases in thirstiness, but there was no sufficient evidence that this indirect effect was different between physically fit and normal people,a= -0.09 (_{1}b_{3}S.E.= 0.09); a bias-corrected bootstrapped confidence interval with 10,000 samples for the index of moderated mediation captured zero, 95% CI []. Among normal people, for everya= 0.5 unit increase in the association between room temperature and thirstiness, there was an_{1}a= 0.24 (_{1}b_{1}+ a_{1}b_{3}S.E.= 0.08) increase in deciliters of water people drank. Among physically fit people, for everya= 0.5 unit increase in the association between room temperature and thirstiness, there was an_{1}a= 0.15 (_{1}b_{1}+ a_{1}b_{3}S.E.= 0.07) increase in deciliters of water people drank. Last, there was no sufficient evidence that room temperature was associated with how many deciliters of water people drank independent of its association with thirstiness,c’= 0.15 (S.E.= 0.11).

## Resources

- Hayes, A. F. (2015). An index and test of linear moderated mediation.
Multivariate Behavioral Research, 50(1), 1-22.- MacKinnon, D. P. (2008).
Introduction to statistical mediation analysis.New York, NY: Lawrence Erlbaum Associates.- Revelle, W. (2017) How to use the psych package for mediation/moderation/regression analysis. [
- Rosseel, Y. (2012). Lavaan: An R package for structural equation modeling and more. Version 0.5–12 (BETA).
Journal of statistical software, 48(2), 1-36. [website]- Rucker, D. D., Preacher, K. J., Tormala, Z. L., & Petty, R. E. (2011). Mediation analysis in social psychology: Current practices and new recommendations.
Social and Personality Psychology Compass, 5(6), 359-371. [

## General word of caution

Above, I listed resources prepared by experts on these and related topics. Although I generally do my best to write accurate posts, don’t assume my posts are 100% accurate or that they apply to your data or research questions. Trust statistics and methodology experts, not blog posts.