Hypothesis Tests

Definitions

Testing Steps

  1. Decide on the hypothesis you’re going to test
  2. Choose your test statistic
  3. Determine the critical region for your decision
  4. Find the p-value of the test statistic
  5. See whether the sample result is within the critical region
  6. Make your decision

Example

drug company claims a drug cures 90% of patients in 2 weeks. Here's a doctor's data:

Cured? Yes No
Frequency 11 4
  1. H0:p=0.9, H1:p<0.9
  2. X∼B(15,0.9)
  3. P(X<c<α) where α=5%
  4. P(X≤11)=1−P(X≥12)=0.0555
  5. P(X≤11)>α
  6. therefore we fail to reject H0

Errors

Accept H0 Reject H0
H0 True ✅ Type I error
H0 False Type II error ✅
Power=1−β

Example

drug company claims a drug cures 90% of patients in 2 weeks. Here's a doctor's data:

Cured? Yes No
Frequency 80 20

P(TypeIerror)=0.05
H0:p=0.9, H1:p=0.8
Find values outside critical region: P(Z<−1.64)=0.05→Z≥−1.64
De-standardize to find X assuming H0 is true where X∼N(90,9): $$\frac{X-90}{3}\geq -1.64\rightarrow X\geq 85.08$$
Find P(X≥85.08), assuming that H1 is true where X∼N(80,16):

z=85.08−8016=1.27P(Z≥1.27)=1−P(Z<1.27)=0.102P(TypeIIerror)=0.102Power=1−P(TypeIIerror)=0.898

This means that the probability that we will make the correct decision to reject the null hypothesis is 0.898

χ2 Distribution

Use Cases

Two Variables
Goodness of Fit or Independence

Steps

  1. Decide on the hypothesis you’re going to test, and its alternative
  2. Find the expected frequencies and the degrees of freedom
  3. Determine the critical region for your decision
  4. Calculate the test statistic X2
  5. See whether the test statistic is within the critical region
  6. Make your decision
Distribution Condition ν
Binomial You know what p is $$\nu=n-1$$
Binomial You don’t know what p is, and you have to estimate it from the observed frequencies $$\nu=n-2$$
Poisson You know what λ is $$\nu=n-1$$
Poisson You don’t know what λ is, and you have to estimate it from the observed frequencies $$\nu=n-2$$
Normal You know what μ and σ2 are $$\nu=n-1$$
Normal You don’t know what μ and σ2 are, and you have to estimate them from the observed frequencies $$\nu=n-3$$
Sources: 1

Connect With Me!