diff --git a/DESCRIPTION b/DESCRIPTION index a059428a..4c57a17d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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."), diff --git a/NEWS.md b/NEWS.md index 87839e24..8d768f2f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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). diff --git a/R/example_noise_params_pk.R b/R/example_noise_params_pk.R new file mode 100644 index 00000000..df5c3dc1 --- /dev/null +++ b/R/example_noise_params_pk.R @@ -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 +"example_noise_params_pk" diff --git a/R/example_typhoid_curves_nostrat.R b/R/example_typhoid_curves_nostrat.R new file mode 100644 index 00000000..3d77103a --- /dev/null +++ b/R/example_typhoid_curves_nostrat.R @@ -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 +"typhoid_curves_nostrat_100" diff --git a/R/sees_pop_data_pakistan_100.R b/R/sees_pop_data_pakistan_100.R new file mode 100644 index 00000000..c7e1c6be --- /dev/null +++ b/R/sees_pop_data_pakistan_100.R @@ -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 +"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 +"sees_pop_data_pk_100_old_names" diff --git a/data-raw/example_noise_params_pk.R b/data-raw/example_noise_params_pk.R new file mode 100644 index 00000000..650dfb56 --- /dev/null +++ b/data-raw/example_noise_params_pk.R @@ -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) diff --git a/data-raw/sees_pop_data_pakistan_100.R b/data-raw/sees_pop_data_pakistan_100.R new file mode 100644 index 00000000..9477da4a --- /dev/null +++ b/data-raw/sees_pop_data_pakistan_100.R @@ -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) diff --git a/data-raw/typhoid_curves_nostrat_100.R b/data-raw/typhoid_curves_nostrat_100.R new file mode 100644 index 00000000..74e58f47 --- /dev/null +++ b/data-raw/typhoid_curves_nostrat_100.R @@ -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) diff --git a/data/example_noise_params_pk.rda b/data/example_noise_params_pk.rda new file mode 100644 index 00000000..685d12f3 Binary files /dev/null and b/data/example_noise_params_pk.rda differ diff --git a/data/sees_pop_data_pk_100.rda b/data/sees_pop_data_pk_100.rda new file mode 100644 index 00000000..0a096d5f Binary files /dev/null and b/data/sees_pop_data_pk_100.rda differ diff --git a/data/sees_pop_data_pk_100_old_names.rda b/data/sees_pop_data_pk_100_old_names.rda new file mode 100644 index 00000000..6f8eb6b1 Binary files /dev/null and b/data/sees_pop_data_pk_100_old_names.rda differ diff --git a/data/typhoid_curves_nostrat_100.rda b/data/typhoid_curves_nostrat_100.rda new file mode 100644 index 00000000..f091aad5 Binary files /dev/null and b/data/typhoid_curves_nostrat_100.rda differ diff --git a/man/example_noise_params_pk.Rd b/man/example_noise_params_pk.Rd new file mode 100644 index 00000000..f10ef837 --- /dev/null +++ b/man/example_noise_params_pk.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/example_noise_params_pk.R +\docType{data} +\name{example_noise_params_pk} +\alias{example_noise_params_pk} +\title{Small example of noise parameters for typhoid} +\format{ +\subsection{\code{example_noise_params_pk}}{ + +A \code{curve_params} object (from \code{\link[=as_curve_params]{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{ +\url{https://osf.io/rtw5k} +} +\usage{ +example_noise_params_pk +} +\description{ +A subset of noise parameter estimates from the SEES study, +for examples and testing. +} +\keyword{datasets} diff --git a/man/sees_pop_data_pk_100.Rd b/man/sees_pop_data_pk_100.Rd new file mode 100644 index 00000000..9019c63f --- /dev/null +++ b/man/sees_pop_data_pk_100.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sees_pop_data_pakistan_100.R +\docType{data} +\name{sees_pop_data_pk_100} +\alias{sees_pop_data_pk_100} +\title{Small example cross-sectional data set} +\format{ +\subsection{\code{sees_pop_data_pk_100}}{ + +A \code{pop_data} object (from \code{\link[=as_pop_data]{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{ +\url{https://osf.io/n6cp3} +} +\usage{ +sees_pop_data_pk_100 +} +\description{ +A subset of data from the SEES data, for examples and testing. +} +\keyword{datasets} diff --git a/man/sees_pop_data_pk_100_old_names.Rd b/man/sees_pop_data_pk_100_old_names.Rd new file mode 100644 index 00000000..87360bf4 --- /dev/null +++ b/man/sees_pop_data_pk_100_old_names.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sees_pop_data_pakistan_100.R +\docType{data} +\name{sees_pop_data_pk_100_old_names} +\alias{sees_pop_data_pk_100_old_names} +\title{Small example cross-sectional data set} +\format{ +\subsection{\code{sees_pop_data_pk_100_old_names}}{ + +A \code{pop_data} object (from \code{\link[=as_pop_data]{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{ +\url{https://osf.io/n6cp3} +} +\usage{ +sees_pop_data_pk_100_old_names +} +\description{ +A subset of data from the SEES data, for examples and testing. +} +\keyword{datasets} diff --git a/man/typhoid_curves_nostrat_100.Rd b/man/typhoid_curves_nostrat_100.Rd new file mode 100644 index 00000000..f333a706 --- /dev/null +++ b/man/typhoid_curves_nostrat_100.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/example_typhoid_curves_nostrat.R +\docType{data} +\name{typhoid_curves_nostrat_100} +\alias{typhoid_curves_nostrat_100} +\title{Small example of antibody response curve parameters for typhoid} +\format{ +\subsection{\code{typhoid_curves_nostrat_100}}{ + +A \code{curve_params} object (from \code{\link[=as_curve_params]{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 = \code{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{ +\url{https://osf.io/rtw5k} +} +\usage{ +typhoid_curves_nostrat_100 +} +\description{ +A subset of data from the SEES study, for examples and testing. +} +\keyword{datasets}