surv_lineage_prevalence: Estimate lineage prevalence with design weights

View source: R/03-prevalence.R

print.surv_prevalenceR Documentation

Estimate lineage prevalence with design weights

Description

Estimates the prevalence of a specified pathogen lineage over time, correcting for unequal sequencing rates across strata.

Usage

## S3 method for class 'surv_prevalence'
print(x, ...)

## S3 method for class 'surv_prevalence'
as.data.frame(x, ...)

surv_lineage_prevalence(
  design,
  lineage,
  time = "epiweek",
  method = c("hajek", "horvitz_thompson", "poststratified"),
  conf_level = 0.95,
  min_obs = 5L
)

Arguments

x

Object to convert.

...

Additional arguments (unused).

design

A surv_design object.

lineage

Character. Target lineage name.

time

Character. Time aggregation: "epiweek", "month", "date", or a column name. Default "epiweek".

method

Character. Estimation method: "hajek" (default), "horvitz_thompson", or "poststratified".

conf_level

Numeric. Confidence level. Default 0.95.

min_obs

Integer. Minimum observations per time period. Default 5.

Value

Invisibly returns the input object.

A data.frame.

A surv_prevalence object.

Examples

sim <- surv_simulate(n_regions = 3, n_weeks = 10, seed = 1)
d <- surv_design(sim$sequences, ~ region,
                 sim$population[c("region", "seq_rate")], sim$population)
prev <- surv_lineage_prevalence(d, "BA.2.86")
print(prev)


survinger documentation built on April 27, 2026, 9:10 a.m.