Introduction.

This is a worksheet for use with Lecture 6.

You have a video of me narrating these slides. Note that there are potentially minor discrepancies between the current set of slides and the one in the video. The slide numbers refer to the current set. I do not cover every single slide but you can code along!

If you answer correctly the colour of the box will change! (Don't worry about bonus questions, they are very much just that: a bonus!)

Slides

What is a mediation? (Slide 5)

Mediation has occurred when:

  1. The strength of the relationship between a predictor variable and an outcome variable is reduced by including another variable in the model.
  2. The strength of the relationship between a predictor variable and an outcome variable is increased by including another variable as a predictor.
  3. The relationship between two variables changes as a function of a third variable.
  4. The relationship between two variables decreases as a function of a third variable.

My answer:

Which of the following is an example of perfect mediation?

  1. The strength of the relationship between the predictor and the outcome is reduced by exactly half when the mediator is included in the model.
  2. The relationship between the predictor and the outcome remains the same when the mediator is included in the model.
  3. The relationship between the predictor and the outcome is completely wiped out when the mediator is included in the model.
  4. The interaction of the predictor and the mediator significantly predicts the outcome, but the variables themselves do not.

My answer:

You can read in more detail here. The section on complete versus partial mediation might hold a clue.

Check diagrammer tutorial? (Slide 12)

Suppose I would want to change how the tail of the arrow looks, which aesthetic ('aes') of the edge would we change?

My answer:

Have a look at the code on the slide and in particular 'edge'. Remember that you can look into the help panel and then look at the edge aesthetics (edge_aes)

How would you report it (Slide 26)

Have a look at the figure above. What would be 'a' and 'b' for our fictional example with X,M,Y (2 decimals, no need to include * annotation)?

a =

b =

Remember that these are standardised coefficients in the diagram (\(\beta's\)). So you'll have to calculate these! Look back over your session 4 slides if you don't remember how to do this.

Remember that there is no intercept in a model

a corresponds to step 2

b corresponds to step 3

Try it yourself. (Slide 27)

Use the information on the previous slides.

Three measures (Slide 31)

What was the Aroian z value for our example? (2 decimals)

Aroian =

Look back at slide 29

Plot (Slide 35)

Complete the blanks below.

0.51 corresponds to path and 0.59 corresponds to path.

If you are MS Windows, then .eps you won't be able to open it straightaway. You can open it with Adobe products. Or you can rewrite the code with win.metafile(). Remember in earlier lectures we also write figures away as .jpg or .png.

??win.metafile()

Try it yourself. (Slide 36)

Use the information on the previous slides.

Summary (Slide 40)

Notice the rounding has changed slightly.

The results suggest a complete mediation. (True of False)

The direct effect is no longer statistically significant. 90% of the effect is mediated (.9).

Exercise (Slide 47-48)

Complete the exercise and submit via Blackboard!

When it comes Imai et al.'s 'default' method note that you cannot have more than one mediator. If you want multiple mediators, look into ??multimed.

(Note that this is a toy example!)

Going further.

Session Info.

Thanks to Lisa DeBruine for the webex package. Some of the multiple choice questions are from Discovering Statistics by Andy Field. Please see general disclaimer.

sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] webexercises_1.0.0
## 
## loaded via a namespace (and not attached):
##  [1] digest_0.6.31   R6_2.5.1        jsonlite_1.8.4  evaluate_0.20  
##  [5] highr_0.10      cachem_1.0.7    rlang_1.1.0     cli_3.6.1      
##  [9] rstudioapi_0.14 jquerylib_0.1.4 bslib_0.4.2     rmarkdown_2.21 
## [13] tools_4.2.1     xfun_0.38       yaml_2.3.7      fastmap_1.1.1  
## [17] compiler_4.2.1  htmltools_0.5.5 knitr_1.42      sass_0.4.5

The end...