Convert surveil model results to age standardized rates using a fixed age distribution

standardize(x, label, standard_pop)

Arguments

x

A fitted surveil model

label

Labels (character strings) for the age groups that correspond to the values of stand_pop. The labels must match the grouping variable used to fit the model (i.e., all(label %in% names(x$data$cases)) must be true).

standard_pop

Standard population values corresponding to the age groups specified by label

Value

A list, also of class "stand_surveil", containing the entire contents of the user-provided surveil model plus the following:

standard_summary

summary data frame of standardized rates (means and 95 percent credible intervals)

standard_samples

a data frame of Markov chain Monte Carlo (MCMC) samples from the posterior probability distribution for the standardized rates

standard_label

user-provided age-group labels

standard_pop

user-provided standardized population sizes (ordered as standard_label)

Examples

data(cancer)
data(standard)

head(standard)
head(cancer)

# \donttest{
fit <- stan_rw(cancer,
              time = Year,
              group = Age,
              chains = 2, iter = 900 # for speed only
              )

stands <- standardize(fit,
                      label = standard$age,
                      standard_pop = standard$standard_pop)
print(stands)
plot(stands, style = "lines")
# }