# Thread: How does one perform a Paired Sample t-Test with binary data?

1. ## How does one perform a Paired Sample t-Test with binary data?

I have before and after responses (0 or 1) for each participant and would like to know how to analyze it.
Is it performed exactly like a normal paired sample t-test or do I need to do something different because the responses are binary?

2. binary is Binomial
Hence you use the Binomial distribution if the sample size is small
And you can use the normal approximation (Central Limit Theorem) if n is large.
The t distribution is incorrect.

3. Originally Posted by matheagle
binary is Binomial
Hence you use the Binomial distribution if the sample size is small
And you can use the normal approximation (Central Limit Theorem) if n is large.
The t distribution is incorrect.
So which test is it?

4. once again....what is your sample size?

5. Around 700, it will vary.

I know binary is binomial but how do I actually test it?

Example data:

Code:
|Participant | Before | After |
| 1          |   0    |   1   |
| 2          |   1    |   1   |
| 3          |   0    |   0   |
| 4          |   0    |   1   |
| 5          |   0    |   0   |
| 6          |   1    |   1   |
| 7          |   1    |   1   |
| .          |   .    |   .   |
| .          |   .    |   .   |
| .          |   .    |   .   |
H0: The treatment has no effect.
H1: The treatment has an effect.

6. USE the normal approximation to the binomial
It can be found in every undergrad stat book and I'm sure it's online too.
Gauss proved it 200 years ago.
It's the most basic CLT.
-------------------------------------------
But this seems to be a paired difference test (same person)?
You have two populations
Hence you should subtract one set from the other
and perform a one sample test.
Are you trying to prove that there is an improvement?

Let $Y_i= X_{i2}-X_{i1}$

Then use $S=\sum_{i=1}^n Y_i$

Under the null, S has mean 0.
Use the CLT, the rejection region is via the normal.

calculate the variance of S and obtain a test stat.

7. My apologies: I understand that I'm probably quite frustrating but...

The binomial relies upon me knowing the probability of getting a 0 or 1.

Put it this way, if the data was numerical (not binary) I would point the enquirer in this direction: Paired Sample T-Test

This explains how to test the hypothesis and which test statistic to use.

All you've said so far is "use the normal approximation to the binomial".

8. But this seems to be a paired difference test (same person)?

That's the title.

Originally Posted by matheagle
USE the normal approximation to the binomial
It can be found in every undergrad stat book and I'm sure it's online too.
Gauss proved it 200 years ago.
It's the most basic CLT.
-------------------------------------------
But this seems to be a paired difference test (same person)?
You have two populations
Hence you should subtract one set from the other
and perform a one sample test.
Are you trying to prove that there is an improvement?

Let $Y_i= X_{i2}-X_{i1}$

Then use $S=\sum_{i=1}^n Y_i$

Under the null, S has mean 0.
Use the CLT, the rejection region is via the normal.

calculate the variance of S and obtain a test stat.
So it's the same as a regular paired t-test but checked against the normal dist instead of the t-dist?

9. the data is dependent and it's not normally distributed
hence it's not a t
you either need the exact distribution
or you use a large sample and approximate with the CLT

10. Ok, ok.

So the calculation is...?

"How to do a hypothesis test on a before and after experiment where the responses were binary" in three easy steps...

Anything?