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

Remove Hmisc dependency #273

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/CONTRIBUTING.md

This file was deleted.

13 changes: 0 additions & 13 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,6 @@ references:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2025'
- type: software
title: Hmisc
abstract: 'Hmisc: Harrell Miscellaneous'
notes: Imports
url: https://hbiostat.org/R/Hmisc/
repository: https://CRAN.R-project.org/package=Hmisc
authors:
- family-names: Harrell Jr
given-names: Frank E
email: [email protected]
orcid: https://orcid.org/0000-0002-8271-5493
year: '2025'
doi: 10.32614/CRAN.package.Hmisc
- type: software
title: loo
abstract: 'loo: Efficient Leave-One-Out Cross-Validation and WAIC for Bayesian Models'
Expand Down
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Imports:
ggplot2,
glue,
graphics,
Hmisc,
loo,
Matrix,
methods,
Expand Down
29 changes: 16 additions & 13 deletions R/plot_seromodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@ prepare_serosurvey_for_plotting <- function( #nolint
serosurvey,
alpha = 0.05
) {

serosurvey <- cbind(
# The binomial confidence interval calculation is based on:
# https://forum.posit.co/t/apply-binomial-test-for-each-row-in-a-data-table/32112/2 #nolint
serosurvey$seroprev <- serosurvey$n_seropositive / serosurvey$n_sample
serosurvey <- dplyr::mutate(
serosurvey,
Hmisc::binconf(
serosurvey$n_seropositive,
serosurvey$n_sample,
alpha = alpha,
method = "exact",
return.df = TRUE
binconf = purrr::pmap(
.l = serosurvey,
.f = purrr::lift_vd(..f = function(dat) {
ci <- stats::binom.test(
x = dat["n_seropositive"],
n = dat["n_sample"],
p = dat["seroprev"],
conf.level = 1 - alpha)$conf.int
names(x = ci) <- c("seroprev_lower", "seroprev_upper")
return(ci)
})
)
) |>
dplyr::rename(
seroprev = "PointEst",
seroprev_lower = "Lower",
seroprev_upper = "Upper"
) |>
tidyr::unnest_wider(.data$binconf) |>
dplyr::arrange(.data$age_group) |>
dplyr::relocate(!!dplyr::sym("age_group"))

Expand Down
Loading