Hypothesis Testing
300Hours Learn Lab Curriculum Reading | Topic: HYPOTHESIS TESTING | Qualification: CFA LEVEL1
# Hypothesis Testing # Hypothesis Testing Hypothesis testing provides a formal statistical framework for making decisions using sample data. Risk managers rely on hypothesis testing to evaluate portfolio performance, validate quantitative models, and test trading strategies: Is a new trading algorithm genuinely generating alpha, or was its performance driven purely by luck? Is our Value at Risk (VaR) model accurately capturing risk, or is it underestimating potential tail losses? ## The Null and Alternative Hypotheses Every statistical hypothesis test begins by establishing two mutually exclusive competing claims: * **Null Hypothesis ($H_0$):** The default baseline assumption, status quo, or statement of "no effect" or "no difference." It is the hypothesis that we explicitly attempt to test and potentially reject. The null hypothesis *always* contains an equality condition ($=$, $\le$, or $\ge$). * *Example:* A portfolio manager's true excess $\mu$) is zero: $H_0: \mu = 0$. * **Alternative Hypothesis ($H_a$ or $H_1$):** The operational claim we wish to establish. It represents a change, a structural difference, or a non-zero effect. * *Example:* The portfolio manager generates positive excess return: $H_a: \mu > 0$. ## One-Sided vs. Two-Sided Tests The orientation of the alternative hypothesis determines whether the hypothesis test is one-tailed or two-tailed: * **Two-Sided (Two-Tailed) Test:** Applied when we seek to detect a deviation in *either* direction (greater than or less than the hypothesized value). * $H_0: \mu = 0$ * $H_a: \mu \neq 0$ * **One-Sided (One-Tailed) Test:** Applied when we are interested exclusively in a directional deviation. * **Right-Tailed Test:** $H_0: \mu \le 0$ versus $H_a: \mu > 0$. * **Left-Tailed Test:** $H_0: \mu \ge 0$ versus $H_a: \mu changed or is different , select a two-sided test. If it asks whether a parameter has increased , outperformed , or exceeded a threshold , select a one-sided test. The critical value for a two-sided test at a 5\% significance level is 1.96, whereas for a right-tailed one-sided test at 5\%, it is 1.645. Exam Tip ## Type I and Type II Errors Because hypothesis testing relies on sample data rather than complete population census data, testing carries an inherent probability of error. | Decision | $H_0$ is Actually True | $H_0$ is Actually False | | :--- | :--- | :--- | | **Reject $H_0$** | **Type I Error** (False Positive, Probability = $\alpha$) | Correct Decision (Power = $1 - \beta$) | | **Fail to Reject $H_0$** | Correct Decision (Confidence Level = $1 - \alpha$) | **Type II Error** (False Negative, Probability = $\beta$) | ### Type I Error (Significance Level, $\alpha$) A Type I error occurs when we reject a true null hypothesis. In risk management, this corresponds to concluding a risk model is broken when it is actually performing correctly, or hiring an unskilled manager based on random luck. * The probability of committing a Type I error is denoted by $\alpha$ (alpha), which defines the **Significance Level** or **Size** of the test. Standard values for $\alpha$ are 1\%, 5\%, or 10\%. ### Type II Error ($\beta$) and Statistical Power A Type II error occurs when we fail to reject a false null hypothesis. This corresponds to keeping a failing VaR model because we lacked sufficient data to prove its inaccuracy. * The probability of a Type II error is denoted by $\beta$ (beta). * The **Power of a Test** is defined as $1 - \beta$. It represents the probability of correctly rejecting a false null hypothesis. * **The Trade-Off:** For a fixed sample size ($n$), decreasing $\alpha$ (making it harder to reject $H_0$) automatically increases $\beta$ (lowering the power of the test). To reduce both $\alpha$ and $\beta$ simultaneously, you must increase the sample size $n$. ## Rejection Regions, Test Statistics, and Confidence Intervals To decide whether to reject $H_0$, we calculate a standardized **test statistic** from sample data and compare it against a **critical value**. ### Calculating the Test Statistic When testing a single population mean $\mu$ with unknown population variance, we use the sample mean $\bar{x}$, sample standard deviation $s$, and sample size $n$ to compute a t-statistic: $ t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}} $ Where $s / \sqrt{n}$ is the **standard error** ($\text{SE}$) of the sample mean. ### Step-by-Step Numerical Example Suppose a risk analyst tests a hedge fund's monthly return over $n = 36$ months. * Sample mean monthly return $\bar{x} = 0.85\%$ * Sample standard deviation $s = 2.40\%$ * Hypothesized mean under $H_0$: $\mu_0 = 0\%$ * Significance level: $\alpha = 0.05$ (Two-sided test) 1. **Calculate Standard Error:** $ \text{SE} = \frac{2.40\%}{\sqrt{36}} = \frac{2.40\%}{6} = 0.40\% $ 2. **Calculate Test Statistic:** $ t = \frac{0.85\% - 0\%}{0.40\%} = 2.125 $ 3. **Determine Critical Value:** For $df = n - 1 = 35$ at $\alpha = 0.05$ (two-tailed), the critical t-value is approximately $t_{crit} = \pm 2.030$. 4. **Decision:** Since $t = 2.125 > 2.030$, the test statistic falls into the upper rejection region. We **reject $H_0$** at the 5\% significance level and conclude the fund generates statistically significant positive monthly return. Use the visualizer below to explore how changing $\alpha$ and the test direction shifts rejection regions. ### Confidence Interval Relationship A $100(1 - \alpha)\%$ confidence interval for a parameter covers all hypothesized values that would *not* be rejected at significance level $\alpha$ in a two-sided test: $ \text{CI} = \bar{x} \pm (t_{crit} \times \text{SE}) $ If the hypothesized value $\mu_0$ lies *outside* the $(1 - \alpha)$ confidence interval, we reject $H_0$ at significance level $\alpha$. ## The p-Value Approach The **p-value** is the smallest significance level at which a given null hypothesis can be rejected. Equivalently, it is the probability of obtaining a test statistic at least as extreme as the observed statistic, assuming $H_0$ is strictly true. * **Decision Rule:** * If $\text{p-value} \le \alpha \implies \text{Reject } H_0$. * If $\text{p-value} > \alpha \implies \text{Fail to Reject } H_0$. ## Multiple Testing Bias and Data Snooping When a risk team runs hundreds of separate hypothesis tests on the same historical dataset, some tests will yield statistically significant results purely due to random variation. If you test 100 uncorrelated candidate trading signals at $\alpha = 0.05$, expected false positives equal: $ \text{Expected False Rejections} = 100 \times 0.05 = 5 $ This phenomenon is known as **multiple testing bias**, **data snooping**, or **p-hacking**. In quantitative finance, uncorrected multiple testing creates overfitted strategies that look stellar in backtests but fail in live market execution. - Null Hypothesis (H0) always contains equality (=, =) and represents the status quo. - Type I Error (alpha) is rejecting a true null hypothesis (Size/Significance level). - Type II Error (beta) is failing to reject a false null hypothesis. Power equals 1 - beta. - Test Statistic equals (Sample Statistic - Hypothesized Value) / Standard Error. - Reject H0 whenever the p-value is less than or equal to alpha, or when the test statistic exceeds the critical value. - Multiple testing bias leads to overfitting in backtests by mistaking random noise for statistical alpha. What You Need to Know