-
Notifications
You must be signed in to change notification settings - Fork 3
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
Second full review cfr v0.1.0 #103
Conversation
Correct vignette references Corrections to vignette code Further corrections to vignette
Thanks @sbfnk and @Bisaloo for your feedback. Going through I've offered fixes/optiosn for key issues that need to be tackled prior to release. Could you and @adamkucharski please leave your feedback on these next steps. I will atempt to address them by week's end, but it might be good to budget for another couple of weeks before they are resolved, especially if code review is required.
|
Thanks for the review comments and discussion. A few thoughts on above:
|
Thanks @adamkucharski for the feedback, it's really useful. I'm laying out next steps for this release below the discussion points, do please (all) come in if you feel they should be different.
Will emphasise CFR over other measures, and point to other packages as Seb has suggested.
I will keep things as they are (passing a function evaluating PDF), and update Readme and vignettes with boxes recommending discrete distributions. Speaking with @joshwlambert about this yesterday, {epiparameter} has functionality to discretise distributions as well, so a useful addition as a dependency in future releases (cutting user workload).
Will mention in vignettes etc. but leave as is for now.
Thanks for clarifying - happy to implement in a future version, but will leave as is for now.
Will add the conceptual understanding point to the function doc Details section.
@Bisaloo I'm open to cutting down the vignettes (see also #65), but would be good to tag specific sections as you have done in the {incidence2} vignette (will remove that section). |
Co-authored-by: Hugo Gruson <[email protected]>
Co-authored-by: Sebastian Funk <[email protected]>
I agree on avoiding the hard dependency and instead focus on demonstrating good practice (i.e. use discrete distributions in examples) and clarifying to the potentially unsuspecting user.
It's fine to keep as is if we don't have a good solution for the moment but I agree it needs to be made clear to the user in the vignettes that the uncertainty we are stating is less than the true uncertainty. |
Co-authored-by: Hugo Gruson <[email protected]>
Co-authored-by: Hugo Gruson <[email protected]>
Co-authored-by: Sebastian Funk <[email protected]>
Thanks all for your reviews and for the discussion. I have implemented fixes to the issues raised here in #104 including:
Checks on #104 are currently failing due to a single snapshot test that has changed following 8d7db4c suggested by @sbfnk (and my implementation in 70647b8) - the estimated ascertainment for Covid in the UK using this method jumps from ~45% to ~80% which seems quite high - it would be great if somebody could check I'll leave this PR open until #104 is closed, but it might be easier to move the discussion there already. |
The underascertainment calculation should be using the static CFR calculation right? (Following on from discussion above about challenges of implementing estimation for time varying reporting, so beyond scope for this simpler estimate package). I haven't dug into the new commits, but the time varying calculation should just be a straight implementation of the convolution described in the vignette. The 'burn in' is just to avoid returning the earliest estimates to users (because not enough cases will have accrued in the time series to give a sensible estimate of total outcomes for early dates). So it may be a book keeping issue if a commit has changed how the vector of daily known outcomes lines up with the vector of daily deaths. |
Thanks @adamkucharski - that's cleared it up, I've reversed the change in 8d7db4c. |
Just to check, is the conclusion that the original version of |
My understanding is that the original implementation was correct, but the notation in Nishiura is a bit confusing. Seb's suggestion was to offset the cases by the |
Can I suggest to add a test that
yields the same result as
to make sure your implementation doesn't introduce any bias due to index shifting? |
Is there a simple sense check that could provide some insight? E.g. fix cases to be flat at 500 a day, deaths at 10 per day and CFR at 1% - which should give an ascertainment rate of 0.01/(10/500) = 50% if method working? |
Thanks, added these tests and they pass fine. The convolution suggested earlier would offset cases and PMF values like so: # here offset is the burn_in value
delay_pmf_eval <- pmf_vals[seq_len(i - offset)]
# estimate expected number of outcomes
expected_outcomes <- cases[seq(offset + 1, i)] * rev(delay_pmf_eval) creating misaligned vectors - PMF values are in the range I've shifted to a simpler function, and am setting the first .convolve_cases_pmfs <- function(cases, pmf_vals) {
# no input checks as this is an internal function
vapply(
X = seq_along(cases),
FUN = function(i) {
# estimate expected number of outcomes
sum(cases[seq_len(i)] * rev(pmf_vals[seq_len(i)]))
},
FUN.VALUE = numeric(1)
)
} |
Thanks again all, closing this PR with changes implemented in #104 |
This PR is intended to be a second and ideally brief full package review before a CRAN release of cfr v0.1.0.
Please note that the threshold for considering major changes as part of this release is high. Anybody who would like to review is welcome to assign themselves in the reviewer panel. Two reviewers or fewer will help to keep this process brief.
The deadline for handing in reviews is Wednesday 15th November.
Note: this is a second attempt at this review after looking into options for comparing directly against packagetemplate which led to #102 being closed. Please go ahead and review the PR even though the dependency change workflow is failing as the base is not an R package.
Note: a release checklist is open as issue #101, and is being worked on in #104.