Forecasting with brms

179 views
Skip to first unread message

Joshua Duncan

unread,
Apr 9, 2018, 3:03:39 PM4/9/18
to brms-users
Hey brms users,

I'm utilizing the brms correlation structure and am building a time-series model. It is a simple regression model with one autoregressive component. I understand that the predict function includes the uncertainty of the estimated parameters but what I'd also like to include is some uncertainty in the values of my predictor variable itself. Since I'll be predicting future values where the predictor values are also unknown it would be nice include that uncertainty. Is there a way to manage this in brms?

Thanks,
Josh

Andrew MacDonald

unread,
Apr 10, 2018, 10:08:53 AM4/10/18
to brms-users
Hello Josh,

This sounds like a great case for a so-called "measurement error" model. You could take a look at  ?brms::me and see if you could use that to create a solution!

HTH,
Andrew

Joshua Duncan

unread,
Apr 10, 2018, 10:22:05 AM4/10/18
to brms-users
Hey Andrew,

Thanks! That looks like a great solution. I'll give it a try.

Josh

Joshua Duncan

unread,
Apr 10, 2018, 1:00:41 PM4/10/18
to brms-users
Andrew,

Utilizing the "measurement error" as you mentioned appears to capture what I wanted. I did run into an error when using the "predict()" method:

Error: Predictions with noise-free variables are not yet possible when passing new data.

I just had to download the latest version of brms from Github and this appears to have been fixed already. The only thing that confuses me here is that in my case since I know the historical values are "true" values I intuitively wanted to make the measurement error = 0 for past values and then introduce error on the future values. It looks like brms does not allow for zero measurement error when fitting though.

Thanks again for the help,
Josh 

On Tuesday, April 10, 2018 at 9:08:53 AM UTC-5, Andrew MacDonald wrote:

Paul Buerkner

unread,
Apr 10, 2018, 1:34:32 PM4/10/18
to Joshua Duncan, brms-users
Since me() does not seem to be what you had in mind, can you please make your model formulation more precise?

From what I see, you need both a generative model for your response as well as a generative model for your predictor, that is a multivariate model.

--
You received this message because you are subscribed to the Google Groups "brms-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brms-users+unsubscribe@googlegroups.com.
To post to this group, send email to brms-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brms-users/0188f7a4-b61e-4049-a137-f79c82707a23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Duncan

unread,
Apr 10, 2018, 2:12:21 PM4/10/18
to brms-users
Thanks for the tip Paul. If I were to frame this as a multivariate model is it possible to have separate correlation structures for the two generative models? 

Josh

On Tuesday, April 10, 2018 at 12:34:32 PM UTC-5, Paul Buerkner wrote:
Since me() does not seem to be what you had in mind, can you please make your model formulation more precise?

From what I see, you need both a generative model for your response as well as a generative model for your predictor, that is a multivariate model.
2018-04-10 19:00 GMT+02:00 Joshua Duncan <joshu...@gmail.com>:
Andrew,

Utilizing the "measurement error" as you mentioned appears to capture what I wanted. I did run into an error when using the "predict()" method:

Error: Predictions with noise-free variables are not yet possible when passing new data.

I just had to download the latest version of brms from Github and this appears to have been fixed already. The only thing that confuses me here is that in my case since I know the historical values are "true" values I intuitively wanted to make the measurement error = 0 for past values and then introduce error on the future values. It looks like brms does not allow for zero measurement error when fitting though.

Thanks again for the help,
Josh 

On Tuesday, April 10, 2018 at 9:08:53 AM UTC-5, Andrew MacDonald wrote:
Hello Josh,

This sounds like a great case for a so-called "measurement error" model. You could take a look at  ?brms::me and see if you could use that to create a solution!

HTH,
Andrew

On Monday, 9 April 2018 21:03:39 UTC+2, Joshua Duncan wrote:
Hey brms users,

I'm utilizing the brms correlation structure and am building a time-series model. It is a simple regression model with one autoregressive component. I understand that the predict function includes the uncertainty of the estimated parameters but what I'd also like to include is some uncertainty in the values of my predictor variable itself. Since I'll be predicting future values where the predictor values are also unknown it would be nice include that uncertainty. Is there a way to manage this in brms?

Thanks,
Josh

--
You received this message because you are subscribed to the Google Groups "brms-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brms-users+...@googlegroups.com.

Paul Buerkner

unread,
Apr 10, 2018, 2:15:21 PM4/10/18
to Joshua Duncan, brms-users
that is possible. we have yet to find out if the forecasting you have in mind can be made possible though.

Joshua Duncan

unread,
Apr 10, 2018, 3:46:35 PM4/10/18
to brms-users
Paul,

I reformulated the model as a multivariate model where one response is also a predictor of the other. The predict function appears to work just fine for future values with this formulation. The estimated error has increased for the forecasted values of the original response variable which seems to be inline with propagating the uncertainty of the predictors generative model. I think this is the way to go but am still confused as to how to include separate correlation structures since the "autocor" argument is outside of the formula definition.

Thanks for the help. I really appreciate it.

Paul Buerkner

unread,
Apr 10, 2018, 3:52:16 PM4/10/18
to Joshua Duncan, brms-users
go for bf(y ~ ..., autocor = ...) + bf (x ~ ..., autocor = ...)

Joshua Duncan

unread,
Apr 10, 2018, 3:58:54 PM4/10/18
to brms-users
Wow, thanks Paul! The flexibility of this package keeps amazing me.
Reply all
Reply to author
Forward
0 new messages