### Navigation

- index
- modules |
- next |
- previous |
- statsmodels v0.2.0 documentation »
- Regression »

# scikits.statsmodels.regression.OLS

class `scikits.statsmodels.regression.``OLS`(endog, exog=None)

  A simple ordinary least squares model.

  Methods

  inherited from regression.GLS

  Parameters: | endog : array-like 1d vector of response/dependent variable exog: array-like : Column ordered (observations in rows) design matrix.

  Notes

  OLS, as the other models, assumes that the design matrix contains a constant.

  Examples

      >>> import numpy as np
      >>>
      >>> import scikits.statsmodels as sm
      >>>
      >>> Y = [1,3,4,5,2,3,4]
      >>> X = range(1,8) #[:,np.newaxis]
      >>> X = sm.add_constant(X)
      >>>
      >>> model = sm.OLS(Y,X)
      >>> results = model.fit()
      >>> # or results = model.results
      >>> results.params
      array([ 0.25      ,  2.14285714])
      >>> results.t()
      array([ 0.98019606,  1.87867287])
      >>> print results.t_test([0,1])
      <T test: effect=2.1428571428571423, sd=1.1406228159050935, t=1.8786728732554485, p=0.059539737780605395, df_denom=5>
      >>> print results.f_test(np.identity(2))
      <F test: F=19.460784313725501, p=0.00437250591095, df_denom=5, df_num=2>

  Attributes

  weights | scalar | Has an attribute weights = array(1.0) due to inheritance from WLS.
  See regression.GLS |  |

  Methods

  `fit`() | Full fit of the model.
  `hessian`(params) | The Hessian matrix of the model
  `information`(params) | Fisher information matrix of model
  `initialize`() |
  `loglike`(params) | The likelihood function for the clasical OLS model.
  `predict`(exog[, params]) | Return linear predicted values from a design matrix.
  `score`(params) | Score vector of model.
  `whiten`(Y) | OLS model whitener does nothing: returns Y.

### Navigation

- index
- modules |
- next |
- previous |
- statsmodels v0.2.0 documentation »
- Regression »