Open jrnold opened 8 years ago
Yeah, we have needed these for a long time.
It would be awesome to have a stationary type, and the jacobians are available in (one of the many) sources of this transformation:
Monahan, John F. 1984. “A Note on Enforcing Stationarity in Autoregressive-moving Average Models.” Biometrika 71 (2) (August 1): 403-404.
Also, it is probably less in demand, but statsmodels has functions that extend it to the multivariate case.
If you can implement the transfrom from unconstrained to constrained and the log Jacobian, I can add the type to the language. We can speed up a lot of those functions above with tighter bounds and vectorization, but we can look at it in C++ rather than trying to make the Stan functions faster.
What should we call the type? Maybe stationary_vector or AR_vector or ARMA_vector (this transformation also works for MA weights).
On Mon, Jul 4, 2016 at 4:34 PM, Bob Carpenter notifications@github.com wrote:
If you can implement the transfrom from unconstrained to constrained and the log Jacobian, I can add the type to the language. We can speed up a lot of those functions above with tighter bounds and vectorization, but we can look at it in C++ rather than trying to make the Stan functions faster.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/309#issuecomment-230351232, or mute the thread https://github.com/notifications/unsubscribe/ADOrqqM0rzwwrztUlNnhpXMWgE7ZsnU4ks5qSW5ZgaJpZM4I-dK1 .
How about stationary_ar with the understanding that it's a vector? It'd be like simplex or positive_ordered that way.
On Jul 4, 2016, at 1:38 PM, bgoodri notifications@github.com wrote:
What should we call the type? Maybe stationary_vector or AR_vector or ARMA_vector (this transformation also works for MA weights).
On Mon, Jul 4, 2016 at 4:34 PM, Bob Carpenter notifications@github.com wrote:
If you can implement the transfrom from unconstrained to constrained and the log Jacobian, I can add the type to the language. We can speed up a lot of those functions above with tighter bounds and vectorization, but we can look at it in C++ rather than trying to make the Stan functions faster.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/309#issuecomment-230351232, or mute the thread https://github.com/notifications/unsubscribe/ADOrqqM0rzwwrztUlNnhpXMWgE7ZsnU4ks5qSW5ZgaJpZM4I-dK1 .
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
Maybe but stationary_ar is not my fav because y is stationary if these coefficients generate it, rather than the coefficients themselves being stationary. Also, we need to implement the informative prior on this vector because the usual beta informative prior is put on the partial correlations, which the user doesn't have access to.
On Mon, Jul 4, 2016 at 4:41 PM, Bob Carpenter notifications@github.com wrote:
How about stationary_ar with the understanding that it's a vector? It'd be like simplex or positive_ordered that way.
- Bob
On Jul 4, 2016, at 1:38 PM, bgoodri notifications@github.com wrote:
What should we call the type? Maybe stationary_vector or AR_vector or ARMA_vector (this transformation also works for MA weights).
On Mon, Jul 4, 2016 at 4:34 PM, Bob Carpenter notifications@github.com wrote:
If you can implement the transfrom from unconstrained to constrained and the log Jacobian, I can add the type to the language. We can speed up a lot of those functions above with tighter bounds and vectorization, but we can look at it in C++ rather than trying to make the Stan functions faster.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/309#issuecomment-230351232, or mute the thread < https://github.com/notifications/unsubscribe/ADOrqqM0rzwwrztUlNnhpXMWgE7ZsnU4ks5qSW5ZgaJpZM4I-dK1
.
— You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or mute the thread.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/309#issuecomment-230351938, or mute the thread https://github.com/notifications/unsubscribe/ADOrqooDuyijLM8PxVJ0sdhq3S4n3Oeeks5qSW_pgaJpZM4I-dK1 .
I can't think of a good name for the type either, I had a hard enough time trying to write the title of this issue. Maybe stationary_arcoef
of stationary_acf
?
For the informative prior, we could create a atanh-beta distribution, where X ~ atanh_beta(a, b) = atanh((X + 1) / 2) ~ beta(a, b).
I'd be OK with stationary_ar
or stationary_ar_coef
.
stationary_basis?
Having to write out “stationary” is a bit burdensome, so what aobut sar_basis ro sar_coef?
On Jul 5, 2016, at 2:49 AM, Bob Carpenter notifications@github.com wrote:
I'd be OK with stationary_ar or stationary_ar_coef.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
But that's what autocomplete is for
It'll take me a little bit of time to get re-familiarized with the C++ library since it's been so long since I looked at it, so I'll have a few questions.
See also https://arxiv.org/abs/1406.4584 for the vector case
I'm curious whatever happened to this? It would definitely be nice to have.
If anyone else comes across this page and attempts to use the code - I'm pretty sure the pacf_to_acf
function should be:
row_vector pacf_to_acf(vector x) {
int n = num_elements(x);
matrix[n, n] y = diag_matrix(x);
for (k in 2:n) {
for (i in 1:(k - 1)) {
y[k, i] = y[k - 1, i] - x[k] * y[k - 1, k - i];
}
}
return y[n];
}
and you don't need the inverse or the log abs det jacobian if you set your priors on the auto-correlations and constrain them to [-1, 1].
@elbamos --- thanks for th clarification.
Summary:
Provide function to constrain a vector to the space of coefficients of stationary autoregressive functions and invertible moving-average functions.
Description:
When estimating ARMA time series models they are not stationary if the roots of the characteristic polynomial of the AR part lie outside the unit circle, or the roots of the characteristic polynomial of the MA part lie outside the unit circle. Since this space gets complicated once the order of those polynomials gets beyond 2, it would be useful to have functions that convert from the real line to this space, and the inverse. This issue is mentioned on p 95 of the v2.10.0 manual, and the constraint is manually imposed in the GARCH(1,1) model on p. 90. These functions would make it possible to ensure stationary of the coefficients of ARMA(p, q) and related time series models.
Below I provide Stan functions that implement the necessary transformations, described in Monahan (1984) and Jones (1987). I could reimplement them in C++ if this is of interest.
References
Expected Output:
Additional Information:
Stan functions implementing these transformations.
Provide any additional information here.
Current Version:
v2.9.0