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

- added test data #314

Merged
merged 6 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: serocalculator
Title: Estimating Infection Rates from Serological Data
Version: 1.2.0.9018
Version: 1.2.0.9019
Authors@R: c(
person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"),
comment = "Author of the method and original code."),
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# serocalculator (development version)

## New features

* Added example datasets with documentation for examples and testing (#314)

* Improved error messaging for `autoplot.pop_data()` (#234).

* Clarified package installation instructions in scrub typhus vignette (#234).
Expand Down
26 changes: 26 additions & 0 deletions R/example_noise_params_pk.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#' @title Small example of noise parameters for typhoid
#'
#' @description A subset of noise parameter estimates from the SEES study,
#' for examples and testing.
#'
#' @format ## `example_noise_params_pk`
#' A `curve_params` object (from [as_curve_params()]) with 4 rows and 7 columns:
#' \describe{
#' \item{antigen_iso}{which antigen and isotype are being measured
#' (data is in long format)}
#' \item{Country}{Location for which the noise parameters were estimated}
#' \item{y.low}{Lower limit of detection}
#' \item{eps}{Measurement noise, defined by a CV (coefficient of variation)
#' as the ratio of the standard deviation to the mean for replicates.
#' Note that the CV should ideally be measured across plates
#' rather than within the same plate.}
#' \item{nu}{Biological noise: error from
#' cross-reactivity to other antibodies.
#' It is defined as the 95th percentile of
#' the distribution of antibody responses to the antigen-isotype
#' in a population with no exposure.}
#' \item{y.high}{Upper limit of detection}
#' \item{Lab}{Lab for which noise was estimated.}
#' }
#' @source <https://osf.io/rtw5k>
"example_noise_params_pk"
19 changes: 19 additions & 0 deletions R/example_typhoid_curves_nostrat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#' Small example of antibody response curve parameters for typhoid
#'
#' A subset of data from the SEES study, for examples and testing.
#'
#' @format ## `typhoid_curves_nostrat_100`
#' A `curve_params` object (from [as_curve_params()]) with 500 rows and 7
#' columns:
#' \describe{
#' \item{antigen_iso}{which antigen and isotype are being measured
#' (data is in long format)}
#' \item{iter}{MCMC iteration}
#' \item{y0}{Antibody concentration at t = 0 (start of active infection)}
#' \item{y1}{Antibody concentration at t = `t1` (end of active infection)}
#' \item{t1}{Duration of active infection}
#' \item{alpha}{Antibody decay rate coefficient}
#' \item{r}{Antibody decay rate exponent parameter}
#' }
#' @source <https://osf.io/rtw5k>
"typhoid_curves_nostrat_100"
37 changes: 37 additions & 0 deletions R/sees_pop_data_pakistan_100.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#' Small example cross-sectional data set
#'
#' A subset of data from the SEES data, for examples and testing.
#'
#' @format ## `sees_pop_data_pk_100`
#' A `pop_data` object (from [as_pop_data()]) with 200 rows and 8 columns:
#' \describe{
#' \item{id}{Observation ID}
#' \item{Country}{Country where the participant was living}
#' \item{cluster}{survey sampling cluster}
#' \item{catchment}{survey catchment area}
#' \item{age}{participant's age when sampled, in years}
#' \item{antigen_iso}{which antigen and isotype are being measured
#' (data is in long format)}
#' \item{value}{concentration of antigen isotype, in ELISA units}
#' }
#' @source <https://osf.io/n6cp3>
"sees_pop_data_pk_100"

#' Small example cross-sectional data set
#'
#' A subset of data from the SEES data, for examples and testing.
#'
#' @format ## `sees_pop_data_pk_100_old_names`
#' A `pop_data` object (from [as_pop_data()]) with 200 rows and 8 columns:
#' \describe{
#' \item{index_id}{Observation ID}
#' \item{Country}{Country where the participant was living}
#' \item{cluster}{survey sampling cluster}
#' \item{catchment}{survey catchment area}
#' \item{Age}{participant's age when sampled, in years}
#' \item{antigen_iso}{which antigen and isotype are being measured
#' (data is in long format)}
#' \item{result}{concentration of antigen isotype, in ELISA units}
#' }
#' @source <https://osf.io/n6cp3>
"sees_pop_data_pk_100_old_names"
5 changes: 5 additions & 0 deletions data-raw/example_noise_params_pk.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
example_noise_params_pk <-
load_noise_params("https://osf.io/download//hqy4v/") %>%
filter(Country == "Pakistan")

usethis::use_data(example_noise_params_pk, overwrite = TRUE)
23 changes: 23 additions & 0 deletions data-raw/sees_pop_data_pakistan_100.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sees_pop_data_pk_100 <- load_pop_data(
file_path = "https://osf.io/download//n6cp3/",
age = "Age",
value = "result",
id = "index_id",
standardize = TRUE
) %>%
filter(Country == "Pakistan") %>%
slice_head(n = 100, by = antigen_iso)

usethis::use_data(sees_pop_data_pk_100, overwrite = TRUE)

sees_pop_data_pk_100_old_names <- load_pop_data(
file_path = "https://osf.io/download//n6cp3/",
age = "Age",
value = "result",
id = "index_id",
standardize = FALSE
) %>%
filter(Country == "Pakistan") %>%
slice_head(n = 100, by = antigen_iso)

usethis::use_data(sees_pop_data_pk_100_old_names, overwrite = TRUE)
5 changes: 5 additions & 0 deletions data-raw/typhoid_curves_nostrat_100.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typhoid_curves_nostrat_100 <-
load_curve_params("https://osf.io/download/rtw5k/") %>%
dplyr::filter(iter %in% 1:100)

usethis::use_data(typhoid_curves_nostrat_100, overwrite = TRUE)
Binary file added data/example_noise_params_pk.rda
Binary file not shown.
Binary file added data/sees_pop_data_pk_100.rda
Binary file not shown.
Binary file added data/sees_pop_data_pk_100_old_names.rda
Binary file not shown.
Binary file added data/typhoid_curves_nostrat_100.rda
Binary file not shown.
40 changes: 40 additions & 0 deletions man/example_noise_params_pk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions man/sees_pop_data_pk_100.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions man/sees_pop_data_pk_100_old_names.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions man/typhoid_curves_nostrat_100.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading