csu_eapc: csu_eapc

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

View source: R/csu_eapc.R

Description

csu_eapc calculate the Estimated Annual Percentage Change (EAPC) of rates during a time period with the Confidence Interval (CI) across different population (Registry, year, sex...)

Usage

1
2
3
4
5
6
csu_eapc(df_data,
	var_rate="asr",
	var_year="year",
	group_by=NULL,
	var_eapc = "eapc",
	CI_level = 0.95)

Arguments

df_data

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

var_rate

Rate variable. (Standardized or not, incidence, mortality, etc..)

var_year

Period variable. (Year, month, etc...)

group_by

A vector of variables to compare different EAPC (sex, country, cancer ...).

var_eapc

Name of the new variable for the EAPC.
The variable for the CI will be name based on var_eapc + "_" + up/Low.

CI_level

Confidence interval level. Default is 0.95.

Details

This function use Generalized Linear Model (GLM):
glm(rate ~ year, family=poisson(link="log")).
We use the poisson family instead of Gaussian, so we can compute EAPC even if the is a rate of 0.

Value

Return a dataframe.

Author(s)

Mathieu Laversanne

References

http://rht.iconcologia.net/stats/sart/eapc/eapc_method.pdf

See Also

csu_group_cases csu_merge_cases_pop csu_asr csu_cumrisk 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
data(csu_registry_data_2)

# you import your data from csv file using read.csv:
# mydata <-  read.csv("mydata.csv", sep=",")

# Estimated Annual Percentage Change (EAPC) base on ASR.


df_asr <- 
	csu_asr(csu_registry_data_2, 
	  "age", "cases", "py",
	  group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
	  var_age_group = c("registry_label"), 
	  missing_age = 99
	  )
				  
result <- 
	csu_eapc(df_asr,
		"asr", "year",
		group_by=c("registry", "registry_label", "sex", "ethnic" )
		)

					
# you can export your result as csv file using write.csv:
# write.csv(result, file="result.csv")
				  		  

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