Why is combining response weights with ar(cov = TRUE) not possible in brms?

I have an AR1 model I would like to fit with fixed residual standard errors and weights on the likelihood. To include known standard error brms requires cov = TRUE for the ar process. But when cov = TRUE, the inclusion of y | weights(w) throws an error. For example:

make_stancode(y1 | weights(w) ~ y2 + ar(cov = TRUE), data = data)

Throws “Invalid addition arguments for this model”

I am trying to understand why this specification is invalid?

1 Like

This is because for ar(cov = TRUE) there is no pointwise (one per observation) log-likelihood component so it is unclear how weights should be applied.

In the future, please use the Interfaces - brms tag for brms-related questions. Otherwise, you question will likely be overlooked (I have changed it manually this time).

Thanks Paul, and apologies for missing the interfaces-brms tag.

It looks like with a normal response and ar(cov = TRUE) the likelihood is coming from normal_time_hom_lpdf. What do you think about passing the weights to that function?

Inside we have multi_normal_lpdf. How would you propose to pass weights there?

If you were to add the argument vector weight then I was thinking returning

dot_product(lp, weight)

might work.

But there is no lp vector returned by multi_normal_lpdf just a single value containing the joint lpdf of all observations modelled as correlated.

In that case, could we apply sequential conditions to get the factorised likelihood where it’s observations contribution could have its own weight? This would be much less efficient that the unweighted model of course.


Yes, that would be possible. Indeed, we have an efficient expression of the pointwise log-likelihood as discussed in a preprint of ours (https://arxiv.org/abs/1810.10559). Not sure how much less efficient this actually is given that we only need to compute the inverse once.

I don’t have much time at the moment to look at this myself but it would be interesting to see a comparison in terms of efficiency and would help as a convincing argument to implement this approach. Feel free to open an issue on github about the weighted approach to multinormal models with residual dependency in brms.

1 Like