csu_asr | R Documentation |
csu_asr
calculate Age-Standardized Rate (ASR) and Truncated Age-Standardized Rate (TASR) across different population (Registry, year, sex...)
csu_asr(df_data,
var_age = "age",
var_cases = "cases",
var_py ="py",
group_by=NULL,
var_age_group=NULL,
missing_age = NULL,
db_rate = 100000,
first_age = 1,
last_age = 18,
pop_base = "SEGI",
crude_rate = FALSE,
var_st_err = NULL,
correction_info = FALSE,
var_asr = "asr",
age_dropped = FALSE)
df_data |
Data (need to be R | |||||||||||||||||||
var_age |
Age variable. Several format are accepted
Missing age value must be precise in the option | |||||||||||||||||||
var_cases |
Number of event (cases, deaths, ...) variable. | |||||||||||||||||||
var_py |
Population year variable. | |||||||||||||||||||
group_by |
A vector of variables to compare different ASR (sex, country, cancer ...). | |||||||||||||||||||
var_age_group |
Variables over which the number of population age-group might change. | |||||||||||||||||||
missing_age |
Age value representing the missing age cases. | |||||||||||||||||||
db_rate |
The denominator population. Default is 100000. | |||||||||||||||||||
first_age |
First age group included (for Truncated ASR), must be between 1 and 17. 1 represents 0-4, 2 represents 5-9, ... 5 represents 20-24 etc. | |||||||||||||||||||
last_age |
Last age group included (for Truncated ASR), must be between 2 and 18. 2 represents 5-9, ... 5 represents 20-24, ... 18 represents 85+ etc. | |||||||||||||||||||
pop_base |
Select the standard population:
| |||||||||||||||||||
crude_rate |
Logical value. if | |||||||||||||||||||
var_st_err |
Calculate the Standard error and name of the new variable. | |||||||||||||||||||
correction_info |
Logical value. if | |||||||||||||||||||
var_asr |
Name of the new variable for the ASR. | |||||||||||||||||||
age_dropped |
Only for truncated ASR. |
This function take automatically account the number of age group (last age group can be 70+,75+,80+,85+):
If the population data stops before 85+ (75+ for instance), the population data must be 0 when the population data is unknown so, the program can detect automatically the last age group (70+,75+,80+ or 85+) for population.
Give the list of population with less than 18 age group (last age group: 70+, 75+, 80+).
Return a data.frame
.
Mathieu Laversanne
csu_group_cases
csu_merge_cases_pop
csu_cumrisk
csu_eapc
csu_ageSpecific
csu_ageSpecific_top
csu_bar_top
csu_time_trend
csu_trendCohortPeriod
data(csu_registry_data_1)
data(csu_registry_data_2)
# you can import your data from csv file using read.csv:
# mydata <- read.csv("mydata.csv", sep=",")
# Age standardized rate (ASR) with no missing age cases.
result <- csu_asr(csu_registry_data_1,
"age", "cases", "py",
group_by = c("registry", "registry_label" ),
var_age_group = c("registry_label"))
# you can export your result as csv file using write.csv:
# write.csv(result, file="result.csv")
# ASR, with the percentage of correction due to missing age cases.
result <- csu_asr(csu_registry_data_1,
"age", "cases", "py",
group_by = c("registry", "registry_label" ),
var_age_group = c("registry_label"),
missing_age = 19,
correction_info = TRUE)
# ASR and standard error with missing age.
result <- csu_asr(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_age_group = c("registry_label"),
var_st_err = "st_err",
missing_age = 99)
# Truncated ASR, 25-69 years.
result <- csu_asr(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_age_group = c("registry_label"),
var_st_err = "st_err",
first_age = 6,
last_age = 14,
missing_age = 99)
# Truncated ASR, 0-15 with denominator population = 1000000.
result <- csu_asr(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_age_group = c("registry_label"),
var_st_err = "st_err",
first_age = 1,
last_age = 3,
missing_age = 99,
db_rate = 1000000)
# ASR with EURO population as reference (instead of SEGI)
result <- csu_asr(csu_registry_data_1,
"age", "cases", "py",
group_by = c("registry", "registry_label" ),
var_age_group = c("registry_label"),
missing_age = 19,
pop_base = "EURO")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.