A regression model with an AR(p) covariance structure.
Notes
GLSAR is considered to be experimental.
Examples
>>> import scikits.statsmodels 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.620642 -0.88654567]
AR coefficients: [-0.61887622 -0.88137957]
AR coefficients: [-0.61894058 -0.88152761]
AR coefficients: [-0.61893842 -0.88152263]
>>> results.params
array([ 1.58747943, -0.56145497])
>>> results.t()
array([ 30.796394 , -2.66543144])
>>> print results.t_test([0,1])
<T test: effect=-0.56145497223945595, sd=0.21064318655324663, t=-2.6654314408481032, p=0.022296117189135045, df_denom=5>
>>> import numpy as np
>>> print(results.f_test(np.identity(2)))
<F test: F=2762.4281271616205, p=2.4583312696e-08, df_denom=5, df_num=2>
Or, equivalently
>>> model2 = sm.GLSAR(Y, X, rho=2)
>>> res = model2.iterative_fit(maxiter=6)
>>> model2.rho
array([-0.61893842, -0.88152263])
Methods
fit() | Full fit of the model. |
information(params) | Fisher information function of model = - Hessian of logL with respect |
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. |
newton(params) | |
predict(exog[, params]) | Return linear predicted values from a design matrix. |
score(params) | Score function of model. |
whiten(X) | Whiten a series of columns according to an AR(p) |