Hypothesis Testing II

Week 11

Maghfira Ramadhani

Oct 29, 2025

Plan

In today’s lecture, we will learn about:

  1. Finite sample hypothesis testing:
    1. Two-sided t-test (review)
    2. One-sided t-test
    3. Two sample t-test (testing difference in means)
  2. Asymptotic hypothesis testing (asymptotically normal estimators):
    1. Two-sided test
    2. One-sided test

Textbook Reference: JA 16.1 16.2, SDG 9.6

Two-sided test

For a two-sided test of an unknown parameter \(\theta\)

  • The null hypothesis is \[H_0:\theta=c,\]
  • The alternative hypothesis is \[H_1:\theta\neq c.\]
  • The hypothesis test of \(H_0\) determines whether there is statistical evidence to reject \(H_0\).

Two sided t-test rejection rules

Rejection rule based on t-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\mu=c\) if \(|\text{t-stat}|=\left|\frac{\bar{x}-c}{s_x/\sqrt{n}}\right|\geq t_{n-1,\alpha/2}\)

  • Do not reject \(H_0:\mu=c\) if \(|\text{t-stat}|=\left|\frac{\bar{x}-c}{s_x/\sqrt{n}}\right|< t_{n-1,\alpha/2}\)

P-value for two-sided t-test

The p-value of a test of the null hypothesis \(H_0\) is the smallest level \(\alpha^*\) such that the test rejects \(H_0\) at \(\alpha\)-level.

Rejection rule based on p-value (test at \(\alpha\)-level)
  • Reject \(H_0:\mu=c\) if \(\text{p-value}<\alpha\)

  • Do not reject \(H_0:\mu=c\) if \(\text{p-value}>\alpha\)

One-sided test

For a one-sided test of an unknown parameter \(\theta\)

  • The null and alternative hypothesis are \[H_0:\theta\geq c,\quad\quad H_1:\theta< c.\]
  • Another version of null and alternative hypothesis are \[H_0:\theta\leq c,\quad\quad H_1:\theta> c.\]
  • The hypothesis test of \(H_0\) determines whether there is statistical evidence to reject \(H_0\).

Investment Opportunity

  • Using our example of investment opportunity, we have n=10 sample of weekly sales with \(\bar{x}=11,200\) and \(s_x=3,400\).
  • Let \(\theta\) be the actual average weekly sales. We want to test \[H_0: \theta\leq 10,000\] against \[H_1: \theta>10,000\]

One sided t-test rejection rules

Rejection rule based on t-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\mu\geq c\) if \(\text{t-stat}=\frac{\bar{x}-c}{s_x/\sqrt{n}}\leq -t_{n-1,\alpha}\).
  • Do not reject \(H_0:\mu\geq c\) if \(\text{t-stat}=\frac{\bar{x}-c}{s_x/\sqrt{n}}> -t_{n-1,\alpha}\)


Rejection rule based on t-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\mu\leq c\) if \(\text{t-stat}=\frac{\bar{x}-c}{s_x/\sqrt{n}}\geq t_{n-1,\alpha}\)

  • Do not reject \(H_0:\mu\leq c\) if \(\text{t-stat}=\frac{\bar{x}-c}{s_x/\sqrt{n}}< t_{n-1,\alpha}\)

Investment Opportunity

  • Using our example of investment opportunity, we have n=10 sample of weekly sales with \(\bar{x}=11,200\) and \(s_x=3,400\).
  • Let’s test \(H_0: \theta\leq 10,000\).
  • The computed t-stat=1.116
  • The critical value \(t_{n-1,\alpha}\) are \(t_{n-1=9,\alpha=0.05}=1.833,\ t_{n-1=9,\alpha=0.1}=1.383.\)
# Calculate critical value for test H_0
qt(1-0.05,9)
[1] 1.833113
qt(1-0.1,9)
[1] 1.383029
  • Thus we can not reject \(H_0\) at 5% or 10% level.

P-value for one-sided t-test

The p-value of a test of the null hypothesis \(H_0\) is the smallest level \(\alpha^*\) such that the test rejects \(H_0\) at \(\alpha\)-level.


\[\text{p-value}=P\left(T<\frac{\bar{x}-c}{s_x/\sqrt{n}}\right) \text{ when }H_0:\mu\geq c \text{ is true, where }T\sim t_{n-1}.\]

\[\text{p-value}=P\left(T>\frac{\bar{x}-c}{s_x/\sqrt{n}}\right) \text{ when }H_0:\mu\leq c \text{ is true, where }T\sim t_{n-1}.\]


Rejection rule based on p-value (test at \(\alpha\)-level)
  • Reject \(H_0\) if \(\text{p-value}<\alpha\)

  • Do not reject \(H_0\) if \(\text{p-value}>\alpha\)

Investment Opportunity

  • Using our example of investment opportunity, we have n=10 sample of weekly sales with \(\bar{x}=11,200\) and \(s_x=3,400\).
  • Let’s test \(H_0: \theta\leq 10,000\).
  • The computed t-stat=1.116
  • What is the smallest \(\alpha\) that reject \(H_0\)? This is the p-value associated with t-stat=1.116
# Calculate p-value for test H_0
1-pt(1.116,9)
[1] 0.1466655
  • So a one-sided t-test does not reject \(H_0\) for any level below 14.7%

Two-sample t-test

