A regression model with an AR(p) covariance structure.
Notes
GLSAR is considered to be experimental.
Examples
>>> import statsmodels.api as sm
>>> X = range(1,8)
>>> X = sm.add_constant(X)
>>> Y = [1,3,4,5,8,10,9]
>>> model = sm.GLSAR(Y, X, rho=2)
>>> for i in range(6):
... results = model.fit()
... print "AR coefficients:", model.rho
... rho, sigma = sm.regression.yule_walker(results.resid,
... order=model.order)
... model = sm.GLSAR(Y, X, rho)
...
AR coefficients: [ 0. 0.]
AR coefficients: [-0.52571491 -0.84496178]
AR coefficients: [-0.6104153 -0.86656458]
AR coefficients: [-0.60439494 -0.857867 ]
AR coefficients: [-0.6048218 -0.85846157]
AR coefficients: [-0.60479146 -0.85841922]
>>> results.params
array([ 1.60850853, -0.66661205])
>>> results.tvalues
array([ 21.8047269 , -2.10304127])
>>> print results.t_test([0,1])
<T test: effect=array([-0.66661205]), sd=array([[ 0.31697526]]),
t=array([[-2.10304127]]), p=array([[ 0.06309969]]), df_denom=3>
>>> print(results.f_test(np.identity(2)))
<F test: F=array([[ 1815.23061844]]), p=[[ 0.00002372]], df_denom=3,
df_num=2>
Or, equivalently
>>> model2 = sm.GLSAR(Y, X, rho=2)
>>> res = model2.iterative_fit(maxiter=6)
>>> model2.rho
array([-0.60479146, -0.85841922])
Methods
fit([method]) | Full fit of the model. |
hessian(params) | The Hessian matrix of the model |
information(params) | Fisher information matrix of model |
initialize() | |
iterative_fit([maxiter]) | Perform an iterative two-stage procedure to estimate a GLS model. |
loglike(params) | Returns the value of the gaussian loglikelihood function at params. |
predict(params[, exog]) | Return linear predicted values from a design matrix. |
score(params) | Score vector of model. |
whiten(X) | Whiten a series of columns according to an AR(p) |
Attributes
endog_names | |
exog_names |