Learn R Programming

RGAP (version 0.1.1)

.postARp: Draws from the posterior of the autoregressive paramteres of a stationary AR(p), \(p > 1\) process without starting values.

Description

Draws from the posterior of the autoregressive paramteres of a stationary AR(p), \(p > 1\) process without starting values.

Usage

.postARp(Y, phi, phi0, Q0, sigma, lb = -Inf, ub = Inf)

Arguments

Y

A Tn x 1 vector with the time series.

phi

a 1 x p vector containing the last draw of the autoregressive parameters \(\phi\). p has to be larger than one.

phi0

a 1 x p vector containing the prior mean for phi.

Q0

a p x p matrix containing the prior precision for phi.

sigma

a scalar containing the innovation variance.

lb

(optional) 1 x p vector with lower bounds for phi.

ub

(optional) 1 x p vector with upper bounds for phi.

Details

The corresponding model is given by \(Y_t = \phi_1 Y_{t-1} + ... + \phi_p Y_{t-p} + e_t\), where \(e_t ~ N(0, \sigma)\) with prior distribution \(p(\phi) = N(\phi_0, 1/Q_0 )\).

The posterior draw is obtained via a Metropolis Hastings step with proposal density \( q = \prod_{t=p+1}^Tn p(Y_t, \phi, \sigma, Y_{t-1}, ..., Y_{t-p} )\) which is known due to conjugacy. The acceptance probability is given by \( \alpha = \min{1, p(Y_1, ... Y_p | \phi_r, \sigma) / p(Y_1, ... Y_p | \phi_{r-1}, \sigma)}\) where the subscript \(r\) denotes the r-th draw. \(p(Y_1, ... Y_p | \phi_r, \sigma)\) is itself normal.

Stationarity and box constraints are enforced. If the constraints are not fulfilled, the last draw is returned.