bambinos / bambi

BAyesian Model-Building Interface (Bambi) in Python.
https://bambinos.github.io/bambi/
MIT License
1.08k stars 124 forks source link

Add constrained transform #764

Closed tomicapretto closed 11 months ago

tomicapretto commented 11 months ago

This PR adds a new transformation that can be used in response terms. This is similar to truncated but it directly constrains the bounds of the response distribution (remember, truncated refers to the missing data mechanism).

The usage is constrained(value, lower, upper) ~ whatever. lower and upper must be scalar or None.

It uses the original bounds when obtaining draws from the posterior predictive distribution.

Edit closes #750

codecov-commenter commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2d4b260) 89.83% compared to head (c0b52ac) 89.93%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #764 +/- ## ========================================== + Coverage 89.83% 89.93% +0.09% ========================================== Files 45 45 Lines 3768 3784 +16 ========================================== + Hits 3385 3403 +18 + Misses 383 381 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.