-
Notifications
You must be signed in to change notification settings - Fork 4
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
A why it works maths vignette #37
Comments
Well I'm a fan of this idea. |
Following on from f2f discussion with @seabbs I'm not sure https://primarycensoreddist.epinowcast.org/dev/articles/primarycensoreddist.html#compute-the-primary-event-censored-cumulative-distribution-function-cdf-for-delays-with-pprimarycensoreddist is quite correct. We can characterise the delay distribution with primary event censoring as the sum of two random variables: Where Assuming independence, the cumulative distribution function for Using standard probability identity and arrives at first equation of the linked section. For the right-truncated version The cumulative dist. identity for This differs from the second equation in the linked section, which I think might be incorrect. If we wish to right-truncate Which is again different to the second equation since its the ratio of two integrals rather than the integral of a ratio. |
This is what we want I think and what is implemented in the currently vectorised code. See the similarity to equation 21 in Park et al. 2024 (i.e double extra boring) I have also been looking at this in the numerical stability branch (changing this again makes no impact on numerical stability but does localise the issue the D). We should do some numerical testing by expanding these tests to include testing about random sampled emprical versions: https://github.com/epinowcast/primarycensoreddist/blob/2d8f339821aa3c975cfa667c8c738107d178153d/tests/testthat/test-stan-rpd-primarycensoreddist.R#L183 |
Also the difference between intregrals must be very small if the analytical test here is correct: https://github.com/epinowcast/primarycensoreddist/blob/74c2c8c83ff230edbaf5643d1da7351a9714ee7e/tests/testthat/test-rpd-primarycensoreddist.R#L100 |
I think we're straying on this issue away from the maths vignette (which has a small error in the equation) towards the stability of sampling? |
Yes agree. I do think this makes clear a nice verbose maths vignette would be helpful sooner rather than later |
@SamuelBrand1 just a light bump that this would be a great addition |
We have some mathematical justification in the getting started vignette but I think we could do with more in another maths only (i.e no code) vignette. What do you think @SamuelBrand1?
The text was updated successfully, but these errors were encountered: