inla.ar.pacf2phi {INLA} | R Documentation

## Convert between parameterizations for the AR(p) model

### 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

    inla.ar.pacf2phi(pac)

    inla.ar.phi2pacf(phi)

    inla.ar.phi2acf(phi, lag.max = length(phi))

    inla.ar.pacf2acf(pac, lag.max = length(pac))

### 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@r-inla.org

### Examples

    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)))

[Package INLA version 26.08.22 Index]