compare that to a chi-squared with one degree of freedom.

And again, we're rejecting for large values, right?

Because this is the distance between the observed and the expected

counts, we favor the alternity of the further away from the expected

counts we are, so the bigger the test statistic is, is going

to favor the alternative, so we're going to reject for large values.

So lets do pchi

squared 8.96.

It's one degree of freedom when you have a 2 by 2 table.

I am going to give you a general role when you don't have a 2 by 2 table.

And we say lower tail goes false, because we want

the upper probability, not the lower probability, the result is 0.002.

In the other way you can think about this of'course is chi

square with one degree freedom, is actually the square of \a standard normal.

So it's unlikely for a standard normal to be above two or

below minus-two, right?

There's only a 5% chance of that happening.

So Chi-squared, it's unlikely going to be above four, right?

The square of two and the square of minus-two.

So that's going to have about 5% probability, so chi-squared over about

four is about the same benchmark as a normal of about two.

A chi-squared of about nine is

about the same as a standard normal for about three.

Again, remembering that you're testing both bigger than two and less than

two, or bigger than three and less than three, because remember the chi-squared.

Always does a two sided test.

So in this case, the result is 0.002, there is some evidence

to suggest that there is a difference in the rate of side

effects between the two treatments, though of course the side effect, the

result of the chi squared test doesn't tell you which direction it goes.

[INAUDIBLE]

Okay. So that's how we do it.

And here's some simple R code for executing it in R E, so you don't have to

do the calculations with a calculator. so we just create a data matrix.

It's this matrix command here, and then chisq.test(dat).

And then, you'll notice, if you do this, you

don't get exactly the same test statistic that we got.

And the reason is because the chi-squared approximation