Hypothesis Testing: Concept and Operation

Large N & Leeuwenhoek (70700173)

Yue Hu

Overview

  • Understand hypothesis testing
  • Test hypotheses

1 Understand hypothesis testing

1.1 Function of Hypothesis

Theory (logic) → real world (conceptually)

Ideal world (?) vs. real world (theoretically)

Random distribution vs. empirical distribution (statistically)

  • Identification ⇒ Statement (hypothetically)

Inferences (coefficients + confidence)

Implications

1.2 How to get the coefficients

Probability: The chance of occurrence of Xi given the PDF of X, P(O|θ).

Likelihood : How probable a given set of observations is for certain values of the parameters of a distribution, ℒ(θ|O) = \(\prod_{i=1}^n y_i\)1

1.3 How to get confidence

Parametric

Nonparametric

1.4 Format

  • Null: ℒ(null): Y = β0 + ε (Random distribution)
  • Theoretical: ℒ(theory): Y = β0 + β1X + ε (Your thought)

Hypothesis framing ABC

  • Assertion normative statement
  • Observable
  • Clear direction

2 Test hypotheses

2.1 Statistical Foundations

Law of Large Number(LLN): For a sample with size n of a random variable X,

\[{\displaystyle \lim _{n\to \infty }\sum _{i=1}^{n}{\frac {X_{i}}{n}} = \lim _{n\to \infty }\bar{X} = \mu.} \]

Central limit theorem (CLT): For a random sample of n, X̄ fluctuate around μ with an uncertainty,

\[When\ n \rightarrow \infty, Pr(\bar X) \sim \mathcal{N(\mu, \sigma)}. \]

When n gets larger…

‍LLN: X̄ will approach to μ
‍CLT: X̄ will distribute normally.

Contradictory?

2.2 Steps (parametric test)

  1. An observed sample;
  2. Making the IID assumption;
  3. Set up the null (and alternative) hypotheses
  4. Set the confidence level;
  5. Compare the X̄ with μ.

2.3 IID

  1. An observed sample;
  2. Making the IID assumption;1
    • Identical: X and Y are from the same distribution, \({\displaystyle F_{X}(x)=F_{Y}(x)\,\forall x\in I}\)
    • Independent: \({\displaystyle F_{X,Y}(x,y)=F_{X}(x)\cdot F_{Y}(y)\,\forall x,y\in I}\)
  3. Set up the null (and alternative) hypotheses
  4. Set the confidence level;
  5. Compare the X̄ with &mu.

2.4 Hypothesis Setting

  1. An observed sample;
  2. Making the IID assumption;
    • Identical: X and Y are from the same distribution, \({\displaystyle F_{X}(x)=F_{Y}(x)\,\forall x\in I}\)
    • Independent: \({\displaystyle F_{X,Y}(x,y)=F_{X}(x)\cdot F_{Y}(y)\,\forall x,y\in I}\)
  3. Set up the null (and alternative) hypotheses
    • H0: Specifying values for one or more population parameters in a random distribution (μ, π rather than X̄, P);
    • H1: the population parameter is something other than the value in the stochastic status;
  4. Set the confidence level;
  5. Compare the X̄ with &mu.

2.5 Confidence Interval

  1. An observed sample;
  2. Making the IID assumption;
    • Identical: X and Y are from the same distribution, \({\displaystyle F_{X}(x)=F_{Y}(x)\,\forall x\in I}\)
    • Independent: \({\displaystyle F_{X,Y}(x,y)=F_{X}(x)\cdot F_{Y}(y)\,\forall x,y\in I}\)
  3. Set up the null (and alternative) hypotheses
    • H0: Specifying values for one or more population parameters in a random distribution (μ, π rather than X̄, P);
    • H1: the population parameter is something other than the value in the stochastic status;
  4. Set the confidence level;
    • 1 - α
  5. Compare the X̄ with &mu.

2.6 About alpha

Decision H0 T H0 F
Reject Type I error (Pr = α) Pr = 1 - β
Fail to Reject Pr = 1 - α Type II error (Pr = β)

2.7 Why 0.05

It’s not arbitrary, α = 0.05 ⇒ 1 - α = 0.95 (one-tailed) or 0.975 (two tailed)

Well…it’s actually arbitrary annnnnnnnnnd qualitative.

2.8 How to get p < 0.05

