Serial correlation and filtering using brms

Hello,

I am trying to model a time series (life expectancy wy by year from 1900 to 2010) and GDP. I just started very simple

lm(wy ~ igdp_log)

Here an example of the results from a toy model.

Of course, this model has serial correlation. I can do filtering by using:

lm(I(wy - r1*lag_wy) ~ I(igdp_log - r1*lag_igdp_log)

Where r1 is the 1st serial correlation coefficient (0.846). The gdp coefficient goes from 1.30 to 0.71.

I am trying to replicate these results using brms. When I specify the autocor term I use:

autocor = cor_arr(~ 1, r=1)

The gdp coefficient I get is 0.15. Is there a way to replicate the coefficient of 0.70 using brms?

Thanks in advance!

  • Operating System: Capitan OSX
  • brms Version: 2.2.0

cor_arr models autocorrelation of the response that is basically r1*lag_wy in your case, but not the autocorrelation of the predictor variable. Actually, cor_arr can be equivalently expressed as part of the predictor design matrix, so recently I deprecated cor_arr, because it is not really needed within the brms framework.

To express your model in brms, you can try the following model

bform <- bf(
wy ~ r * lag_wy + b * (igdp_log - r * lag_igdp_log),
r + b ~ 1, nl = TRUE
)
brm(bform, …)

I haven’t tested it myself but in the worst case, it is a step in the right direction ;-)

Thanks, Paul.

It looks like your solution is doing the same as:

brm(formula = wy ~ 1 + igdp_log,
          autocor = cor_ar(~ year, p=1),
          data = chile)

I get the same coefficient for igpd_log (0.03).

I don’t know if it is possible, but I would like to only adjust the standard errors or uncertainty of the estimates (coefficient posterior distribution).

Thank you!

What do you mean by “change”?

Filter variables to remove correlation just change the precision of estimates, not the estimate or coefficient. I am just trying to figure out how to do something similar but using brms and the autocor feature.

I understand. The thing is that by “filtering out” (i.e. modeling) the autocorrelation, you effectively change your generative model. This in turn may affect all your other parameters in an a-priori unknown way. Thus, I don’t think you goal is generally possible or sensible.

Thanks, Paul. Your answer makes sense to me!