Draws from the posterior of the autoregressive paramteres of a stationary AR(p), \(p > 1\) process without starting values.
.postARp(Y, phi, phi0, Q0, sigma, lb = -Inf, ub = Inf)
A Tn x 1
vector with the time series.
a 1 x p
vector containing the last draw of the autoregressive parameters
\(\phi\). p
has to be larger than one.
a 1 x p
vector containing the prior mean for phi
.
a p x p
matrix containing the prior precision for phi
.
a scalar containing the innovation variance.
(optional) 1 x p
vector with lower bounds for phi
.
(optional) 1 x p
vector with upper bounds for phi
.
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.