习近平在中央党校(国家行政学院)中青年干部培训班开班式上的讲话(2022年3月1日)

守住拒腐防变防线,最紧要的是守住内心,从小事小节上守起,正心明道、怀德自重,勤掸“思想尘”、多思“贪欲害”、常破“心中贼”,以内无妄思保证外无妄动。

2.9 Deploy Hypothesis testing

  1. An observed sample;
  2. Making the IID assumption;
  3. Set up the null (and alternative) hypotheses
  4. Set the confidence level;
  5. Compare the X̄ with μ, two steps:
    • SE
    • Critical value / Confidence intervals

2.10 Standard Error (Review)

\[SE(\bar X) = \frac{s}{\sqrt{n}}.\]

E.g. Given the population mean as 69 and standard deviation as 3.2, how would the mean of a random sample of four observations fluctuate?

\[\begin{align} E(\bar X) =& \mu = 69; \sigma = 3.2, \\ \therefore SE(\bar X) =& \frac{3.2}{\sqrt 4} = 1.6. \end{align}\]

2.11 Correct SE

Finite population correction

For small population, not small sample.

  • FPC: Without replacement, SE of X̄ ⇒ uncertainty overestimated ⇒ correction: \(\sqrt{\frac{N - n}{N - 1}}\)
    • n = 1 (sampling only one sample), Then \(SE = \frac{\sigma}{\sqrt{n}}\sqrt{\frac{N - n}{N - 1}} = \frac{\sigma}{\sqrt{n}}\);
    • n = N (sampling all), SE = 0.
    • n = 1000, N = 100,000,000 (large sample of a large population), \(FPC = \sqrt{\frac{100000000 - 1000}{100000000 - 1}}\approx .999\), little changes.
    • n = 100, N = 108 (large sample of a small population), \(FPC = \sqrt{\frac{108 - 100}{108 - 1}}\approx 0.075\), some changes.

2.12 What does the FPC correct

2.13 Statistical Test: Individual Level

  • SE → Z(t)-score →
    1. Critical values (z/t), or
    2. Confidence intervals

\[Z = \frac{\bar X - \mu}{SE}= \frac{\bar X - \mu}{\sigma/\sqrt n}.\]

E.g. Given \(\mu\) = 72 and \(\sigma\) = 9, and a random sample of 10. Calculate the probabilities of P(X > 80) and P(X̄ > 80)

\(Z = \frac{80 - 72}{9} = .89\Rightarrow P(Z > .89) =\) 0.1867;

\(Z = \frac{80 - 72}{9/\sqrt{10}} = 2.81\Rightarrow P(Z > 2.81) =\) 0.0025.

2.14 Statistical Test: Aggregated Level

  • SE → Z(t)-score →
    1. Critical values (z/t), or
    2. Confidence intervals

\[Z = \frac{P - \pi}{\sqrt{\frac{\pi(1 - \pi)}{n}}}.\]

E.g., Given the Republican are 60% of the U.S. population, what’s the probability that the Republican are the minority in a random sample of 100 people from the national population?

Minority means \(P(\pi < 0.5)\).

Then, \(Z = \frac{0.5 - 0.6}{\sqrt{\frac{0.6(1 - 0.6)}{100}}} =\) -2.0412, therefore, P(Z < 2.0412) = 0.0206.

2.15 Full Process Illustration

Given a virus can influence 10% of the population. Now there’s a sample of senior people, n = 527, within which there are 14% infected. Are senior people more likely to be victimized?

  • Assuming the sample is IID sampled and \(H_0: \pi \leq 10; H_1: \pi > 10.\)
  • α = 0.05
  • Confidence-interval method:
    • \(\pi = 0.14 \pm 1.96 * \sqrt{\frac{0.14 * (1 - 0.14)}{527}} = 0.14 \pm 0.03,\) that is [0.11, 0.17] > 0.1. \(H_0.\) rejected.
  • Critical value method
    • \(Z_{obs} = \frac{P - \pi}{\sqrt{\frac{\pi(1 - \pi)}{n}}} = \frac{14 - 10}{\sqrt{\frac{0.1 * 0.9}{527}}} = 3.06.\) Given the level of \(\alpha = 0.05\), \(Z_{critical}\) = 1.96 < \(Z_{obs}\),1 therefore reject the \(H_0.\)

2.16 Take-home point

Appendix

Stretch

Meditation

松茸的世界:5分钟正念冥想-自信之心