So just a slight variation of the previous example.

What if x is a, instead of x being a normal random variable,

what if x is a binary random variable, so member it, maybe it represents gender or

maybe it's some treatment versus control or something like that.

So here, and it's very simple, I can generate binary data from the,

using the binomial distribution and the rbinom function.

So, I set the seed again.

And I generate a 100 binomial random variables and

these are going to have these, this, this if from, this comes from

the binomial distribution which is n equals to 1 and p equals to half.

So, the probability of one is going to be equal to 0.5.

So I generate a hundred of those.

And then I generate my normal random variables.

My normal error term which is going to be mean zero and standard deviation two.

And then I add them all together which should produce my y.

So now I look at the summary of y.

I see the mean is about 1.4, and the range is about from minus 3 to six or seven.

So when I, now when I plot the data,

of course they'll look very different, because the x variable is binary.

But the y variable is still continuous, it's normal.

So here you can see that there's, there appears to be a pretty clear,

again, linear trend when, between going from x equals to 0 and x equals to 1.