csu_cumrisk | R Documentation |
csu_cumrisk
Calculate cumulative risk across different population (Registry, year, sex...)
csu_cumrisk(df_data,
var_age = "age",
var_cases = "cases",
var_py ="py",
group_by=NULL,
missing_age = NULL,
last_age = 15,
var_st_err=NULL,
correction_info=FALSE,
var_cumrisk="cumrisk")
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 ...). | |||||||||||||||||||
missing_age |
Age value representing the missing age cases. | |||||||||||||||||||
last_age |
Last age group included, must be between 2 and 17. 2 represents 5-9, ... 5 represents 20-24, ..., 17 represents 80-84, 18 represents 85+ etc. | |||||||||||||||||||
var_st_err |
Calculate the Standard error and name of the new variable. | |||||||||||||||||||
correction_info |
Logical value. if | |||||||||||||||||||
var_cumrisk |
Name of the new variable for the cumulative risk. |
Calculate cumulative risk across different population
the age group include in cumulative risk will always exclude the last age group since we do not know the size of the last age group (ie: 85+, 80+ etc..)
Return a data.frame
.
Mathieu Laversanne
csu_group_cases
csu_merge_cases_pop
csu_asr
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=",")
# Cumulative risk, 0-74 years, with no missing age cases.
result <- csu_cumrisk(csu_registry_data_1,
"age", "cases", "py",
group_by = c("registry", "registry_label" ))
# you can export your result as csv file using write.csv:
# write.csv(result, file="result.csv")
# Cumulative risk, 0-74 years, with the percentage of correction due to missing age cases.
result <- csu_cumrisk(csu_registry_data_1,
"age", "cases", "py",
group_by = c("registry", "registry_label" ),
missing_age = 19,
correction_info = TRUE)
# Cumulative risk 0-74 years and standard error with missing age.
result <- csu_cumrisk(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_st_err = "st_err",
missing_age = 99)
# Cumulative risk, 0-69 years.
result <- csu_cumrisk(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_st_err = "st_err",
last_age = 14,
missing_age = 99)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.