Handle multivariate responses with HSGP #856
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does two things.
There's something I would like to clarify about HSGP with multivariate responses. With this PR it's possible to do something like
and the graph will look like:
See all the dimensions of the response share the same priors for
hsgp_sigma
andhsgp_ell
. Theoretically, it's possible to use a different coefficient for each response dimension. However, Bambi does not support that, and after some thought I decided it is fine that way.The implementation is very complicated already, and it would be much more complicated if we decided to handle this. There's the
by
(andshare_cov
) argument inhsgp()
, which could make us think we can use it for this purpose. However, that argument expects categories to be values within a given variable. In the multivariate family case, the dimensions are different columns (i.e.y1
,y2
, andy3
in the example above). So, at least, we would need a special way to tell Bambi to handle things differently in this special case.On top of that, a multivariate model with an HSGP is already a fairly complex model. To have a more granular control of HSGP, one should use a PPL like PyMC.
I'm open to change my mind in the future, but for now, I think this is good enough.