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

include lower truncation for normal distrubution #57

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ReneSkukies
Copy link
Member

Lower truncation might be useful to simulate specific experiments where there was/ is an exclusion criterion, artificially changing the distribution.

E.g. in our Oddball experiment, we set a lower RT threshold, throwing out every trial below.

Change log-normal onsets to also include lower truncate
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (17f3fe8) 72.82% compared to head (1e02814) 69.93%.

❗ Current head 1e02814 differs from pull request most recent head 69902f8. Consider uploading reports for the commit 69902f8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
- Coverage   72.82%   69.93%   -2.90%     
==========================================
  Files          10       10              
  Lines         357      316      -41     
==========================================
- Hits          260      221      -39     
+ Misses         97       95       -2     

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@behinger
Copy link
Member

hey! great idea!

  • Could you add a unit-test?
  • Could you modify the tutorial to include this option (or at least mention it?)
  • Could you elaborate whether this allows for upper & lower truncation at the same time?

@ReneSkukies
Copy link
Member Author

Can do the first two.
To the last: It does! Didn't check with UnfoldSim, but with the Distribution package. If you have a truncated distribution type, the function just adds the other truncation as well. I.e. a Truncated(LogNormal{Float64}(μ=5.0, σ=1.0); upper=10.0) becomes Truncated(LogNormal{Float64}(μ=5.0, σ=1.0); lower=1.0, upper=10.0) if you apply the truncated function a second time (with a lower bound)

This tests both upper and lower truncation in one go. I think it's fine like this but could also be tested separately in addition.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ReneSkukies and others added 3 commits December 19, 2023 15:23
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -137,15 +137,15 @@ end
# The `LogNormalOnset` is based on a log-normal distribution and has four parameters: `μ`, `σ`, `offset` and `truncate_upper`.

# Example:
onset_lognormal = LogNormalOnset(; μ = 3, σ = 0.25, offset = 0, truncate_upper = nothing);
onset_lognormal = LogNormalOnset(; μ = 3, σ = 0.25, offset = 0, truncate_upper = nothing, truncate_lower = nothing);
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
onset_lognormal = LogNormalOnset(; μ = 3, σ = 0.25, offset = 0, truncate_upper = nothing, truncate_lower = nothing);
onset_lognormal = LogNormalOnset(;
μ = 3,
σ = 0.25,
offset = 0,
truncate_upper = nothing,
truncate_lower = nothing,
);

Copy link
Member Author

Choose a reason for hiding this comment

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

As this is for the docs only anyway I would omit

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@ReneSkukies
Copy link
Member Author

hey! great idea!

* Could you add a unit-test?

* Could you modify the tutorial to include this option (or at least mention it?)

* Could you elaborate whether this allows for upper & lower truncation at the same time?

Everything implemented now. I only mentioned the truncate lower in the docs because I didn't want to prolong the parameter plots even further. If you still want me to do that I can though.

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.

2 participants