.postARp {RGAP} | R Documentation |
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 |
phi |
a |
phi0 |
a |
Q0 |
a |
sigma |
a scalar containing the innovation variance. |
lb |
(optional) |
ub |
(optional) |
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.