Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 176: Add support for multiple observation models #249

Merged
merged 7 commits into from
Jun 4, 2024
Merged

Conversation

seabbs
Copy link
Collaborator

@seabbs seabbs commented Jun 3, 2024

This PR closes #176 by adding a new StackObservationModels which supports arbitary stacks of observation models with both 1 to 1 and 1 to many infection -> obs mappings.

Note that this does not support the passing of unnamed y_t in the generated quantities (in the sense of it making no effort to track these) as long term this doesn't seem sustainable - especially due to the lack of integration with prefix.

This implies we are expecting posterior predictions to be done on data using the y_t (with prefix) sampled at the lowest level of the stack.

if we did want to keep more in the returns this we would need manually prefix I think. To me this suggests a package wide rethink of the use of return is needed.

@seabbs seabbs requested a review from SamuelBrand1 June 3, 2024 15:33
@seabbs seabbs enabled auto-merge (squash) June 3, 2024 15:50
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.34%. Comparing base (599c32b) to head (231d9eb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #249      +/-   ##
==========================================
+ Coverage   92.97%   93.34%   +0.37%     
==========================================
  Files          43       44       +1     
  Lines         413      436      +23     
==========================================
+ Hits          384      407      +23     
  Misses         29       29              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seabbs seabbs mentioned this pull request Jun 3, 2024
@seabbs
Copy link
Collaborator Author

seabbs commented Jun 3, 2024

Implementing this has also made me thing about hierarchical priors. Currently the only way I can think we might do this is similar to this stacking approach but passing in uninstantiated structs and a prior model function and then in the method instantiating the structs using the prior model.

This feels a bit clunky? As far as I am aware we don't have an issue for this so shall we split out and discuss? A good test case for this feels like it might be trying to fit to counts and deaths with a partially pooled overdispersion parameter. Another sensible toy could be trying to fit to cases and deaths with both having 3 age groups (and pooling by dataset and age group both nested and independently).

Another option might be allowing structs to be partially instantiated but that feels very bug prone

@SamuelBrand1 SamuelBrand1 self-requested a review June 4, 2024 10:07
Copy link
Collaborator

@SamuelBrand1 SamuelBrand1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this! This is really neat.

@seabbs seabbs merged commit 9754281 into main Jun 4, 2024
10 checks passed
@seabbs seabbs deleted the issue176 branch June 4, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standard approach to multiple group/ multi-signal modelling
3 participants