Here's the final example like this I'd like to show, and

this just considers an instance where we would surely get this wrong

if we were to assume the slopes were common across the two groups.

Obviously, the slopes are different.

And we know how to fit a model like this.

If we were to fit a model that said,

y = beta naught + beta 1 * our treatment effect,

+ beta 2 * x, + beta 3 treatment, * x + epsilon.

That would fit two lines with different intercepts and different slopes,

and we could get a fit like to this data set.

Another important thing to ascertain for

this data set is there is no such thing as a treatment effect.

If you look right here, the red and the blue,

there's no evidence of a treatment effect.

If you look right here, there's a big evidence that blue

has a higher outcome than red, and if you look over here,

there's a lot of evidence that red has a higher outcome than blue.

And the reason, the interaction is the reason

that this main treatment effect doesn't have a lot of meaning.

The end result is that this coefficient,

the coefficient in front of the treated effects, which just spits out of course,

is not interpreted as the treatment effect by itself.

You can't interpret that number as a treatment effect.

As we can see from this picture,

there is no such thing as a treatment effect for this data.

The treatment effect depends on what level of x you're at.

So you can't just read the term from the regression

output associated with the treatment and act as if it's a treatment effect,

if in fact, you have an interaction term in your model.

So that's an important point, but this also just goes to show how adjustment can

really change things if you have a setting like this where you have not just

adjustment, but so-called modification.

Okay, so again that was a crazy simulation.

This just summarizes some of the points.

You often see interactions, but

you rarely see interactions that start, but still, nonetheless, they can occur.

And then I want to reiterate that nothing we've talked about is specific to having

a binary treatment and a continuous x.

In this case here, we have our same outcome, y.

But in our x1 variable is continuous and our x2 is continuous, but because

it's kinda hard to show 3 variables at the same time, x2 is color coded.

So higher lighter values mean higher, and

more red darker values means lower, okay?

So in this case, if you look at this plot you would say there isn't much of

a relationship between y and x1, however,

lets look at this in three dimensions, and then I need a different setting.

I need something where I can rotate the plot around.

So, I'm going to use RGL, and it's pretty easy.

You can, this doesn't show how I generated the x1, x2, and y,

that's in the mark down document, but here, I'll show you how to get it.

So there's the plot or data set that's equivalent cuz I reran the simulation.

And here's our plot.

So here's exactly that plot recreated,