When an effect depends on another
Today let's understand what happens when one factor's effect on an outcome is not the same size for every level of another factor.
An online course platform wants more visitors to sign up for a free account. So it tests a banner on its landing page: either a plain "Sign up" banner, or one that mentions a discount on the first paid course. It shows this banner to two kinds of visitors, New visitors who have never been to the site before, and Returning visitors who have been there before. Over twelve days, it ran each of the four combinations of visitor group and banner for three separate days, and recorded each day's sign-up rate as a percent of visitors who signed up.
Here are all twelve days, plotted together first, then split into one small chart per visitor group.
Flip the toggle. In the combined chart, Discount's bars sit a little ahead of Plain's throughout. Once each visitor group gets its own small chart, that gap looks the same size in New's panel and in Returning's panel.
Two simple effects, one for each group
Let's put real numbers on what that chart showed, and give that gap its proper name.
Build the twelve days into a data frame, then get each of the four group-banner combinations' average sign-up rate.
group and banner are stored as factors, R's name for a categorical variable with a fixed set of levels. R would order them alphabetically by default, which would put Discount before Plain. The levels are set explicitly here instead, Plain first and Discount second, so that choice is deliberate rather than left to chance, and it will matter later. tapply() then splits signup by group and banner together and averages each of the four resulting cells.
Now ask the same question within each visitor group separately: how much higher is the Discount banner's average sign-up rate than Plain's?
Both come out to 2.000 percentage points. The banner's effect measured within one specific level of the other factor, here within New or within Returning, is called its simple effect. New's simple effect of the banner is +2.000, and Returning's simple effect is also +2.000: the same number, computed completely separately from two different sets of six days.
That will not always happen.