68
Two-Sample Z Test Explanation

What is a two sample z test?

Embed Size (px)

DESCRIPTION

Two Sample Z Test

Citation preview

Page 1: What is a two sample z test?

Two-Sample Z TestExplanation

Page 2: What is a two sample z test?

A two-sample Z test is used to compare the differences statistically between two sample proportions.

Page 3: What is a two sample z test?

A two-sample Z test is used to compare the differences statistically between two sample proportions.

Consider the following question:

Page 4: What is a two sample z test?

A two-sample Z test is used to compare the differences statistically between two sample proportions.

Consider the following question:

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 5: What is a two sample z test?

What are the researchers asking here?

Page 6: What is a two sample z test?

What are the researchers asking here?

They are trying to determine if there is a difference in reported anxiety symptoms between those taking the new anti-anxiety drug and those taking the placebo.

Page 7: What is a two sample z test?

What are the researchers asking here?

They are trying to determine if there is a difference in reported anxiety symptoms between those taking the new anti-anxiety drug and those taking the placebo.

What makes this question one that can be answered using a two-sample Z test is the fact that we are examining the difference between proportions (64 out of 200 or .32 compared to 92 out 200 or .46).

Page 8: What is a two sample z test?

What are the researchers asking here?

They are trying to determine if there is a difference in reported anxiety symptoms between those taking the new anti-anxiety drug and those taking the placebo.

What makes this question one that can be answered using a two-sample Z test is the fact that we are examining the difference between proportions (64 out of 200 or .32 compared to 92 out 200 or .46).

Are these differences similar enough to make any differences we would find if we were to repeat the experiment to be due to chance or not?

Page 9: What is a two sample z test?

With that in mind, we are able to state the null-hypothesis and then determine if we will reject or fail to reject it:

Page 10: What is a two sample z test?

With that in mind, we are able to state the null-hypothesis and then determine if we will reject or fail to reject it:

There is NO significant proportional difference in reported anxiety symptoms between a sample of

participants who took a new anti-anxiety drug and a sample who took a placebo.

Page 11: What is a two sample z test?

Since the test uses a .05 alpha value, that is what we will use to determine if the probability of a meaningful difference is rare or common.

Page 12: What is a two sample z test?

Since the test uses a .05 alpha value, that is what we will use to determine if the probability of a meaningful difference is rare or common.

The alpha value makes it possible to determine what is called the z critical. If the z statistic that we are about to calculate from the data in the question is outside of the z critical [for a one-tailed test (e.g., +1.64) or a two-tailed test (e.g., -1.96 or +1.96]

Page 13: What is a two sample z test?

One tailed test visual depiction:

rarecommon

+1.64

If the z value we are about to

calculate lands above this point, we will reject the null hypothesis

Page 14: What is a two sample z test?

One tailed test visual depiction:

rarecommon

+1.64

If the z value lands below this point

we will fail to reject the null

hypothesis

Page 15: What is a two sample z test?

A one tailed test could also go the other direction if we are testing the probability of one sample having a smaller proportion than another.

rare common

-1.64

Page 16: What is a two sample z test?

A two-tailed test implies that we are not sure as to which direction it will go. We don’t know if the placebo or the new anxiety medicine will have better results.

Page 17: What is a two sample z test?

Here is a visual depiction of the two-tailed test.

rare

-1.96

Common rare

+1.96

Page 18: What is a two sample z test?

All we have left to do now is calculate the z statistic.

Page 19: What is a two sample z test?

All we have left to do now is calculate the z statistic.Here is the formula for the z statistic for a Two-Sample Z-Test:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(�̂�1− �̂�2)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

Page 20: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(�̂�1− �̂�2)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

Page 21: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(�̂�1− �̂�2)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 22: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(�̂�1− �̂�2)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 23: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(�̂�1− �̂�2)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

92/200=.4664/200=.32

Page 24: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=( .32− .46 )

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

92/200=.4664/200=.32

Page 25: What is a two sample z test?

In the numerator we are subtracting one sample proportion from another sample proportion:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(−.𝟏𝟐)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 26: What is a two sample z test?

The denominator is the estimated standard error:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(− .12)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2Researchers want to test the effectiveness of a new anti-

anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

This proportion is called the pooled

standard deviation. It is the same value

we use with independent

sample t-tests.

Page 27: What is a two sample z test?

The denominator is the estimated standard error:

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(− .12)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

It is interesting to note that when you multiply a proportion (.80) by its complement (1-.8 = .20)

you get the variance (.80*.20 = .16).If you square that amount it comes to .04 and that

is the standard deviation.

Page 28: What is a two sample z test?

Why is this important? Because the standard deviation divided by the square root of the sample size is the standard error.

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(− .12)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

It is interesting to note that when you multiply a proportion (.80) by its complement (1-.8 = .20)

you get the variance (.80*.20 = .16).If you square that amount it comes to .04 and that

is the standard deviation.

Page 29: What is a two sample z test?

And the larger the standard error the less likely the two groups will be statistically significantly different.

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(− .12)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

It is interesting to note that when you multiply a proportion (.80) by its complement (1-.8 = .20)

you get the variance (.80*.20 = .16).If you square that amount it comes to .04 and that

is the standard deviation.

Page 30: What is a two sample z test?

Conversely, the smaller the standard error the more likely the two groups will be statistically significantly different.

𝒁 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄=(− .12)

√�̂� (1−�̂� ) √ 1𝑛1+ 1𝑛2

It is interesting to note that when you multiply a proportion (.80) by its complement (1-.8 = .20)

you get the variance (.80*.20 = .16).If you square that amount it comes to .04 and that

is the standard deviation.

Page 31: What is a two sample z test?

So, let’s compute the pooled standard deviation:

Page 32: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=𝑥1+𝑥2𝑛1+𝑛2

Page 33: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=𝑥1+𝑥2𝑛1+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Here’s the problem again:

Page 34: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=𝑥1+𝑥2𝑛1+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 35: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+𝑥2𝑛1+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 36: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+𝑥2𝑛1+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 37: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+𝑥2200+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 38: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+𝑥2200+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 39: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+92200+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 40: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+92200+𝑛2

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 41: What is a two sample z test?

So, let’s compute the pooled standard deviation:

�̂�=64+92200+200

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

Page 42: What is a two sample z test?

Add the fractions:

�̂�=64+92200+200

Page 43: What is a two sample z test?

Add the fractions:

�̂�=156

200+200

Page 44: What is a two sample z test?

Add the fractions:

�̂�=156

200+200

Page 45: What is a two sample z test?

Add the fractions:

�̂�=156200

Page 46: What is a two sample z test?

Add the fractions:

�̂�=.78

Page 47: What is a two sample z test?

Now we plug this pooled proportion:

�̂�=.78

Page 48: What is a two sample z test?

Now we plug this pooled proportion:

into the standard error formula in the denominator

�̂�=.78

Page 49: What is a two sample z test?

Now we plug this pooled proportion:

into the standard error formula in the denominator

�̂�=.78

Page 50: What is a two sample z test?

Now we plug this pooled proportion:

into the standard error formula in the denominator

�̂�=.78

Page 51: What is a two sample z test?

Now we plug this pooled proportion:

into the standard error formula in the denominator

Page 52: What is a two sample z test?

Now we plug this pooled proportion:

into the standard error formula in the denominator

Page 53: What is a two sample z test?

Now we plug this pooled proportion:

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒)

