Ordinary Least Squares Regression
Value
A list containing:
beta: Coefficient estimates ((N+1) x 1 if c=1, N x 1 if c=0)
fitted: Fitted values (T x 1)
err: Residuals (T x 1)
r2: R-squared statistic (scalar)
fitted_partial: Fitted values excluding intercept (T x 1)
Details
This function performs ordinary least squares (OLS) regression. The coefficient estimates are computed using the normal equations: $$\hat{\beta} = (X'X)^{-1}X'y$$
The R-squared statistic measures the proportion of variance explained: $$R^2 = 1 - \frac{RSS}{TSS}$$ where RSS is the residual sum of squares and TSS is the total sum of squares.
If an intercept is included (c=1), fitted_partial contains the fitted values excluding the intercept contribution, useful for assessing the explanatory power of the regressors alone.
