fit.ar.par {partsm} | R Documentation |
Fit an Autoregressive or Periodic Autoregressive Model
Description
This function fits either an autoregressive (AR) or a periodic autoregressive (PAR) model and extract the estimates for the autoregressive or periodic autoregressive coefficients.
Usage
fit.ar.par (wts, type, detcomp, p)
Arguments
wts |
a univariate time series object. |
type |
A character string indicating whether the model to fit is an autoregressive model,
|
detcomp |
deterministic components to include in the model. Three types of regressors can be included: regular deterministic components, seasonal deterministic components, and any regressor variable previously defined by the user. This argument must be a list object with the following elements:
|
p |
the lag order of the model. |
Details
If type
is "AR"
the following model is estimated by ordinary least squares:
y_t = \phi_{1} y_{t-1} + \phi_{2} y_{t-2} + ... + \phi_{p} y_{t-p} + \epsilon_t.
If type
is "PAR"
, the following model is estimated by ordinary least squares:
y_t = \alpha_{1s} y_{t-1} + \alpha_{2s} y_{t-2} + ... + \alpha_{ps} y_{t-p} + \epsilon_t,
for s=1,...,S
, where S
is the periodicity of the time series.
Deterministic components can be added to models above. Be careful when defining the detcomp
argument. To include an intercept and seasonal intercepts, or a regular trend with seasonal trends, will
cause multicollinearity problems.
Value
A fit.partsm-class
class object reporting the estimates of the autoregressive or periodic
autoregressive coefficients. See fit.partsm-class
to check further information available
from this class via the methods show
and summary
.
Author(s)
Javier Lopez-de-Lacalle javlacalle@yahoo.es.
References
P.H. Franses: Periodicity and Stochastic Trends in Economic Time Series (Oxford University Press, 1996).
See Also
fit.piartsm-class
, fit.partsm-class
, and PAR.MVrepr-methods
.
Examples
## Models for the the logarithms of the Real GNP in Germany.
data("gergnp")
lgergnp <- log(gergnp, base=exp(1))
## Fit an AR(4) model with intercept and seasonal dummies.
detcomp <- list(regular=c(1,0,c(1,2,3)), seasonal=c(0,0), regvar=0)
out.ar <- fit.ar.par(wts=lgergnp, type="AR", detcomp=detcomp, p=4)
## Fit a PAR(2) model with seasonal intercepts.
detcomp <- list(regular=c(0,0,0), seasonal=c(1,0), regvar=0)
out.par <- fit.ar.par(wts=lgergnp, type="PAR", detcomp=detcomp, p=2)