Professional Documents
Culture Documents
Linear models with independently and identically distributed errors, and for errors with heteroscedasticity or autocorrelation. This
module allows estimation by ordinary least squares (OLS), weighted least squares (WLS), generalized least squares (GLS), and
feasible generalized least squares with autocorrelated AR(p) errors.
Examples
# Load modules and data
In [1]: import numpy as np
In [7]: print(res.summary())
OLS Regression Results
==============================================================================
Dep. Variable: GRADE R-squared: 0.416
Model: OLS Adj. R-squared: 0.353
Method: Least Squares F-statistic: 6.646
Date: Fri, 05 May 2023 Prob (F-statistic): 0.00157
Time: 13:59:54 Log-Likelihood: -12.978
No. Observations: 32 AIC: 33.96
Df Residuals: 28 BIC: 39.82
Df Model: 3
Covariance Type: nonrobust
==============================================================================
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------
GPA 0.4639 0.162 2.864 0.008 0.132 0.796
TUCE 0.0105 0.019 0.539 0.594 -0.029 0.050
PSI 0.3786 0.139 2.720 0.011 0.093 0.664
const -1.4980 0.524 -2.859 0.008 -2.571 -0.425
==============================================================================
Omnibus: 0.176 Durbin-Watson: 2.346
Prob(Omnibus): 0.916 Jarque-Bera (JB): 0.167
Skew: 0.141 Prob(JB): 0.920
Kurtosis: 2.786 Cond. No. 176.
==============================================================================
Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
WLS
GLS
Recursive LS
Rolling LS
Technical Documentation
The statistical model is assumed to be
GLSAR : feasible generalized least squares with autocorrelated AR(p) errors Σ = Σ (ρ)
All regression models define the same methods and follow the same structure, and can be used in a similar fashion. Some of
them contain additional model specific methods and attributes.
GLS is the superclass of the other regression classes except for RecursiveLS, RollingWLS and RollingOLS.
References
D.C. Montgomery and E.A. Peck. “Introduction to Linear Regression Analysis.” 2nd. Ed., Wiley, 1992.
R.Davidson and J.G. MacKinnon. “Econometric Theory and Methods,” Oxford, 2004.
Attributes
The following is more verbose description of the attributes which is mostly common to all regression classes
pinv_wexog : array
−1
The p x n Moore-Penrose pseudoinverse of the whitened design matrix. It is approximately equal to (X T Σ−1X) X
T
,
Ψ
cholsimgainv : array
The n x n upper triangular matrix ΨT that satisfies ΨΨT = Σ
−1
.
df_model : float
The model degrees of freedom. This is equal to p - 1, where p is the number of regressors. Note that the intercept is not
counted as using a degree of freedom here.
df_resid : float
The residual degrees of freedom. This is equal n - p where n is the number of observations and p is the number of parameters.
Note that the intercept is counted as using a degree of freedom here.
llf : float
nobs : float
normalized_cov_params : array
sigma : array
wexog : array
wendog : array
Module Reference
Model Classes
GLSAR (endog[, exog, rho, missing, hasconst]) Generalized Least Squares with AR covariance structure
yule_walker (x[, order, method, df, inv, demean]) Estimate AR(p) parameters from a sequence using the Yule-Walker equations.
burg (endog[, order, demean]) Compute Burg's AP(p) parameter estimator.
RollingWLS (endog, exog[, window, weights, ...]) Rolling Weighted Least Squares
RollingOLS (endog, exog[, window, min_nobs, ...]) Rolling Ordinary Least Squares
ProcessMLE (endog, exog, exog_scale, ...[, cov]) Fit a Gaussian mean/variance regression model.
Results Classes
Fitting a linear regression model returns a results class. OLS has a specific results class with some additional methods compared
to the results class of the other linear models.
RegressionResults (model, params[, ...]) This class summarizes the fit of a linear regression model.
OLSResults (model, params[, ...]) Results class for for an OLS model.
QuantRegResults (model, params[, ...]) Results instance for the QuantReg model
RecursiveLSResults (model, params, filter_results) Class to hold results from fitting a recursive least squares model.
DimReductionResults (model, params, eigs) Results class for a dimension reduction regression.