diff --git a/DESCRIPTION b/DESCRIPTION index c26a865..331cfba 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,10 @@ Package: serosv Type: Package Title: Model Infectious Disease Parameters from Serosurveys -Version: 1.1.0 +Version: 1.2.0 Authors@R: c( - person("Anh", "Phan Truong Quynh", email = "anhptq@oucru.org", role = c("aut", "cre")), - person("Nguyen", "Pham Nguyen The", email = "nguyenpnt@oucru.org", role = c("aut")), + person("Anh", "Phan Truong Quynh", email = "anhptq@oucru.org", role = c("aut", "cre"), comment = c(ORCID = "0009-0000-2129-435X")), + person("Nguyen", "Pham Nguyen The", email = "nguyenpnt@oucru.org", role = c("aut"), comment = c(ORCID = "0000-0002-0356-2776")), person("Long", "Bui Thanh", role = "aut"), person("Tuyen", "Huynh", email = "tuyenhn@oucru.org", role = "aut"), person("Thinh", "Ong", email = "thinhop@oucru.org", role = "aut", comment = c(ORCID = "0000-0001-6772-9291")), @@ -21,6 +21,7 @@ RoxygenNote: 7.3.1 Imports: deSolve, dplyr, + tidyr, ggplot2, locfit, purrr, @@ -63,6 +64,7 @@ Collate: 'stanmodels.R' 'plots.R' 'compute_ci.R' + 'age_time_model.R' Config/testthat/edition: 3 URL: https://oucru-modelling.github.io/serosv/, https://github.com/OUCRU-Modelling/serosv VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 3c38ac7..6d3330b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(plot,age_time_model) S3method(plot,estimate_from_mixture) S3method(plot,farrington_model) S3method(plot,fp_model) @@ -13,8 +14,10 @@ S3method(plot,sir_basic_model) S3method(plot,sir_static_model) S3method(plot,sir_subpops_model) S3method(plot,weibull_model) +export(age_time_model) export(compare_models) export(compute_ci) +export(compute_ci.age_time_model) export(compute_ci.fp_model) export(compute_ci.lp_model) export(compute_ci.mixture_model) @@ -41,12 +44,15 @@ export(sir_subpops_model) export(transform_data) export(weibull_model) import(Rcpp) +import(assertthat) import(dplyr) import(ggplot2) import(graphics) import(magrittr) import(methods) +import(mgcv) import(patchwork) +import(tidyr) importFrom(RcppParallel,RcppParallelLibs) importFrom(assertthat,assert_that) importFrom(boot,inv.logit) diff --git a/NEWS.md b/NEWS.md index 0324db4..76a8a94 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# serosv 1.2.0 + # serosv 1.1.0 * add correct_prevalence() function to estimate real prevalence from imperfect test * add compare_models() function for model selection diff --git a/R/age_time_model.R b/R/age_time_model.R new file mode 100644 index 0000000..c8d7280 --- /dev/null +++ b/R/age_time_model.R @@ -0,0 +1,208 @@ +# ------ Demo function -------- +#' Age-time varying seroprevalence +#' Fit age-stratified seroprevalence across multiple time points. Also try to monotonize age (or cohort) - specific seroprevalence. +#' +#' @param data - input data, must have`age`, `status`, time, group columns, where group column determines how data is aggregated +#' @param time_col - name of the column for time (default to `date`) +#' @param grouping_col - name of the column for time (default to `group`) +#' @param age_correct - a boolean, if `TRUE`, monotonize age-specific prevalence. Monotonize birth cohort-specific seroprevalence otherwise. +#' @param le - number of bins to generate age grid, used when monotonizing data +#' @param ci - confidence interval for smoothing +#' @import mgcv +#' +#' @return a list of class time_age_model with 3 items +#' \item{out}{a data.frame with dimension n_group x 9, where columns `info`, `sp`, `foi` store output for non-monotonized +#' data and `monotonized_info`, `monotonized_sp`, `monotonized_foi`, `monotonized_ci_mod` store output for monotnized data} +#' \item{grouping_col}{name of the column for grouping} +#' \item{age_correct}{a boolean indicating whether the data is monotonized across age or cohort} +#' @export +age_time_model <- function(data, time_col="date", grouping_col="group", + age_correct=F, le=512, ci = 0.95){ + + + # ---- helper functions ----- + shift_right <- \(n,x){ if(n == 1) x else dplyr::lag(x, n, default = NA)} + # function to simulate data for monotonize process + generate_data <- \(dat, mod, no_sim=100) { + link_inv <- family(mod)$linkinv + n <- nrow(dat) - length(coef(mod)) + p <- (1 - ci)/2 + + pred <- predict(mod, dat, se.fit = TRUE) %>% + as_tibble() %>% + select(fit, se.fit) %>% + mutate( + ymin = link_inv(fit + qt(p, n) * se.fit), + ymax = link_inv(fit + qt(1 - p, n) * se.fit), + y = link_inv(fit) + ) %>% + select(-se.fit,-fit) + + dat %>% + bind_cols(pred) %>% + pivot_longer(c(ymin, ymax, y), + names_to = "ys", + values_to = "prevalence") + } + # function to monotonize data using serosv pava function + monotonize_data <- \(dat, grp){ + dat %>% + arrange(mean_time) %>% + mutate( + prevalence = serosv::pava(prevalence)$pai2 + ) + } + # initialize model obj + model <- list() + + # --- preprocess data ------ + check_input <- serosv:::check_input(data) + age_range <- range(data$age) + age_grid <- seq(age_range[1], age_range[2], length.out = le) + + model$datatype <- check_input$type + data <- check_input[c("age", "pos", "tot")] %>% as.data.frame() %>% bind_cols(data[c(time_col, grouping_col)]) + + # ---- gam model for age-stratified prevalence for each group ----- + gam_mods <- data %>% + group_by(.data[[grouping_col]]) %>% nest() %>% + mutate( + mod = map(data, \(dat){ + # handle potential error when dataset is small + k <- if(length(unique(dat$age)) < 10) length(unique(dat$age)) - 1 else -1 + + mod <- if(model$datatype == "linelisting") gam(pos ~ s(age, k=k), data = dat, family = binomial) else + gam(cbind(pos, tot - pos) ~ s(age, k=k), data = dat, family = binomial) + mod + }), + mean_time = map_dbl(data, \(dat){mean(dat[[time_col]])}) %>% as.Date() + ) %>% + ungroup() + + # ----- branching based on age_correct --- + # if age_correct is TRUE: enforce monotonic increase in prevalence overtime within age group + # otherwise: enforce monotonic increase in prevalence within cohort + if(age_correct == FALSE){ + # simulate data + monotonize data using scam + scam_out <- gam_mods %>% + select(!!sym(grouping_col), mod, mean_time) %>% + mutate( + # simulate data to fit scam model + sim_data = map(mod, \(mod){ + data.frame(age = age_grid) %>% generate_data(mod) + }) + ) %>% + select(-mod) %>% unnest(sim_data) %>% + group_by(age, ys) %>% + group_modify(monotonize_data) %>% ungroup() + + # modify monotonized data + scam_out <- scam_out %>% + pivot_wider(names_from = ys, values_from = prevalence) %>% + group_by(!!sym(grouping_col), mean_time) %>% + nest() + }else{ + dpy <- 365 + + # simulate data to monotonize + # return a data.frame of collection_time, age (at current collection time), cohort (age at first collection time) + scam_data <- gam_mods %>% + mutate( + age = map(mean_time, \(.) { + age_grid + }), + shift_no = (mean_time - min(mean_time)) / (dpy * mean(diff(age_grid))), + cohort = map(shift_no, \(n) { + shift_right(round(n), age_grid) + }), + sim_data = pmap(list(mod, age, cohort, mean_time), + \(mod, age, cohort, mean_time) { + data.frame(age = age, cohort = cohort) %>% + generate_data(mod) + }) + ) %>% + select(!!sym(grouping_col), mean_time, sim_data) %>% + unnest(sim_data) + + # ----- use scam model to monotonize cohort-stratifed prevalence over time---- + scam_out <- scam_data %>% + filter( + cohort < max(age) - diff(range(mean_time)) / dpy, + !is.na(cohort) + ) %>% + group_by(cohort, ys) %>% + group_modify(monotonize_data) %>% + ungroup() + + + # mapping to covert cohort to age + cohort_age_mapping <- scam_data %>% + select(col_time, age, cohort) %>% + unique() + + # map cohort from monotized data to age (at collection time) + scam_out <- scam_out %>% + left_join( + cohort_age_mapping, + by = join_by( + !!sym(grouping_col) == !!sym(grouping_col), cohort == cohort, age == age + ) + ) %>% + pivot_wider(names_from = ys, values_from = prevalence) %>% + group_by(!!sym(grouping_col), mean_time) %>% + nest() + } + + # ------ Fit the monotonized data ------ + out <- scam_out %>% + mutate( + monotonized_mod = map(data, \(dat){ + gam(y ~ s(age), family = betar, data = dat) + }), + # also have model for smooth ci + monotonized_ci_mod = map(data, \(dat){ + list( + "ymin" = gam(ymin ~ s(age), family = betar, data = dat), + "ymax" = gam(ymax ~ s(age), family = betar, data = dat) + ) + }) + ) %>% + ungroup() %>% + select(-data) %>% + right_join(gam_mods, + by = join_by(!!sym(grouping_col) == !!sym(grouping_col), mean_time == mean_time)) %>% + select(-mean_time) + + # reformat output + out <- out %>% + # rename to follow the convention of other functions + rename( + df = data, + info = mod, + monotonized_info = monotonized_mod + ) %>% + # finally predict seroprevalence and foi for the input data + mutate( + sp = map2(df, info, \(dat, mod){ + predict(mod, list(age = dat$age), type="response") + }), + foi = map2(df, sp, \(dat, sp){ + est_foi(dat$age, sp) + }), + monotonized_sp = map2(df, monotonized_info, \(dat, mod){ + predict(mod, list(age = dat$age), type="response") + }), + monotonized_foi = map2(df, monotonized_sp, \(dat, sp){ + est_foi(dat$age, sp) + }) + ) + + model$out <- out + model$grouping_col <- grouping_col + model$age_correct <- age_correct + + + class(model) <- "age_time_model" + + model +} diff --git a/R/compute_ci.R b/R/compute_ci.R index 21f48d8..f92d6a4 100644 --- a/R/compute_ci.R +++ b/R/compute_ci.R @@ -203,6 +203,89 @@ compute_ci.mixture_model <- function(x,ci = 0.95, ...){ return(list(susceptible= susceptible, infected=infected)) } +#' Compute confidence interval for time age model +#' +#' @param x - serosv models +#' @param ci - confidence interval +#' @param le - number of data for computing confidence interval +#' @param ... - arbitrary argument +#' +#' @importFrom mgcv predict.gam +#' @import dplyr +#' +#' @return confidence interval dataframe with n_group x 3 cols, the columns are `group`, `sp_df`, `foi_df` +#' @export +compute_ci.age_time_model <- function(x, ci=0.95, le = 100, ...){ + # check which type of model user wants to visualize + modtype <- if (is.null(list(...)[["modtype"]])) "monotonized" else list(...)$modtype + assert_that( + modtype == "monotonized" | modtype == "non-monotonized", + msg = "modtype argument must be eithers 'monotonized' or 'non-monotonized'" + ) + + p <- (1 - ci) / 2 + + # use model to generate seroprev (with CI) and FOI on a finer grid for plotting + age_range <- range(bind_rows(x$out$df)$age) + out <- x$out %>% + mutate( + age = map(df, \(dat){ + seq(age_range[1], age_range[2], length.out = le) + }) + ) + + # --- use the monotonized model for prediction and ci----- + if(modtype == "monotonized"){ + out <- out %>% + mutate( + sp_df = pmap(list(monotonized_info, monotonized_ci_mod, age), \(mod, ci_mod, grid){ + data.frame( + x = grid, + y = predict(mod, list(age = grid), type = "response"), + ymin = predict(ci_mod$ymin, list(age = grid), type = "response"), + ymax = predict(ci_mod$ymax, list(age = grid), type = "response") + ) + }) + ) + }else{ + # --- if user specify non-monotonized then simply compute CI from gam model----- + out <- out %>% + mutate( + sp_df = map2(info, age, \(mod, grid){ + link_inv <- mod$family$linkinv + dataset <- mod$model[,1:2] + n <- nrow(dataset) - length(mod$coefficients) + + predict(mod, data.frame(age = grid), se.fit = TRUE) %>% + as_tibble() %>% + select(fit, se.fit) %>% + mutate( + x = grid, + ymin = link_inv(fit + qt( p, n) * se.fit), + ymax = link_inv(fit + qt(1 - p, n) * se.fit), + y = link_inv(fit) + ) %>% + select(- se.fit) + }) + ) + } + + # --- finally, compute FOI ----- + out <- out %>% + mutate( + foi_df = map2(age, sp_df, \(grid, sp){ + foi_x <- sort(unique(grid)) + foi_x <- foi_x[c(-1, -length(foi_x) )] + + tibble( + x = foi_x, + y = est_foi(grid, sp$y) + ) + }) + ) %>% + select(!!sym(x$grouping_col), sp_df, foi_df) +} + diff --git a/R/plots.R b/R/plots.R index 41dc91f..ca39e4b 100644 --- a/R/plots.R +++ b/R/plots.R @@ -527,6 +527,80 @@ plot.estimate_from_mixture <- function(x, ... ){ returned_plot + set_plot_style() + labs(x = "Age", y="Seroprevalence") } +#' Plot output for age_time_model +#' +#' @param x - a `age_time_model` object +#' @param facet - whether to facet the plot by group or not +#' @param modtype - indicate which model to plot, either "monotonized" or "non-monotonized" +#' @param le - number of bins to generate x axis, higher value return smoother plot +#' @param cex - adjust the of the data points (only when facet = TRUE) +#' +#' @importFrom graphics plot +#' @import ggplot2 assertthat tidyr +#' +#' @return ggplot object +#' @export +plot.age_time_model <- function(x, ...){ + # check whether user specify facet + facet <- if (is.null(list(...)[["facet"]])) TRUE else list(...)$facet + cex <- if (is.null(list(...)[["cex"]])) 10 else list(...)$cex + le <- if (is.null(list(...)[["le"]])) 100 else list(...)$le + + assert_that( + is.logical(facet), + msg = "facet argument must be of type logical" + ) + + # check which type of model user wants to visualize + modtype <- if (is.null(list(...)[["modtype"]])) "monotonized" else list(...)$modtype + assert_that( + modtype == "monotonized" | modtype == "non-monotonized", + msg = "modtype argument must be eithers 'monotonized' or 'non-monotonized'" + ) + + # compute the CI for sp + out <- compute_ci.age_time_model(x, modtype = modtype, le = le) + + # get seroprev data and foi data for plotting + sp_dat <- out %>% select(!!sym(x$grouping_col), sp_df) %>% unnest(sp_df) + foi_dat <- out %>% select(!!sym(x$grouping_col), foi_df) %>% unnest(foi_df) + + # get input data points + df_dat <- x$out %>% + select(!!sym(x$grouping_col), df) %>% + unnest(df) %>% + mutate(age = round(age)) %>% + group_by(!!sym(x$grouping_col), age) %>% + summarize( + pos = sum(pos, na.rm = TRUE), + tot = sum(tot, na.rm = TRUE), + .groups = "drop" + ) %>% + mutate(seroprev = pos/tot) + + ggplot() + + geom_smooth(aes( + x = x, y = y, ymin=ymin, ymax=ymax, + color = if(facet) "sero" else as.factor(!!sym(x$grouping_col)), + fill = if(facet) "ci" else as.factor(!!sym(x$grouping_col)) + ), stat = "identity", lwd=0.5, alpha=0.2, data = sp_dat) + + geom_line(aes( + x = x, y = y, color = if(facet) "foi" else as.factor(!!sym(x$grouping_col)) + ), linetype = "dashed", data = foi_dat) + + ylim(c(0, 1)) + + if (facet) + list( + geom_point( + aes(x = age, y = seroprev, size = cex*pos/max(tot)), shape = 1, + data = df_dat + ), + guides(shape = "none", size = "none"), + serosv:::set_plot_style(), + facet_wrap(vars(!!sym(x$grouping_col))) + ) else + labs(color = x$grouping_col, fill = x$grouping_col) +} + #### GCV values #### #' Plotting GCV values with respect to different nn-s and h-s parameters. diff --git a/R/polynomial_models.R b/R/polynomial_models.R index fbcb520..c6113ef 100644 --- a/R/polynomial_models.R +++ b/R/polynomial_models.R @@ -19,7 +19,7 @@ X <- function(t, degree) { #' @examples #' data <- parvob19_fi_1997_1998[order(parvob19_fi_1997_1998$age), ] #' data$status <- data$seropositive -#' aggregated <- transform_data(data$age, data$seropositive, heterogeneity_col = "age") +#' aggregated <- transform_data(data$age, data$seropositive, stratum_col = "age") #' #' # fit with aggregated data #' model <- polynomial_model(aggregated, type = "Muench") @@ -80,10 +80,10 @@ polynomial_model <- function(data, k,type, link = "log"){ #' @return a list of class farrington_model with 5 items #' \item{datatype}{type of datatype used for model fitting (aggregated or linelisting)} #' \item{df}{the dataframe used for fitting the model} -#' \item{info}{fitted "glm" object} +#' \item{info}{fitted "mle" object} #' \item{sp}{seroprevalence} #' \item{foi}{force of infection} -#' @seealso [stats::glm()] for more information on the fitted glm object +#' @seealso [stats4::mle()] for more information on the fitted mle object #' #' @examples #' df <- rubella_uk_1986_1987 diff --git a/R/utils.R b/R/utils.R index 7113ad0..481763f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -58,9 +58,9 @@ pava<- function(pos=pos,tot=rep(1,length(pos))) #' Generate a dataframe with `t`, `pos` and `tot` columns from #' `t` and `seropositive` vectors. #' -#' @param t the time vector. +#' @param t the time vector (for stratification). #' @param spos the seropositive vector. -#' @param heterogeneity_col new name for the time vector (default to "t") +#' @param stratum_col new name for the time vector (default to "t") #' #' @examples #' df <- hcv_be_2006 @@ -74,7 +74,7 @@ pava<- function(pos=pos,tot=rep(1,length(pos))) #' #' @return dataframe in aggregated format #' @export -transform_data <- function(t, spos, heterogeneity_col = "t") { +transform_data <- function(t, spos, stratum_col = "t") { df <- data.frame(t, spos) df_agg <- df %>% group_by(t) %>% @@ -82,7 +82,7 @@ transform_data <- function(t, spos, heterogeneity_col = "t") { pos = sum(spos), tot = n() ) - colnames(df_agg) <- c(heterogeneity_col, "pos", "tot") + colnames(df_agg) <- c(stratum_col, "pos", "tot") df_agg } @@ -92,7 +92,7 @@ transform_data <- function(t, spos, heterogeneity_col = "t") { # - type of data (either linelisting or aggregated) # - preprocessed pos and tot columns #' @importFrom assertthat assert_that -check_input <- function(data, heterogeneity_col = "age"){ +check_input <- function(data, stratum_col = "age"){ assert_that( is.data.frame(data), msg = "Input must be a data.frame or tibble" @@ -104,22 +104,22 @@ check_input <- function(data, heterogeneity_col = "age"){ type <- NULL - if( all(c(heterogeneity_col, "pos", "tot") %in% colnames(data)) ){ - age <- as.numeric(data[[heterogeneity_col]]) + if( all(c(stratum_col, "pos", "tot") %in% colnames(data)) ){ + age <- as.numeric(data[[stratum_col]]) pos <- as.numeric(data$pos) tot <- as.numeric(data$tot) type <- "aggregated" - }else if( all(c(heterogeneity_col, "status") %in% colnames(data)) ){ - age <- as.numeric(data[[heterogeneity_col]]) + }else if( all(c(stratum_col, "status") %in% colnames(data)) ){ + age <- as.numeric(data[[stratum_col]]) pos <- as.numeric(data$status) tot <- rep(1, length(data$status)) type <- "linelisting" }else{ stop(paste0( "Data must have `", - heterogeneity_col, + stratum_col, "`, `pos`, `tot` columns for aggregated data OR `", - heterogeneity_col, + stratum_col, "`, `status` columns for linelisting data" )) } diff --git a/R/weibull_model.R b/R/weibull_model.R index 6acfada..05631c6 100644 --- a/R/weibull_model.R +++ b/R/weibull_model.R @@ -28,7 +28,7 @@ weibull_model <- function(data) model <- list() # check input whether it is line-listing or aggregated data - data <- check_input(data, heterogeneity_col = "t") + data <- check_input(data, stratum_col = "t") t <- data$age pos <- data$pos tot <- data$tot diff --git a/README.Rmd b/README.Rmd index f474645..a96289b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -118,10 +118,9 @@ parvob19 <- parvob19_fi_1997_1998 transform_data( parvob19$age, parvob19$seropositive, - heterogeneity_col = "age") %>% + stratum_col = "age") %>% polynomial_model(type = "Muench") %>% plot() - # or fit data as is parvob19 %>% rename(status = seropositive) %>% diff --git a/README.md b/README.md index 463b306..85b5f9e 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ parvob19 <- parvob19_fi_1997_1998 transform_data( parvob19$age, parvob19$seropositive, - heterogeneity_col = "age") %>% + stratum_col = "age") %>% polynomial_model(type = "Muench") %>% plot() ``` diff --git a/_pkgdown.yml b/_pkgdown.yml index d66dd58..208fa7b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -55,6 +55,7 @@ reference: - penalized_spline_model - mixture_model - estimate_from_mixture + - age_time_model - title: Plotting functions contents: @@ -72,6 +73,7 @@ reference: - plot.penalized_spline_model - plot.mixture_model - plot.estimate_from_mixture + - plot.age_time_model - set_plot_style - title: Other utilities @@ -88,6 +90,7 @@ reference: - compute_ci.weibull_model - compute_ci.penalized_spline_model - compute_ci.mixture_model + - compute_ci.age_time_model - find_best_fp_powers articles: diff --git a/docs/404.html b/docs/404.html index cd7d347..4ac8e06 100644 --- a/docs/404.html +++ b/docs/404.html @@ -31,7 +31,7 @@ serosv - 1.0.1.9000 + 1.2.0 + + + + + +
+
+
+ +
+

Age-time varying seroprevalence +Fit age-stratified seroprevalence across multiple time points. Also try to monotonize age (or cohort) - specific seroprevalence.

+
+ +
+

Usage

+
age_time_model(
+  data,
+  time_col = "date",
+  grouping_col = "group",
+  age_correct = F,
+  le = 512,
+  ci = 0.95
+)
+
+ +
+

Arguments

+
data
+

- input data, must have`age`, `status`, time, group columns, where group column determines how data is aggregated

+ + +
time_col
+

- name of the column for time (default to `date`)

+ + +
grouping_col
+

- name of the column for time (default to `group`)

+ + +
age_correct
+

- a boolean, if `TRUE`, monotonize age-specific prevalence. Monotonize birth cohort-specific seroprevalence otherwise.

+ + +
le
+

- number of bins to generate age grid, used when monotonizing data

+ + +
ci
+

- confidence interval for smoothing

+ +
+
+

Value

+ + +

a list of class time_age_model with 3 items

+
out
+

a data.frame with dimension n_group x 9, where columns `info`, `sp`, `foi` store output for non-monotonized +data and `monotonized_info`, `monotonized_sp`, `monotonized_foi`, `monotonized_ci_mod` store output for monotnized data

+ +
grouping_col
+

name of the column for grouping

+ +
age_correct
+

a boolean indicating whether the data is monotonized across age or cohort

+ +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/compare_models.html b/docs/reference/compare_models.html index 6f4f386..8464b17 100644 --- a/docs/reference/compare_models.html +++ b/docs/reference/compare_models.html @@ -10,7 +10,7 @@ serosv - 1.0.1.9000 + 1.2.0 + + + + + +
+
+
+ +
+

Compute confidence interval for time age model

+
+ +
+

Usage

+
compute_ci.age_time_model(x, ci = 0.95, le = 100, ...)
+
+ +
+

Arguments

+
x
+

- serosv models

+ + +
ci
+

- confidence interval

+ + +
le
+

- number of data for computing confidence interval

+ + +
...
+

- arbitrary argument

+ +
+
+

Value

+ + +

confidence interval dataframe with n_group x 3 cols, the columns are `group`, `sp_df`, `foi_df`

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/compute_ci.fp_model.html b/docs/reference/compute_ci.fp_model.html index c7e8838..85618ed 100644 --- a/docs/reference/compute_ci.fp_model.html +++ b/docs/reference/compute_ci.fp_model.html @@ -10,7 +10,7 @@ serosv - 1.0.1.9000 + 1.2.0
+ + + + + +
+
+
+ +
+

Plot output for age_time_model

+
+ +
+

Usage

+
# S3 method for age_time_model
+plot(x, ...)
+
+ +
+

Arguments

+
x
+

- a `age_time_model` object

+ + +
facet
+

- whether to facet the plot by group or not

+ + +
modtype
+

- indicate which model to plot, either "monotonized" or "non-monotonized"

+ + +
le
+

- number of bins to generate x axis, higher value return smoother plot

+ + +
cex
+

- adjust the of the data points (only when facet = TRUE)

+ +
+
+

Value

+ + +

ggplot object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/plot.estimate_from_mixture.html b/docs/reference/plot.estimate_from_mixture.html index e35915e..95c390a 100644 --- a/docs/reference/plot.estimate_from_mixture.html +++ b/docs/reference/plot.estimate_from_mixture.html @@ -10,7 +10,7 @@ serosv - 1.0.1.9000 + 1.2.0