√ .𝟏𝟕𝟐√ 1𝒏𝟏+ 1𝑛2

Page 54: What is a two sample z test?

Now we need to calculate n or the sample size:

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒)

√ .172√ 1200

+ 1𝑛

Page 55: What is a two sample z test?

Now we need to calculate n or the sample size:

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒)

√ .172√ 1200

+ 1200

Page 56: What is a two sample z test?

Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing, 64 out of 200 people taking the medication report symptoms of anxiety. Of the

people receiving a placebo, 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the

placebo? Test this claim using alpha = 0.05.

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒)

√ .172√ 1200

+ 1200

Now we need to calculate the Zstatistic

Page 57: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒 )

√ .172√ 2200

Now we need to calculate the Zstatistic

Page 58: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒 )

√ .172√ 1100

Now we need to calculate the Zstatistic

Page 59: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒)

√ .172√ .01

Now we need to calculate the Zstatistic

Page 60: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(− .𝟏𝟒 )√ .172(.1)

Now we need to calculate the Zstatistic

Page 61: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(− .𝟏𝟒 )

(.414)(.1)

Now we need to calculate the Zstatistic

Page 62: What is a two sample z test?

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=(−.𝟏𝟒).0414

Now we need to calculate the Zstatistic

Page 63: What is a two sample z test?

Now we need to calculate the Zstatistic

𝑍 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐=−3 .379

Page 64: What is a two sample z test?

Let’s see where this lies in the distribution:

rare

-1.96

Common rare

+1.96

Page 65: What is a two sample z test?

Let’s see where this lies in the distribution:

rare

-1.96

Common rare

+1.96-3.38

Page 66: What is a two sample z test?

Because -3.38 is outside the -1.96 range we consider it to be a rare occurrence and therefore we will reject the null hypothesis and accept the alternative hypothesis:

Page 67: What is a two sample z test?

Because -3.38 is outside the -1.96 range we consider it to be a rare occurrence and therefore we will reject the null hypothesis and accept the alternative hypothesis:

There was a significant difference in effectiveness between the medication group and the placebo group, z = -3.379, p < 0.05.

Page 68: What is a two sample z test?

Because -3.38 is outside the -1.96 range we consider it to be a rare occurrence and therefore we will reject the null hypothesis and accept the alternative hypothesis:

In summary

A two-sample Z test is used to compare the differences statistically between two sample proportions.

There was a significant difference in effectiveness between the medication group and the placebo group, z = -3.379, p < 0.05