Convert surveil
model results to age standardized rates using a fixed age distribution
standardize(x, label, standard_pop)
A fitted surveil
model
Labels (character strings) for the age groups that correspond to the values of stand_pop
. All levels of the grouping variable used to fit the model (i.e., names(x$data$cases)
) must be present in label
.
Standard population values corresponding to the age groups specified by label
.
A list, also of class "stand_surveil", containing the entire contents of the user-provided surveil
model plus the following:
summary data frame of standardized rates (means and 95 percent credible intervals)
a data frame of Markov chain Monte Carlo (MCMC) samples from the posterior probability distribution for the standardized rates
user-provided age-group labels
user-provided standardized population sizes (ordered as standard_label
)
data(cancer)
data(standard)
head(standard)
head(cancer)
cancer2 <- subset(cancer, grepl("55-59|60-64|65-69", Age))
fit <- stan_rw(cancer2, time = Year, group = Age,
chains = 2, iter = 1e3) # for speed only
stands <- standardize(fit,
label = standard$age,
standard_pop = standard$standard_pop)
print(stands)
plot(stands, style = "lines")