csu_eapc {Rcan}R Documentation

csu_eapc

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

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


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

[Package Rcan version 1.3.82 Index]