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 #442: Generalise to all brms distributions #459

Merged
merged 16 commits into from
Nov 21, 2024
Merged

Issue #442: Generalise to all brms distributions #459

merged 16 commits into from
Nov 21, 2024

Conversation

seabbs
Copy link
Contributor

@seabbs seabbs commented Nov 20, 2024

Description

This PR closes #442. It adds function factories and uses primarycensored to generalise the latent model to all brms supported distributions.

My outstanding uncertainty here is the naming and organisation of these functions. It would also be nice to still support custom families but I think that might need to be a new issue/stretch goal (as is quite edge case functionality anyway).

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title in the for Issue(s) issue-numbers: PR title
  • I have read the contribution guidelines.
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • My code follows the established coding standards.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

@seabbs seabbs enabled auto-merge (squash) November 20, 2024 20:56
@seabbs seabbs requested a review from athowes November 20, 2024 20:56
@seabbs
Copy link
Contributor Author

seabbs commented Nov 20, 2024

@kylieainslie I think this PR has put us in a place where we can think about testing mixtures using the brms mixture() family (which I think should now nearly "just work" with the double censoring and truncation methods in the latent model generalised here. I am not sure but I think what it would need is a custom family for convolution mixture components (i.e 2 * lognormal, and so on) and then be good to go.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.93%. Comparing base (e840b4b) to head (cca651b).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
R/latent_model.R 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #459      +/-   ##
==========================================
- Coverage   94.24%   93.93%   -0.31%     
==========================================
  Files          16       14       -2     
  Lines         469      429      -40     
==========================================
- Hits          442      403      -39     
+ Misses         27       26       -1     

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


🚨 Try these New Features:

@seabbs
Copy link
Contributor Author

seabbs commented Nov 20, 2024

The coverage gap we see here is not a new gap but showing up due to copying the function into a new location. In general the log likelihood tests are a bit weak but its also really hard to test. A potentially sensible candidate for a mocked test sometimes in the future

@athowes athowes changed the title Issue 442: Generalise to all brms distributions Issue #442: Generalise to all brms distributions Nov 21, 2024
R/gen.R Outdated Show resolved Hide resolved
R/gen.R Show resolved Hide resolved
R/gen.R Outdated Show resolved Hide resolved
R/gen.R Outdated Show resolved Hide resolved
R/gen.R Outdated Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
_pkgdown.yml Show resolved Hide resolved
tests/testthat/test-gen.R Show resolved Hide resolved
vignettes/epidist.Rmd Show resolved Hide resolved
vignettes/epidist.Rmd Show resolved Hide resolved
R/gen.R Show resolved Hide resolved
Copy link
Collaborator

@athowes athowes left a comment

Choose a reason for hiding this comment

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

🥳

@seabbs seabbs merged commit 95b48ca into main Nov 21, 2024
10 checks passed
@seabbs seabbs deleted the issue442 branch November 21, 2024 19:12
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.

Make posterior_predict_latent etc. use function factories
2 participants