Below, I’ve embedded a Python Jupyter Notebook hosted on Kyso, which is a hub where you, “can publish Jupyter notebooks, charts, code, datasets and write articles in our custom markdown editor.” This is a work in progress while I teach myself Python (here is the original Kyso post, nmmichalak/python_selfteach).

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 a correlation? A correlation quantifies the linear association between two variables. From one perspective, a correlation has two parts: one part quantifies the association, and the other part sets the scale of that association.
The first part—the covariance, also the correlation numerator—equates to a sort of “average sum of squares” of two variables:
\(cov_{(X, Y)} = \frac{\sum(X - \bar X)(Y - \bar Y)}{N - 1}\) It could be easier to interpret the covariance as an “average of the X-Y matches”: Deviations of X scores above the X mean multipled by deviations of Y scores below the Y mean will be negative, and deviations of X scores above the X mean multipled by deviations of Y scores above the Y mean will be positive.

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.

Powered by the Academic theme for Hugo.