# # # Please participate in the R&SS Client Feedback Survey. # https://unt.az1.qualtrics.com/SE/?SID=SV_diLLVU9iuJZN8C9 # # ################################################################################################# # # ############ Evaluating MEDIATION with Aroian Test and Regression ############ # # Using the MacKinnon (2008) data from Chapter 3, page 56 (available on the R_SC web page). # This script assumes you have downloaded and installed all available packages. # Packages needed for this script will be noted as "library(xxxxx)" where xxxxx # refers to the required package/library to be loaded. # Make sure you have the R-Commander library loaded. library(foreign) library(Rcmdr) # Use the 'foreign' library to load the "MediationExample.sav" data file. med.ex <- read.spss("http://bayes.acs.unt.edu:8083:8083/BayesContent/class/Jon/R_SC/Module9/MediationExample.sav", use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE) # From here on, simply use this script; submitted or pasted into the # R Console. attach(med.ex) med.ex2 <- data.frame(X, M, Y) detach(med.ex) attach(med.ex2) head(med.ex2) cor(med.ex2) # Equation (1): The mediator (M) predicted by the independent variable (X). reg1 <- lm(M~X) summary(reg1) # Equation (2): The dependent variable (Y) predicted by the independent variable (X). reg2 <- lm(Y~X) summary(reg2) # Equation (3): The dependent variable (Y) predicted by the mediator (M) and the independent variable (X). reg3 <- lm(Y~M+X) summary(reg3) # AROIAN Z-TEST (1944/1947) similar to SOBEL (1982). Aroian is slightly more strict (conservative) than Sobel. # Now take the following four values from the output of regression equation (1) and regression equestion (3). First # we need a, which is the unstandardized coefficient of the IV (X) when predicting the mediator (M); which can be # found in the output of regression equation (1). Here, a = 0.3386. Next we need Sa, which is the standard error # of a; also found in the output of regression equation (1). Here, Sa = 0.1224. Next we need b, which is the # unstandardized coefficient for the mediator (M) from the output of regression equation (3). Here, b = 0.4510. Next # we need Sb, which is the standard error of b; also found in the output of regression equation (3). Here, Sb = 0.1460. # Now, we can plug these values into the Aroian equation: # a * b / sqrt(b^2 * Sa^2 + a^2 * Sb^2 + Sa^2 * Sb^2) # Pluggin in the values from the output, we get the following: Z.calc = .3386 * .4510 / sqrt(.4510^2 * .1224^2 + .3386^2 * .1460^2 +.1224^2 * .1460^2) Z.calc # Given that the calculated Z-value (2.003344) is greater than the critical Z-value for a two-tailed test at # alpha = .05 (1.96); we can say that we have a significantly different from zero mediation effect. # Going further, we can calculate the confidence interval for our effect. The estimated mediation effect is equal # to a*b which for the current example is: est.eff = .3386 * .4510 est.eff # Then we can get the standard error of the mediation effect with the following equation: # sqrt(a^2 * Sb^2 + b^2 * Sa^2) # which for our example is: std.err.eff = sqrt(.3386^2 * .1460^2 + .4510^2 * .1224^2) std.err.eff # So now, using our critical Z-value (+/- 1.96) and the calculated mediation effect (and standard error for it) we # can construct our upper and lower 95% confidence limits. # Upper.Limit = 0.1527086 + 1.96*.07410252 UL = est.eff + 1.96*std.err.eff UL # Lower.Limit = 0.1527086 - 1.96*.07410252 LL = est.eff - 1.96*std.err.eff LL # So, our confidence interval for our estimated mediation effect is (0.2979495, 0.00746766). #### REFERENCES #### # Aroian, L. A. (1944/1947). The probability function of the product of two normally distributed variables. Annals of # Mathematical Statistics, 18, 265-271. # Clark, M. J. (2004). Moderators and Mediators. RSS Matters, August, 2004. # (http://www.unt.edu/benchmarks/archives/2004/august04/rss.htm). # MacKinnon, D. P. (2008). Introduction to Statistical Mediation Analysis. New York: Lawrence Erlbaum Associates. # Sobel, M. E. (1982). Asymptotic intervals for indirect effects in structural equations models. In S. Leinhart (Ed.), # Sociological methodology 1982 (pp.290-312). San Francisco: Jossey-Bass. # # Please participate in the R&SS Client Feedback Survey. # https://unt.az1.qualtrics.com/SE/?SID=SV_diLLVU9iuJZN8C9 # # End.