fit.ar.par: Fit an Autoregressive or Periodic Autoregressive Model

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/partsm.R

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

1
2
    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, "AR", or a periodic autoregressive model, "PAR".

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: regular=c(0,0,0), if the first and second element are set equal to 1, it indicates that an intercept, and/or linear trend, respectively, are included. The third element in regular is a vector indicating which seasonal dummies should be included. If no seasonal dummies are desired it must be set equal to zero. For example, regular=c(1,0,c(1,2,3)) would include an intercept, no trend, and the first three seasonal dummies;

seasonal=c(0,0), if an element is set equal to 1, it indicates that seasonal intercepts, and/or seasonal trends, respectively, are included in the model;

regvar=0, if none regressor variables are considered, this object must be set equal to zero, otherwise, the names of a matrix object previously defined should be indicated.

p

the lag order of the model.

Details

If type is "AR" the following model is estimated by ordinary least squares:

y_t = φ_{1} y_{t-1} + φ_{2} y_{t-2} + ... + φ_{p} y_{t-p} + ε_t.


If type is "PAR", the following model is estimated by ordinary least squares:

y_t = α_{1s} y_{t-1} + α_{2s} y_{t-2} + ... + α_{ps} y_{t-p} + ε_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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    ## 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)
  

partsm documentation built on Nov. 25, 2020, 5:07 p.m.