How exactly is ar[1] correlation reported?

Using the ar(1) correlation structure, :

library(brms)

data("LakeHuron")
LakeHuron <- as.data.frame(LakeHuron)
fit <- brm(x ~ ar(p = 1), data = LakeHuron)
summary(fit)

the brms model reports it this way:

Correlation Structures:
      Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
ar[1]     0.87      0.06     0.75     0.98 1.00     2460     2611

But what exactly is the Estimate? Is it the Pearson correlation coefficient between two consecutive time points? Or is it variance? Or? How exactly is it parametrized?

Is this described somewhere in the documentation?

Welcome to the Stan forums @Tomas_T. Sorry nobody responded sooner.

I’m not sure if it’s described in the doc (I don’t see it on the doc page for ar), but the underlying Stan code is available by running make_stancode(bf(x ~ ar(p = 1)), data = LakeHuron). In one part of the model block it has:

    for (n in 1:N) {
      err[n] = Y[n] - mu[n];
      for (i in 1:J_lag[n]) {
        Err[n + 1, i] = err[n + 1 - i];
      }
      mu[n] += Err[n, 1:Kar] * ar;
    }

One way to write an AR(1) model is y_t = \mu_t + \phi (y_{t-1} - \mu_{t-1}) + \epsilon_t. What I think brms is doing in the code above is re-expressing this using \mathrm{err}_t = y_t - \mu_t, so that \mathrm{err}_t = \phi \mathrm{err}_{t-1} + \epsilon_t. If I’m right about that, what you’re seeing reported as ar[1] is \phi. If that’s the case, then it can be interpreted as the strength of the autocorrelation at lag 1. The Estimate column of the printed output would then be the posterior mean of \phi and Est. Error the posterior standard deviation of \phi.

3 Likes