-
Notifications
You must be signed in to change notification settings - Fork 6
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 57: Polish get started vignette #59
Conversation
Regarding this point, even if the data can be any value (continuous) I think a histogram can still be preferred to a density as a density relies on some KDE parameters (and so ultimately is a model of the data rather than a "true" representation, while a histogram is more of a "true" representation). For this reason not clear to me that it's better to move to density. I do perhaps see that you'd want the histogram bins to line up with "daily" if that's what you mean also? |
I'm ready for this to be reviewed / merged. Let me know if you'd like to push back on the histogram / density plot point. |
I found a bug in my code (I used I have not yet updated away from using the "full data" (towards using the "censored data" as suggested by Sam / above). Here the orange bars are showing a different bias as to before in the rendered version. I could still be convinced (I should read your paper properly) but as an outsider it looks like the differences between the orange bars here and the theoretical density is just the sampling variability rather than some bias. Anyway, this is mostly academic because I think the plot now does the job it was intended to do (show that the censored, truncated, sampled data will produce something bad if you use it). |
Here's my light investigation into the discussion about histograms being biased. To me, the final one with highest sample size looks pretty good / unbiased. set.seed(123)
plot_hist <- function(n) {
data.frame(value = rnorm(n, mean = 0, sd = 1)) |>
ggplot(aes(x = value)) +
geom_histogram(aes(y = ..density..), bins = 30, color = "black", fill = "grey90") +
stat_function(fun = dnorm, args = list(mean = 0, sd = 1), color = "firebrick", size = 1) +
labs(title = paste0("Sample size: ", n), y = "", x = "") +
theme_minimal()
}
plots <- lapply(10^{0:5}, plot_hist)
patchwork::wrap_plots(plots)
|
Make it strictly positive and use bin sizes that are relatively big vs the mean + I suggest having another look at @parksw3 work on censoring. I am not clear we want to close #57 without either a new issue addressing this plot or updating it to use actually observed data as discussed. If making a new issue can move above investigation to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving to plotting the retrospective observed data here and opening an issue for exploring how to plot the underlying continuous data in a way that everyone agrees is correct.
The main reason I don't like using
Let's say I swap to "if we had access to |
Here's an update using the lognormal rather than normal:
|
I've moved this to using the retrospective data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good I think. One question about intent as I am slightly not following and another about package dependencies.
a3b4d53
to
0f5570b
Compare
Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 84d65de3087d6cf1d7a82f7b58af2a259e013a0e [formerly 02dd4f2ff5270cb5ec11364382499ee6be1a1e8b] Former-commit-id: e487a3dde30d8c0c28b920687aef5cfbdfd4715c
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 980991b Former-commit-id: def0c7a7d77cc490c9dacd694702162e5f2e27ce
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 980991b Former-commit-id: def0c7a7d77cc490c9dacd694702162e5f2e27ce
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 980991b Former-commit-id: def0c7a7d77cc490c9dacd694702162e5f2e27ce
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 84d65de3087d6cf1d7a82f7b58af2a259e013a0e [formerly 02dd4f2ff5270cb5ec11364382499ee6be1a1e8b] Former-commit-id: e487a3dde30d8c0c28b920687aef5cfbdfd4715c
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 84d65de3087d6cf1d7a82f7b58af2a259e013a0e [formerly 02dd4f2ff5270cb5ec11364382499ee6be1a1e8b] Former-commit-id: e487a3dde30d8c0c28b920687aef5cfbdfd4715c Former-commit-id: d0b3080
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 980991b Former-commit-id: def0c7a7d77cc490c9dacd694702162e5f2e27ce Former-commit-id: ada96fedcc73b5f5e78259dbd55b3d16434c604b [formerly 92ea6a2] Former-commit-id: 116b162375f492fcd69c3cda9a187defee3a4eac
* Move package load, and put data.table comment into ^[] * Remove mention of compare section (merged into model) * Reduce number of code lines a little * Use ref for the table as hoped! * Add primary and secondary sentence * Add text about Figure 2.2 * Add clarification on Figure 1.4 * Improvements to Figure 2.1 * Using gt and dplyr here * Update to use the retrospective data * Improve writing about histograms, and fix colour typo * Downplay censoring less * Rewrite ref:obs-est caption * Add dplyr to Suggests * Update vignettes/epidist.Rmd Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> --------- Co-authored-by: Sam Abbott <s.e.abbott12@gmail.com> Former-commit-id: 980991b Former-commit-id: def0c7a7d77cc490c9dacd694702162e5f2e27ce Former-commit-id: ada96fedcc73b5f5e78259dbd55b3d16434c604b [formerly 92ea6a2] Former-commit-id: 116b162375f492fcd69c3cda9a187defee3a4eac
Description
This PR closes #57.
(ref:...)
Checklist