 Hello, it's Dr. Oliver Perre here, and in this presentation, which is the first of a series of three, I will introduce some key concepts about mediation and moderation. So in this first presentation, I will first talk about the key differences between mediation and moderation. I will then introduce a simple mediation model and provide a practical example using some packages in R of how to run a mediation model. And I will then finally talk about the case against the causal approach or the Baron and Kenny approach. So I'll start by providing a definition of what is mediation and what is moderation and what differentiates these two. A mediator is a variable that accounts, at least in part, for the relation between a predictor and an outcome. In other words, in mediation we assume that a predictor x influences the outcome y indirectly and thus that by influencing a mediating variable med, which in turn influences the outcome y. For example, here the predictor may be a treatment that we apply on our terrain to ensure that our plants grow. But the mediator may be the presence of fungi and other organisms in the terrain, which prevents the growth of our plants. So the mediate the treatment works by removing fungi and thus removing factors that hinder the growth of our plants. Another example may be a peer support program that may reduce symptoms of major depression, but this program acts by increasing self-efficacy, the belief that someone has in their own ability to tackle issues, which in turn may reduce symptoms of depression. So a moderator is instead a variable that qualifies the association between a predictor and an outcome. What it means is that the strength of the association or even the sign of the association between predictor and outcome changes depending on the values of the moderator. I'll provide a simple example here. For example, we can manipulate the strength of an argument in favor of environmental taxes, for example, highlighting key benefits that may accrue from a policy of increasing environmental taxes. And we can then test if stronger arguments influence changes in attitudes of the participants. Stronger arguments may lead to greater changes in attitudes. However, the relation between strength of the arguments and changes in attitudes may depend on how much an individual is personally engaged with these issues. And for example, people that are more engaged in these issues will consider the arguments more attentively and carefully. And because of the deeper processing of the messages, there may be more influence by the strength of the arguments. So in this example, the situation may take this form. Personal involvement varies from more or less. And depending on this, the person may be more responsive to strong arguments. That is, if they are more involved, they will be more influenced by the strength of the argument. But people that are less engaged or involved with the policies may be less likely to change attitudes when they are presented with strong arguments. So in other words, the strength of the association between the predictor and the outcome here represented by the red arrows changes conditionally on the context, the moderator variable. So it should be clear at this point that the study of mediation involves questions about how predictors influence outcomes. Or as what are the chains of events that lead from a predictor to an outcome or changes in the outcome. I have provided some simple examples where there is only mediator, but mediation can deal with scenarios where the predictor is the first step in a chain of events. That are causally related. Moderation instead concerned the study of how contextual factors influence relations between predictors and outcomes. Or in other words, in which situations do predictors influence outcomes or what are the characteristics of people for whom a predictor leads to a certain outcome. I will now present a simple mediation model introducing some formula equations and concepts regarding mediation. In a simple mediation model we have three variables. X is a predictor and in this example X is an exogenous variable. Its value does not depend on other variables in the model. X may be an experimental variable, for example a treatment that randomly selected group of participants receive and which is withheld among a second group of participants. Or it may be an exposure some event that participants have experienced in their life, for example traumatic experiences. The predictor is supposed to influence the other two variables in the model, the outcome Y and the mediator M. In this sense, these variables are endogenous in the model. They depend from another variable in the model. So the predictor X influences the mediator M and the mediator also influences Y, the outcome. So X can influence the outcome Y directly but can also influence Y indirectly by influencing M which in turn exerts an effect on Y. So in many applications these pathways take the name A, B, C and C is the direct effect from predictor X to outcome Y. But X can also influence Y through an indirect pathway, one that involves A, the effect of X on M and one that involves B, the effect of M on Y. Not that for the time being I'm not considering when these variables have been measured. And in principle mediation models can be applied to cross-sectional studies where the three variables are observed at the same time on the same occasion. However, mediation models are causal models. They are making assumptions about which variables are causes of other variables. And this means that why it is possible from a mathematical statistical point of view to assume that X causes Y and the influence of X on Y is exerted through M, even when these measures are taken on the same occasion. Arguing that these variables are causally related requires more than just statistics. I will talk more about these but for the time being it's important to remember that in a mediation model we're making assumptions about causality and these assumptions need to have further justifications beyond the statistical model. But working with this model, if the endogenous variables M and Y are continuous variables, we cannot apply ordinary least squares methods to estimate the values of these variables as a function of X in a similar way in which we do and run linear regression. So we have a first endogenous variable M which we assume is a function of X. We assume this variable has an intercept M which represents the value of M when X equals 0. And we also assume we observe this variable with arrow and the uncertainty in our measurement of M is represented by the term EM which usually we assume is normally distributed with mean 0 and the variance we can estimate. We build a similar model for Y but in this case the values of Y are influenced by the values of M as well as the values of X. So as well as an intercept which represents the values of Y when M and X are equal to 0. So we have a term C, a coefficient C that represents the rate of change in Y for one point increase in X and a term B that represents the rate of change in Y for one point increase in M and a term EY which represents the uncertainty in the measure of Y. Now I can use these equations to give a more formal definition of the direct and indirect effects represented in the graph. The direct effect from X to Y is represented by path C which is formally defined as the difference in estimated value of Y associated with a one unit change in X while keeping M constant or as Y controlling for the mediator M. And you can see this definition here in the slide where Y with a hat represents the estimated value of Y. The first part of this equation says that C is equal to the estimated value of Y conditional on X taking value X and M taking value M minus the estimated value of Y when X is reduced by one unit and M is still equal to M or as is constant. In other words, the pathway C represents the difference in estimated values of Y for one unit change in X while keeping M constant, keeping the moderator constant. That is, it's the adjusted difference between levels of X. Effects where treatment has only two values, one for treatment, zero for control condition, C represents the expected adjusted treatment effect that is adjusted while controlling for the mediator M. So using the same logic and the same formula, we can say that A, the pathway A represents the estimated difference in the moderator M associated with one unit change in X. B represents the estimated difference in Y associated with one unit change in M while holding X constant, so controlling for X. Finally, the indirect effect from X to Y, that is the effect of X on Y through M, the moderator M, is represented by the product of A and B. We can also calculate the total effect from X to Y, which is the sum of the direct effect and the indirect effect A by B. Formally, the total effect is the estimated difference in Y for one unit change of X. Using this formula, we can also see that the indirect effect from X to Y, that is, AB, is equal to the difference between the total effect and the direct effect C. So we can use this difference between total effect and direct effect to estimate the indirect effect. However, this works when we are dealing with continuous outcomes and ordinary square models. If M and Y were estimated using other functions, for example logit or Poisson, the partition of the total effect into other effects would be more complicated. We'll now provide a practical example of how to run a mediation model. And for this example, I'm going to run a script that is available with the course material so you can run the example on your computer. And the data here are data regarding students that had been assessed in the United States using standardized course of maths and reading when the students were in grade 8 and grade 12. Some of these students attended private high schools and here in the slide you can see how to upload the data. So in this example, I'm assuming that high income, which is a binary variable, represents children who are in families with the highest income. High income of the family during grade 8 influences the math scores in grade 12. However, I also assume in this model that part of the fact of higher family income on math scores is transmitted through reading scores in grade 8. So grade 8 reading scores here is the mediator of the fact of family income. Using ordinary these squares equations, we assume that reading scores in grade 8 are a linear function of high family income and math scores in grade 12 are a linear function of high family income and reading scores in grade 8. So we can use our function for estimating these regressions and so we can estimate that the slope of high income on reading scores is 4.67. And by running the other regression, we can estimate the value of the C path and the B path. So how much reading influences maths and how much high income influences math scores directly. So we can use the coefficients from these regressions to calculate the indirect effect of high income on grade 12 math scores. So taking the A and B estimates, we can multiply them to obtain an estimate of the indirect effect. So here the indirect effect will be around approximately 2.80, give or take because of rounding arrows. But these effects can be estimated in a simpler way using the macro process which has been developed by Professor Hayes. This is available for R and also other software and here I put an example of how to write the commands to estimate the effects that I presented before. The data option allows you to indicate the data set to be used and then the outcome predictor-mediator are selected as Y, X and M respectively. Total equal 1 means we are also requesting to estimate the total effect from X to Y. If we didn't want to estimate this effect, we would write total equal 0. And note that here we report the un-standardized effects. So the effects reported are in the metric of the outcomes but we can also ask process to report standardized results whereby the effects are expressed, the coefficients are expressed in standard deviation units in respect to the outcomes. I will focus on the normal option here. When running this model, we want to test for the significance of the indirect effect. So whether the indirect effect of an income through reading is significantly different from 0. In this case, this effect is not estimated from linear regression equations and therefore there is a problem of how we should estimate its standard error and what underlying distribution we should assume for the indirect effect. Traditionally, the solution has been to derive the standard error of AB from the indirect effect from estimates of standard errors of the pathway A and the path B respectively. And to assume that the sampling distribution of AB direct effect is normal. In the literature, you will find these assumptions referred to as the Sobel test. However, this approach is no longer recommended for different reasons. One key reason is that the assumption that the sampling distribution of the indirect effect AB is normal has been proved to be not attainable in many cases. And the approach has also been proven to have less power to defect effects compared to other approaches. So a different approach is needed. One that is often used is bootstrapping, which is a sampling method where the observations from a sample are re-sampled with replacement in order to derive a representation of the sampling distribution of the parameter of interest. In this case, the sample, you can see the command here. The option boot is asking to re-sample our sample 10,000 times, creating a sampling distribution of the observed statistic. The sampling distribution is then used to estimate confidence intervals of the statistic which we can use to test if we can reject the null hypothesis that the statistic is equal to zero. Because the sampling distribution is estimated from re-sampling, no assumptions about the shape of the underlying distribution of the statistic are necessary. And in this example, when you run it on your computer, you will see that 95% confidence intervals of the indirect effect are between 2.51 to 3.13 roughly, which do not include zero, so we can reject the null hypothesis of the indirect effect being equal to zero. To conclude, I will talk about an approach to testing mediation that has been quite popular in the recent past, the causal steps approach. This approach was based on a paper by Baron and Kenney, and it asked first to run a test of the total effect from X to Y. If this effect is not significantly different from zero, then all testing and modeling stops. But if the test is statistically significant, then a second precondition for mediation is that X affects Y, so the path A is significantly different from zero. If this precondition is also met, then we can test if M affects Y, so if the path B is also significantly different from zero. And if this third criterion is also met, then we can compare the total effects of X on Y against the indirect effect. And there is also an emphasis in considering whether the effect of X on Y is completely mediated by the mediator M or only partially mediated. Now, many of us also are quite skeptical about using language that refers to complete mediation of effect or partial mediation of the effect. And you can read more about this in the references attached with this module. But one problem with this approach is that it is cumbersome. There are too many tests. And if we want to test a hypothesis about mediation, the key test we need is the test of the indirect effect. Furthermore, the indirect effect A, B may be significantly different from zero, even if the effects A and B are not. And the inference regarding A, B should be based on the tests of this effect known on singular estimations of the effects A and B. And finally, the causal step approach stops if there isn't a total effect that is significantly different from zero. However, it is possible that there may be an indirect effect that is significantly different from zero, even if the total effect is not significantly different from zero. And that is because one, we need to keep in mind that the total effect is the sum of different effects that may have different signs. That said, it also may happen that even when the effects have all the same sign, the indirect effect may be estimated more precisely than the direct effect, whereas the direct effect may be estimated with more uncertainty. And if this is the case, the estimated total effect will also have larger uncertainty, which makes it more difficult to reject the null hypothesis. It is possible to identify significant indirect effects even when the total effect is not significantly different from zero. So the causal steps approach is no longer being considered as the way to test mediation and in the references attached with this module, you can read more about this. So in this first presentation, I have introduced a key distinction between mediation and moderation, highlighting that mediation concerns questions about causal mechanisms, how a treatment or an exposure influence an outcome through different processes that involve other constructs. Moderation instead investigates the context in which effects from a predictor to an outcome may change in a strength or design. I have introduced a simple mediation model and provided examples of how to estimate the different facts in the model using ordinarily the square methods. I have also emphasised that the key test is the test of significance of the indirect effect, i.e. the indirect effects through the mediator. So we do not need to apply the cumbersome causal approach to the study of mediation. The final warning concerns the fact that mediation models are causal models. They make assumptions about causal relations between variables, but causality cannot be proven by statistical models alone. So it is important to apply restraint and consideration in building mediation models. So thank you very much for your attention. Bye now.