Regression

Introduction

Regression contains linear models with independently and identically distributed errors and for errors with heteroscedasticity or autocorrelation

The statistical model is assumed to be

System Message: WARNING/2 (Y = X\beta + \mu)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
, where

System Message: WARNING/2 (\mu\sim N\left(0,\sigma^{2}\Sigma\right))

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.

depending on the assumption on

System Message: WARNING/2 (\Sigma)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
, we have currently four classes available

  • GLS : generalized least squares for arbitrary covariance

    System Message: WARNING/2 (\Sigma)

    latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
  • OLS : ordinary least squares for i.i.d. errors

    System Message: WARNING/2 (\Sigma=\textbf{I})

    latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
  • WLS : weighted least squares for heteroskedastic errors

    System Message: WARNING/2 (\text{diag}\left(\Sigma\right))

    latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
  • GLSAR : feasible generalized least squares with autocorrelated AR(p) errors

    System Message: WARNING/2 (\Sigma=\Sigma\left(\rho\right))

    latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.

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.

Class hierachy: TODO

yule_walker is not a full model class, but a function that estimate the parameters of a univariate autoregressive process, AR(p). It is used in GLSAR, but it can also be used independently of any models. yule_walker only calculates the estimates and the standard deviation of the lag parameters but not the additional regression statistics. We hope to include yule-walker in future in a separate univariate time series class. A similar result can be obtained with GLSAR if only the constant is included as regressors. In this case the parameter estimates of the lag estimates are not reported, however additional statistics, for example aic, become available.

Attributes

The following is more verbose description of the attributes which is mostly common to all regression classes

pinv_wexog : array
pinv_wexog is the p x n Moore-Penrose pseudoinverse of the
whitened design matrix. Approximately equal to

System Message: WARNING/2 (\left(X^{T}\Sigma^{-1}X\right)^{-1}X^{T}\Psi)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
where

System Message: WARNING/2 (\Psi)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
is given by

System Message: WARNING/2 (\Psi\Psi^{T}=\Sigma^{-1})

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
cholsimgainv : array
n x n upper triangular matrix such that

System Message: WARNING/2 (\Psi\Psi^{T}=\Sigma^{-1})

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.

System Message: WARNING/2 (cholsigmainv=\Psi^{T})

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
df_model : float
The model degrees of freedom 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 is equal to the number of observations n less the number of parameters p. Note that the intercept is counted as using a degree of freedom here.
llf : float
The value of the likelihood function of the fitted model.
nobs : float
The number of observations n
normalized_cov_params : array
A p x p array

System Message: WARNING/2 ((X^{T}\Sigma^{-1}X)^{-1})

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
sigma : array
sigma is the n x n strucutre of the covariance matrix of the error terms

System Message: WARNING/2 (\mu\sim N\left(0,\sigma^{2}\Sigma\right))

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
wexog : array
wexog is the whitened design matrix.

System Message: WARNING/2 (\Psi^{T}X)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.
wendog : array
The whitened response variable.

System Message: WARNING/2 (\Psi^{T}Y)

latex exited with error: [stderr] [stdout] This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (./math.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size12.clo)) (/usr/share/texmf-texlive/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.128 \endinput ^^M No pages of output. Transcript written on math.log.

References

General reference for regression models:

    1. Montgomery and E.A. Peck. “Introduction to Linear Regression

    Analysis.” 2nd. Ed., Wiley, 1992.

Econometrics references for regression models:

  1. Davidson and J.G. MacKinnon. “Econometric Theory and Methods,” Oxford,
  1. Green. “Econometric Analysis,” 5th ed., Pearson, 2003.

Examples

see also the examples and the tests folders

Module Reference

Model Classes

OLS(endog[, exog]) A simple ordinary least squares model.
GLS(endog, exog[, sigma]) Generalized least squares model with a general covariance structure.
WLS(endog, exog[, weights]) A regression model with diagonal but non-identity covariance structure.
GLSAR(endog[, exog, rho]) A regression model with an AR(p) covariance structure.
yule_walker(X[, order, method, df, inv]) Estimate AR(p) parameters from a sequence X using Yule-Walker equation.

Results Class

RegressionResults(model, params[, ...]) This class summarizes the fit of a linear regression model.

Technical Documentation

Table Of Contents

Previous topic

Developer’s Notes

Next topic

scikits.statsmodels.regression.OLS

This Page