Regression Analysis for Financial Relationships › Hypothesis Testing and Model Evaluation
Quantitative FinanceAll chapters 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:
where:
- : estimator vector
- : true coefficient vector
- : variance of the error term
- : 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 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 , we estimate it using the residual variance:
where:
- : estimated variance of the error term
- : residual for observation
- : sum of squared residuals
- : number of observations
- : number of explanatory variables (excluding intercept)
The denominator accounts for the degrees of freedom lost in estimating 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 is:
where:
- : standard error of the -th coefficient
- : estimated standard deviation of the error term
- : the -th diagonal element of the inverse matrix
The term reflects both the variance of the -th regressor and its correlation with other regressors. High variance in 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:
where:
- : t-statistic for the -th coefficient
- : estimated coefficient
- : 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 , this statistic follows a t-distribution with degrees of freedom. The t-distribution accounts for the additional uncertainty from estimating .
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.
# 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"]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, , 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?
where:
- : coefficient of determination
- : sum of squared residuals (unexplained variation)
- : total sum of squares (total variation)
- : observed value of dependent variable
- : fitted value for observation
- : sample mean of the dependent variable
ranges from 0 to 1, with higher values indicating better fit. An 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.
When comparing models with different numbers of predictors, use adjusted R-squared, which penalizes for adding variables:
where:
- : adjusted coefficient of determination
- : standard coefficient of determination
- : number of observations
- : number of predictors
This prevents overfitting by adding irrelevant predictors that would increase mechanically. The adjustment recognizes that adding any variable, even a random one, will weakly increase . Adjusted 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, 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, tends to be higher because idiosyncratic risks cancel out. A well-diversified portfolio might have of 0.9 or higher against the market, indicating that almost all its risk is systematic.
# 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)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.

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.
where:
- : F-statistic for the model
- : total sum of squares
- : sum of squared residuals
- : coefficient of determination
- : number of slope coefficients
- : 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 and degrees of freedom.
f_statistic = model.fvalue
f_pvalue = model.f_pvalueF-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).