Regression Analysis for Financial Relationships › Hypothesis Testing and Model Evaluation

Michael BrenndoerferDecember 11, 20259 min read
Quantitative FinanceAll chapters
Part 8 of 15Econometrics and Statistical Modeling
Chapter 43Regression Analysis for Financial Relationships › Hypothesis Testing and Model Evaluation
Reading section 4 of 12 · Hypothesis Testing and Model Evaluation · 9 minSection 4 of 12 · 9 min

Book contents

Section 4 of 12 · 9 min read

Regression Analysis for Financial Relationships › Hypothesis Testing and Model EvaluationOne section · Sections in this chapter4 / 12 ↓

Estimating coefficients is only the first step. We need to assess whether these estimates are statistically meaningful and how well the model explains variation in the dependent variable. The challenge is that our estimates are random variables: they depend on the particular sample we observed. Different samples would produce different estimates. Statistical inference quantifies this uncertainty, telling us how confident we can be in our conclusions.

Standard Errors and t-Statistics

The uncertainty in coefficient estimates comes from sampling variation. We observe only one realization of the data, but if we could repeatedly sample from the same underlying process, we would get different coefficient estimates each time. The distribution of these hypothetical estimates determines how confident we can be in any single estimate.

Under the classical OLS assumptions (which we'll examine shortly), the coefficient estimates follow a multivariate normal distribution:

β^∼N(β,σ2(X′X)−1)\hat{\boldsymbol{\beta}} \sim N\left(\boldsymbol{\beta}, \sigma^2(\mathbf{X}'\mathbf{X})^{-1}\right)

where:

  • β^\hat{\boldsymbol{\beta}}: estimator vector
  • β\boldsymbol{\beta}: true coefficient vector
  • σ2\sigma^2: variance of the error term
  • (X′X)−1(\mathbf{X}'\mathbf{X})^{-1}: inverse of the moment matrix of regressors

This result tells us that OLS estimates are unbiased: their expected value equals the true parameter. The covariance matrix σ2(X′X)−1\sigma^2(\mathbf{X}'\mathbf{X})^{-1} determines the precision of each estimate. The diagonal elements give the variances of individual coefficients, while off-diagonal elements capture how estimation errors in different coefficients relate to each other.

Since we don't know σ2\sigma^2, we estimate it using the residual variance:

σ^2=∑i=1nε^i2n−k−1=SSRn−k−1\hat{\sigma}^2 = \frac{\sum_{i=1}^{n} \hat{\varepsilon}_i^2}{n - k - 1} = \frac{SSR}{n - k - 1}

where:

  • σ^2\hat{\sigma}^2: estimated variance of the error term
  • ε^i\hat{\varepsilon}_i: residual for observation ii
  • SSRSSR: sum of squared residuals
  • nn: number of observations
  • kk: number of explanatory variables (excluding intercept)

The denominator n−k−1n - k - 1 accounts for the degrees of freedom lost in estimating k+1k + 1 parameters (including the intercept). This adjustment ensures the variance estimate is unbiased. With more parameters to estimate, we have less information available to estimate the error variance, so we divide by a smaller number.

The standard error of coefficient jj is:

SE(β^j)=σ^[(X′X)−1]jjSE(\hat{\beta}_j) = \hat{\sigma}\sqrt{[(\mathbf{X}'\mathbf{X})^{-1}]_{jj}}

where:

  • SE(β^j)SE(\hat{\beta}_j): standard error of the jj-th coefficient
  • σ^\hat{\sigma}: estimated standard deviation of the error term
  • [(X′X)−1]jj[(\mathbf{X}'\mathbf{X})^{-1}]_{jj}: the jj-th diagonal element of the inverse matrix

The term [(X′X)−1]jj[(\mathbf{X}'\mathbf{X})^{-1}]_{jj} reflects both the variance of the jj-th regressor and its correlation with other regressors. High variance in xjx_j reduces the standard error (more information), while high correlation with other variables increases it (multicollinearity). Intuitively, if a variable moves a lot, we can more precisely estimate its effect. But if it moves together with other variables, it becomes harder to isolate its unique contribution.

To test whether a coefficient differs from zero, we compute the t-statistic:

tj=β^jSE(β^j)t_j = \frac{\hat{\beta}_j}{SE(\hat{\beta}_j)}

where:

  • tjt_j: t-statistic for the jj-th coefficient
  • β^j\hat{\beta}_j: estimated coefficient
  • SE(β^j)SE(\hat{\beta}_j): standard error of the estimate

This ratio compares the magnitude of the estimate to its precision. A large t-statistic (in absolute value) means the estimate is large relative to its uncertainty, suggesting a non-zero effect. Under the null hypothesis that βj=0\beta_j = 0, this statistic follows a t-distribution with n−k−1n - k - 1 degrees of freedom. The t-distribution accounts for the additional uncertainty from estimating σ2\sigma^2.

Interpreting p-Values

The p-value gives the probability of observing a t-statistic as extreme as or more extreme than the one calculated, assuming the null hypothesis is true. A small p-value (typically below 0.05 or 0.01) suggests the coefficient is statistically significantly different from zero. The logic is indirect: if the null hypothesis were true, the observed result would be very unlikely, so we reject the null.

In financial applications, statistical significance doesn't guarantee economic significance. A beta estimate might be highly significant (p < 0.001) but the relationship might be too weak or unstable to be useful for trading. Conversely, economically meaningful effects might not achieve statistical significance in small samples. The p-value depends on both the magnitude of the effect and the precision of our estimate, so a small but precisely estimated effect can be highly significant while a large but imprecisely estimated effect may not be.

In[9]:
Code
# Extract coefficient estimates and statistics
beta_est = model.params["market_return"]
alpha_est = model.params["const"]
beta_se = model.bse["market_return"]
alpha_se = model.bse["const"]
beta_tstat = model.tvalues["market_return"]
alpha_tstat = model.tvalues["const"]
beta_pval = model.pvalues["market_return"]
alpha_pval = model.pvalues["const"]
Out[10]:
Console
Hypothesis Testing Results:
--------------------------------------------------

Beta (market sensitivity):
  Estimate:    1.3698
  Std Error:   0.0550
  t-statistic: 24.89
  p-value:     1.09e-89
  Significant at 5%: Yes

Alpha (abnormal return):
  Estimate:    0.000707 (17.81% annualized)
  Std Error:   0.000650
  t-statistic: 1.09
  p-value:     0.2772
  Significant at 5%: No

The beta estimate is highly significant, with a t-statistic far exceeding critical values. This means we can confidently reject the null hypothesis that the stock has no market exposure. The alpha estimate, while positive, may or may not be statistically significant depending on the random realization. This illustrates the challenge of detecting true alpha.

R-Squared: Measuring Fit

The coefficient of determination, R2R^2, measures the proportion of variance in the dependent variable explained by the model. This statistic answers a fundamental question: how much of the variation in returns can we attribute to the factors in our model, versus unexplained idiosyncratic variation?

R2=1−SSRSST=1−∑i=1n(yi−y^i)2∑i=1n(yi−yˉ)2R^2 = 1 - \frac{SSR}{SST} = 1 - \frac{\sum_{i=1}^{n}(y_i - \hat{y}_i)^2}{\sum_{i=1}^{n}(y_i - \bar{y})^2}

where:

  • R2R^2: coefficient of determination
  • SSRSSR: sum of squared residuals (unexplained variation)
  • SSTSST: total sum of squares (total variation)
  • yiy_i: observed value of dependent variable
  • y^i\hat{y}_i: fitted value for observation ii
  • yˉ\bar{y}: sample mean of the dependent variable

R2R^2 ranges from 0 to 1, with higher values indicating better fit. An R2R^2 of 0.5 means that 50% of the variation in returns is explained by the model, while 50% remains unexplained. The unexplained portion represents idiosyncratic risk and the effects of factors not included in the model.

Adjusted R-Squared

When comparing models with different numbers of predictors, use adjusted R-squared, which penalizes for adding variables:

Rˉ2=1−(1−R2)n−1n−k−1\bar{R}^2 = 1 - (1 - R^2)\frac{n-1}{n-k-1}

where:

  • Rˉ2\bar{R}^2: adjusted coefficient of determination
  • R2R^2: standard coefficient of determination
  • nn: number of observations
  • kk: number of predictors

This prevents overfitting by adding irrelevant predictors that would increase R2R^2 mechanically. The adjustment recognizes that adding any variable, even a random one, will weakly increase R2R^2. Adjusted R2R^2 can decrease if the added variable doesn't improve the model enough to justify the lost degree of freedom.

For single-stock regressions against the market, R2R^2 typically ranges from 0.2 to 0.6 for individual stocks. Lower values indicate more idiosyncratic risk that cannot be diversified through market exposure alone. For portfolios, R2R^2 tends to be higher because idiosyncratic risks cancel out. A well-diversified portfolio might have R2R^2 of 0.9 or higher against the market, indicating that almost all its risk is systematic.

In[11]:
Code
# Calculate R-squared components
SST = ((df["stock_return"] - df["stock_return"].mean()) ** 2).sum()
SSR = (residuals**2).sum()
SSE = SST - SSR  # Sum of squares explained

r_squared = 1 - SSR / SST
adj_r_squared = 1 - (1 - r_squared) * (len(df) - 1) / (len(df) - 2)
Out[12]:
Console
Model Fit Statistics:
----------------------------------------
R-squared:          0.5525
Adjusted R-squared: 0.5516

The R-squared value indicates that the market factor explains a significant proportion of the stock's variance, though idiosyncratic risk remains.

Out[13]:
Visualization
Three-bar chart showing total sum of squares 0.238266, explained sum of squares 0.131635, and unexplained residual sum of squares 0.106631, with R-squared equal to 0.552.
Variance decomposition for the single-factor regression. The model explains 55.2% of total variation (SSE = 0.131635), while 44.8% remains in the residuals (SSR = 0.106631).

The F-Test for Overall Significance

The F-test assesses whether the model as a whole has explanatory power, meaning whether at least one coefficient (excluding the intercept) is significantly different from zero. While t-tests evaluate individual coefficients, the F-test provides a joint test of all slope coefficients simultaneously. This distinction matters because individual coefficients might be insignificant due to multicollinearity even when the model as a whole explains significant variation.

F=(SST−SSR)/kSSR/(n−k−1)=R2/k(1−R2)/(n−k−1)F = \frac{(SST - SSR)/k}{SSR/(n-k-1)} = \frac{R^2/k}{(1-R^2)/(n-k-1)}

where:

  • FF: F-statistic for the model
  • SSTSST: total sum of squares
  • SSRSSR: sum of squared residuals
  • R2R^2: coefficient of determination
  • kk: number of slope coefficients
  • nn: number of observations

The F-statistic compares the variance explained by the model (per parameter) to the unexplained variance (per degree of freedom). A value significantly greater than 1 indicates the model captures more signal than expected by random chance. The numerator represents average explained variation per variable, while the denominator represents unexplained variation per observation. If the model has no explanatory power, these should be roughly equal, yielding an F-statistic near 1.

Under the null hypothesis that all slope coefficients equal zero, the F-statistic follows an F-distribution with kk and n−k−1n - k - 1 degrees of freedom.

In[14]:
Code
f_statistic = model.fvalue
f_pvalue = model.f_pvalue
Out[15]:
Console
F-test for overall model significance:
  F-statistic: 619.72
  p-value:     1.09e-89

The highly significant F-statistic confirms that the model explains a statistically significant portion of the variance in stock returns.

For simple regression with one explanatory variable, the F-test is equivalent to the t-test on the slope coefficient (the F-statistic equals the squared t-statistic).