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

• Dec 16th 2009, 05:51 AM
tDM
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?
• Dec 16th 2009, 05:19 PM
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.
• Dec 17th 2009, 01:27 AM
tDM
Quote:

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?
• Dec 17th 2009, 07:47 AM
matheagle
once again....what is your sample size?
• Dec 17th 2009, 07:56 AM
tDM
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.
• Dec 17th 2009, 07:58 AM
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.
• Dec 17th 2009, 08:06 AM
tDM
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".
• Dec 17th 2009, 08:11 AM
tDM
Quote:

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

That's the title.

Quote:

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?
• Dec 17th 2009, 08:14 AM
matheagle
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
• Dec 17th 2009, 08:27 AM
tDM
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?