Calculate a data.frame of posterior infection-hazard estimates broken down
by time period and strata.
Usage
calculate_hazard(x, ...)
# S3 method for class 'SeverityEstimateFit'
calculate_hazard(
x,
mean_estimate = TRUE,
median_estimate = TRUE,
alpha = 0.05,
...
)
# S3 method for class 'list'
calculate_hazard(
x,
time_period,
strata,
population = NULL,
mean_estimate = TRUE,
median_estimate = TRUE,
alpha = 0.05,
...
)
# Default S3 method
calculate_hazard(x, ...)Arguments
- x
An object to calculate hazard statistics from, typically a SeverityEstimateFit S4 object.
- ...
Further arguments passed to other methods.
- mean_estimate
A single logical indicating if the mean estimate for the hazard should be included in the
mean_estimatecolumn of the returneddata.frame.- median_estimate
A single logical indicating if the median estimate for the hazard should be included in the
median_estimatecolumn of the returneddata.frame.- alpha
A numeric of significance levels to return the hazard confidence intervals for. The columns will be in
\{lower/upper\}_\{alpha\}format (i.e.lower_05andupper_05foralpha=0.05).- time_period
A
data.framedescribing the time-period dimension of the underlying hazard.- strata
A
data.framedescribing the strata dimension of the underlying hazard.- population
Optional numeric vector describing the population for each strata row. If provided, strata with zero population are excluded from the returned hazard summary.
Value
calculate_hazard.SeverityEstimateFit returns a data.frame describing
posterior hazard estimates by time period and strata.
calculate_hazard.default signals an error.
Examples
logit_hzd <- array(
qlogis(seq(0.01, 0.08, length.out = 8L)),
dim = c(2L, 2L, 2L)
)
calculate_hazard(
list(logit_hzd = logit_hzd),
time_period = data.frame(week = 1L:2L),
strata = data.frame(age = c("Adult", "Senior")),
alpha = numeric()
)
#> week age mean_estimate median_estimate
#> 1 1 Adult 0.015 0.015
#> 2 1 Senior 0.055 0.055
#> 3 2 Adult 0.035 0.035
#> 4 2 Senior 0.075 0.075