ar: Convert between parameterizations for the AR(p) model

Description Usage Arguments Value Author(s) Examples

Description

These functions convert between the AR(p) coefficients phi, the partial autorcorrelation coefficients pacf and the autocorrelation function acf. The phi-parameterization is the same as used for arima-models in R; see ?arima and the parameter-vector a in Details.

Usage

1
2
3
4
   inla.ar.pacf2phi(pac)
   inla.ar.phi2pacf(phi)
   inla.ar.pacf2acf(pac, lag.max = length(pac)+1L))
   inla.ar.phi2acf(phi, lag.max = length(pac)+1L))

Arguments

pac

The partial autorcorrelation coefficients

phi

The AR(p) parameters phi

lag.max

The maximum lag to compute the ACF for

Value

inla.ar.pacf2phi returns phi for given pacf. inla.ar.phi2pacf returns pac for given phi. inla.ar.phi2acf returns acf for given phi. inla.ar.pacf2acf returns acf for given pacf.

Author(s)

Havard Rue hrue@math.ntnu.no

Examples

1
2
3
4
5
6
7
8
 pac = runif(5)
 phi = inla.ar.pacf2phi(pac)
 pac2 = inla.ar.phi2pacf(phi)
 print(paste("Error:", max(abs(pac2-pac))))
 print("Correlation matrix (from pac)")
 print(toeplitz(inla.ar.pacf2acf(pac)))
 print("Correlation matrix (from phi)")
 print(toeplitz(inla.ar.phi2acf(phi)))

andrewzm/INLA documentation built on May 10, 2019, 11:12 a.m.