A simple ordinary least squares model.
Methods
inherited from regression.GLS
Parameters: | endog : array-like
exog: array-like :
|
---|
Notes
OLS, as the other models, assumes that the design matrix contains a constant.
Examples
>>> import numpy as np
>>>
>>> import statsmodels.api 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()
>>> results.params
array([ 0.25 , 2.14285714])
>>> results.tvales
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([method]) | 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(params[, exog]) | Return linear predicted values from a design matrix. |
score(params) | Score vector of model. |
whiten(Y) | OLS model whitener does nothing: returns Y. |
Attributes
endog_names | |
exog_names |