What if you have two-sample and want to test difference in means, you’re working two an unknown parameter \(\theta_1\) and \(\theta_2\)

  • The null hypothesis is \[H_0:\theta_1 \leq \theta_2,\]
  • The alternative hypothesis is \[H_1:\theta_1>\theta_2.\]
  • The hypothesis test of \(H_0\) determines whether there is statistical evidence to reject \(H_0\).

Two-sample t-test

You have m sample of \(X\) and \(n\) sample of \(Y\). You want to test \(H_0:\mu_X\leq\mu_Y\).

Turns out you just need to update your t-statistics:

\[U=\frac{(m+n-2)^{1/2}(\bar{x}-\bar{y})}{\left(\frac{1}{m}+\frac{1}{n}\right)^{1/2}(s_{x}^2+s_{y}^2)^{1/2}}\sim t_{m+n-2}\]

The rejection rules are the same as before both for one-sided and two-sided (replace \(\alpha\) with \(\alpha/2\)).

Asymptotic hypothesis testing

  • Testing hypothesis for asymptotically normal estimators:
    • Example of asymptotically normal estimators (JA 13):
      • Sample mean: \(\bar{X}\overset{a}{\sim} N\left(\mu_X,\frac{\sigma^2_X}{n}\right)\)

      • Sample standard deviation: \(s_X\overset{a}{\sim} N\left(\sigma_X,\frac{E((X-\mu_X)^4)-(\sigma_X^2)^2}{4n\sigma_X^2}\right)\)

      • Sample median: \(\tilde{X}_{0.5}\overset{a}{\sim} N\left(\tau_{X,0.5},\frac{1}{4nf_X(\tau_{X,0.5})^2}\right)\)

      • Sample quantiles: \(\tilde{X}_{q}\overset{a}{\sim} N\left(\tau_{X,q},\frac{q(1-q)}{nf_X(\tau_{X,q})^2}\right)\)

      • Sample correlation: \(r_{XY}\overset{a}{\sim} N\left(\rho_{XY},\frac{(1-\rho_{XY}^2)^2}{n}\right)\)

    • Understanding the estimator will help you in understanding the estimates involved to do hypothesis testing.

Review two-sided test

For a two-sided test of an unknown parameter \(\theta\)

  • The null hypothesis is \[H_0:\theta=c,\]
  • The alternative hypothesis is \[H_1:\theta\neq c.\]
  • The hypothesis test of \(H_0\) determines whether there is statistical evidence to reject \(H_0\).

Asymptotic two-sided test

Rejection rule based on z-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\theta=c\) if \(|\text{z-stat}|=\left|\frac{\hat{\theta}-c}{se(\hat{\theta})}\right|\geq z_{\alpha/2}\)

  • Do not reject \(H_0:\theta=c\) if \(|\text{z-stat}|=\left|\frac{\hat{\theta}-c}{se(\hat{\theta})}\right|< z_{\alpha/2}\)

P-value for two-sided test

The p-value of a test of the null hypothesis \(H_0\) is the smallest level \(\alpha^*\) such that the test rejects \(H_0\) at \(\alpha\)-level.

\[\text{p-value}=P\left(|Z|<\left|\frac{\hat{\theta}-c}{se(\hat{\theta})}\right|\right) \text{ when }H_0:\theta= c \text{ is true, where }Z\sim N(0,1).\]

Rejection rule based on p-value (test at \(\alpha\)-level)
  • Reject \(H_0:\theta=c\) if \(\text{p-value}<\alpha\)

  • Do not reject \(H_0:\theta=c\) if \(\text{p-value}>\alpha\)

Asymptotic one-sided test

Rejection rule based on z-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\theta\geq c\) if \(\text{z-stat}=\frac{\hat{\theta}-c}{se(\hat{\theta})}\leq -z_{\alpha}\)
  • Do not reject \(H_0:\theta\geq c\) if \(\text{z-stat}=\frac{\hat{\theta}-c}{se(\hat{\theta})}> -z_{\alpha}\)


Rejection rule based on z-statistics (test at \(\alpha\)-level)
  • Reject \(H_0:\theta\leq c\) if \(\text{z-stat}=\frac{\hat{\theta}-c}{se(\hat{\theta})}\geq z_{\alpha}\)

  • Do not reject \(H_0:\theta\leq c\) if \(\text{z-stat}=\frac{\hat{\theta}-c}{se(\hat{\theta})}< z_{\alpha}\)

P-value for one-sided test

The p-value of a test of the null hypothesis \(H_0\) is the smallest level \(\alpha^*\) such that the test rejects \(H_0\) at \(\alpha\)-level.


\[\text{p-value}=P\left(Z<\frac{\hat{\theta}-c}{se(\hat{\theta})}\right) \text{ when }H_0:\theta\geq c \text{ is true, where }Z\sim N(0,1).\]

\[\text{p-value}=P\left(Z>\frac{\hat{\theta}-c}{se(\hat{\theta})}\right) \text{ when }H_0:\theta\leq c \text{ is true, where }Z\sim N(0,1).\]


Rejection rule based on p-value (test at \(\alpha\)-level)
  • Reject \(H_0:\theta=c\) if \(\text{p-value}<\alpha\)

  • Do not reject \(H_0:\theta=c\) if \(\text{p-value}>\alpha\)

Next week

  • Lab 4 on Monday: practice hypothesis testing
  • Project proposal presentation on Wednesday:
    • Order of presentation will be announced on Monday
    • Plan for 4 minutes presentation and 2 minutes for Q&A.