csu_cumrisk: csu_cumrisk

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/csu_cumrisk.R

Description

csu_cumrisk Calculate cumulative risk across different population (Registry, year, sex...)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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") 

Arguments

df_data

Data (need to be R data.frame format, see example to import csv file).

var_age

Age variable. Several format are accepted

1 "0-4" 0
2 "5-9" 5
3 "10-14" 10
... ... ...
17 "80-84" 80
18 "85+" 85

Missing age value must be precise in the option missing_age.
Last age group will always be considere without size (ie: 80+,85+, etc..).

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.
If not precise, missing age value will not affect the calculation.

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.
default is 15 (calculates cumulative risk 0-74)

var_st_err

Calculate the Standard error and name of the new variable.

correction_info

Logical value. if TRUE compute the variable "correction" : percentage of missing age cases.

var_cumrisk

Name of the new variable for the cumulative risk.

Details

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..)

Value

Return a data.frame.

Author(s)

Mathieu Laversanne

References

https://publications.iarc.fr/_publications/media/download/3753/609d0d7711047dd76d7f3dbaa25d7f041fcd013e.pdf

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)	
		    		  

Rcan documentation built on July 1, 2020, 10:20 p.m.