Docsity

Hypothesis Testing - Introduction to Statistics - Lecture Notes | STAT 101, Study notes of Statistics

Partial preview of the text

Download Hypothesis Testing - Introduction to Statistics - Lecture Notes | STAT 101 and more Study notes Statistics in PDF only on Docsity!

Hypothesis Testing

The idea of hypothesis testing is: โ— Ask a question with two possible answers โ— Design a test, or calculation of data โ— Base the decision (answer) on the test Example: In 2010, 24% of children were dressed as Justin Bieber for Halloween. We want to test whether or not this proportion increased in 2011.

Constructing a Hypothesis Test

โ— Define your Null and Alternative Hypotheses โ— (^) H 0 (pronounced โ€œH naughtโ€) is the null hypothesis. This is typically the default assumption โ€“ assuming no change, or that a new drug is no better than a placebo. โ— (^) H A is the alternative hypothesis. This is typically your hunch, that there has been a change, or that the drug works better than the placebo, or a claim that you are trying to debunk.

Alternative Hypothesis

โ— The Alternative Hypothesis is chosen to match a claim that is being tested, or something you hope is true. โ— Say we are testing for a proportion p. Null Hypothesis is p=p 0

โ— (^) If the Alternative Hypothesis is p>p 0 , or if it is p<p 0 , these are examples of a one-sided test. โ— (^) If the alternative is pโ‰ p 0 , this is called a two- sided test.

Calculate a Test Statistic

โ— For a hypothesis test about population proportion, sample proportion is a good test statistic (if the conditions of the CLT are met, we can use the normal distribution) Example: We randomly poll 1000 children who dressed up for Halloween in 2011. 254 of them dressed up as Justin Bieber, so our sample proportion is.

Calculating P-Values (1-sided tests)

โ— (^) p is normal with ฮผ=p 0 , ฯƒ=โˆš(p 0 (1-p 0 )/n) โ— Calculate x/n, the proportion from our observed sample. โ— (^) Case1: H 0 : p=p 0 vs. H A : p>p 0 P-Value= P[p>x/n | p=p 0 ] =normalcdf(x/n,1,ฮผ,ฯƒ) โ— (^) Case2: H 0 : p=p 0 vs. H A : p<p 0 P-Value= P[p<x/n | p=p 0 ] =normalcdf(0,x/n,ฮผ,ฯƒ)

^

^

^

Example: Calculate P-Value

We are using a 5% significance level. โ— (^) If we assume H 0 true, then p, our sample proportion, is normal with ฮผ=.24 and ฯƒ=โˆš(.24*.76/1000)=. โ— (^) P[p>.254|H 0 ] =normalcdf(.254,1,.24,.0134) =. โ— This is not less than our .05 significance level, so we do not reject the null hypothesis The evidence is not strong enough to support the claim that Justin Bieber costumes were more popular in 2011 than in 2010.

^

^

Visual Hypothesis Test

H

0 : p=p 0 vs. H A : p<p 0 5% significance level By CLT, p is normal with ฮผ=p 0 , ฯƒ=โˆš(p 0 q 0 /n) Calculate x/n, our observed sample proportion Distribution of p p 0 5% 95% If x/n is here, do not reject H 0 If x/n is here, we WILL reject H 0 ^

^

(Assuming H 0 is true)

2-Sided Test

โ— A Two tailed test looks like this: H 0 : p=p 0 vs. H A :pโ‰ p 0 , 5% significance level Distribution of p p 0 2.5% 95% If x/n is here, do not reject H 0 If x/n is here, we WILL reject H 0 2.5% If x/n is here, we WILL reject H 0 ^ (Assuming H 0 is true)

Example- 2-sided test

In 1996, 25% of students who had perfect attendance one month would also have perfect attendance the following month. In 2000, the school wants to see if the proportion has changed. The proportion of a random sample of 6543 students is 23.4%. With a 5% significance level, should the school conclude that there has been a change? โ— (^) H 0 : proportion is still 25%, H A : proportion is not 25% โ— (^) Under the null hypothesis, p is normal with mean 0.25 and s.d โˆš(.25.75/6453)=. โ— (^) Standardized proportion is z=(.234-.25)/.00535 =-2. โ— (^) P value is 2P[Z>2.9907] = 2*normalcdf(2.9907,6)=. โ— (^) This is less than .05, so we reject the null hypothesis; there has been a change in attendance. ^

Test using Z-Statistic

You can calculate the P-Value using a z-score: Assume null hypothesis: ฮผ=p 0 , ฯƒ=โˆš(p 0 q 0 /n) X/n is our sample proportion. z=(x-ฮผ)/ฯƒ The P-value depends on the form of H A : โ— (^) H A :p>p 0 โ†’ P-Value = P(Z>z)=normalcdf(z,6) โ— (^) H A :p<p 0 โ†’ P-Value = P(Z<z)=normalcdf(-6,z) โ— (^) H A :pโ‰ p 0 โ†’ P-Value = 2P(Z>|z|)=2*normalcdf(|z|,6) Remember, for 2-tailed test use |z| (absolute value)