create_asr()
calculates age-standardized rates (ASRs) using
PBCR data. It supports stratification by multiple variables, allows the
specification of different standard population structures, and provides
flexibility in the inclusion of variance, confidence intervals, and
population data.
create_asr(
x,
...,
event = "fbs",
std = c("cn2000", "wld85"),
cancer_type = "big",
mp = 1e+05,
decimal = 2,
show_var = FALSE,
show_ci = FALSE,
collapse = TRUE
)
# S3 method for class 'canregs'
create_asr(x, ..., cancer_type = "big", collapse = TRUE)
# S3 method for class 'canreg'
create_asr(x, ..., cancer_type = "big")
# S3 method for class 'fbswicds'
create_asr(
x,
...,
event = "fbs",
std = c("cn2000", "wld85"),
mp = 1e+05,
decimal = 2,
show_pop = FALSE,
show_var = FALSE,
show_ci = FALSE,
collapse = TRUE
)
# S3 method for class 'fbswicd'
create_asr(
x,
...,
event = "fbs",
std = c("cn2000", "wld85"),
mp = 1e+05,
decimal = 2,
show_pop = FALSE,
show_var = FALSE,
show_ci = FALSE
)
The input data, object with class of 'fbswicd'
, 'fbswicds'
,
'canreg'
, or 'canregs'
.
One or more variables used for stratification. For example, you
can stratify by sex
, year
, cancer
, or just by year
. If sex
is not passed as a parameter, the output will be the result for the
combined gender.
A variable used to specify the type of calculation, options are fbs or sws, fbs for cancer incidence, and sws for cancer mortality.
Specify the standard population structure in the 'std_pop' data frame used for calculating standardized rates. When calculating standardized rates for multiple standard populations, specify std = c(segi, china).
A character string specifying the classification method
used to categorize ICD-10 codes. This determines how ICD-10 codes are
classified. Options include "big"
(classify ICD-10 codes into 26
cancer categories), "small"
(classify ICD-10 codes into 59 cancer
categories, more specific categories), "system"
(classify ICD-10
codes into organ system), and "gco"
(classify ICD-10 code into
cancer categories same as classification published by the Global
Cancer Observatory). This parameter is only available when the
input data is a vector of ICD-10 codes, or object with class of
'canreg'
or 'canregs'
.
A constant to multiply rates by (e.g. mp=1000 for rates per 1000).
This parameter specifies the number of decimal places to round the results. The default is 2, which means rates will be rounded to two decimal places.
Logical value whether output variance or not.
Logical value whether output confidence(lower or upper bound) or not.
Logical value whether output result as asr or asrs.
Logical value whether output population or not.
A data frame or tibble contains the age standard rates and CIs.
# calculate ASR based on object with class of `canreg`
data("canregs")
data <- canregs[[1]]
# calculate ASR using default parameter
asr <- create_asr(data, year, sex, cancer)
head(asr)
#> # A tibble: 6 × 12
#> year sex cancer no_cases cr asr_cn2000 asr_wld85 truncr_cn2000
#> <int> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2021 0 101 27 3.95 3.23 3.32 6.88
#> 2 2021 0 102 7 1.02 0.78 0.83 1.58
#> 3 2021 0 103 65 9.52 6.88 6.65 7.61
#> 4 2021 0 104 101 14.8 11.2 11.2 16.1
#> 5 2021 0 105 180 26.4 19.8 19.9 26.5
#> 6 2021 0 106 127 18.6 14.4 14.6 23.7
#> # ℹ 4 more variables: truncr_wld85 <dbl>, cumur <dbl>, prop <dbl>, rank <int>
# calculate ASR using multiple standard population
asr_multi_std <- create_asr(data, year, sex, cancer,
std = c("cn82", "cn2000", "wld85"))
head(asr_multi_std)
#> # A tibble: 6 × 14
#> year sex cancer no_cases cr asr_cn82 asr_cn2000 asr_wld85 truncr_cn82
#> <int> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2021 0 101 27 3.95 2.4 3.23 3.32 7.39
#> 2 2021 0 102 7 1.02 0.58 0.78 0.83 1.76
#> 3 2021 0 103 65 9.52 4.82 6.88 6.65 8.25
#> 4 2021 0 104 101 14.8 7.83 11.2 11.2 17.4
#> 5 2021 0 105 180 26.4 13.8 19.8 19.9 28.7
#> 6 2021 0 106 127 18.6 10.6 14.4 14.6 25.4
#> # ℹ 5 more variables: truncr_cn2000 <dbl>, truncr_wld85 <dbl>, cumur <dbl>,
#> # prop <dbl>, rank <int>
# calculate ASR with confidence interval
asr_with_ci <- create_asr(data, year, sex, cancer, show_ci = TRUE)
head(asr_with_ci)
#> # A tibble: 6 × 18
#> year sex cancer no_cases cr cr_lower cr_upper asr_cn2000
#> <int> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2021 0 101 27 3.95 2.6 5.75 3.23
#> 2 2021 0 102 7 1.02 0.41 2.11 0.78
#> 3 2021 0 103 65 9.52 7.34 12.1 6.88
#> 4 2021 0 104 101 14.8 12.0 18.0 11.2
#> 5 2021 0 105 180 26.4 22.6 30.5 19.8
#> 6 2021 0 106 127 18.6 15.5 22.1 14.4
#> # ℹ 10 more variables: asr_lower_cn2000 <dbl>, asr_upper_cn2000 <dbl>,
#> # asr_wld85 <dbl>, asr_lower_wld85 <dbl>, asr_upper_wld85 <dbl>,
#> # truncr_cn2000 <dbl>, truncr_wld85 <dbl>, cumur <dbl>, prop <dbl>,
#> # rank <int>
# calculate ASR with population at risk
asr_with_pop <- create_asr(data, year, sex, cancer, show_pop = TRUE)
head((asr_with_pop))
#> # A tibble: 6 × 13
#> year sex cancer pop no_cases cr asr_cn2000 asr_wld85 truncr_cn2000
#> <int> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2021 0 101 683110 27 3.95 3.23 3.32 6.88
#> 2 2021 0 102 683110 7 1.02 0.78 0.83 1.58
#> 3 2021 0 103 683110 65 9.52 6.88 6.65 7.61
#> 4 2021 0 104 683110 101 14.8 11.2 11.2 16.1
#> 5 2021 0 105 683110 180 26.4 19.8 19.9 26.5
#> 6 2021 0 106 683110 127 18.6 14.4 14.6 23.7
#> # ℹ 4 more variables: truncr_wld85 <dbl>, cumur <dbl>, prop <dbl>, rank <int>
# calculate ASR with variance
asr_with_var <- create_asr(data, year, sex, cancer, show_var = TRUE)
head(asr_with_var)
#> # A tibble: 6 × 15
#> year sex cancer no_cases cr cr_var asr_cn2000 asr_var_cn2000 asr_wld85
#> <int> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2021 0 101 27 3.95 5.79e-11 3.23 3.91e-11 3.32
#> 2 2021 0 102 7 1.02 1.50e-11 0.78 8.73e-12 0.83
#> 3 2021 0 103 65 9.52 1.39e-10 6.88 7.42e-11 6.65
#> 4 2021 0 104 101 14.8 2.16e-10 11.2 1.25e-10 11.2
#> 5 2021 0 105 180 26.4 3.86e-10 19.8 2.21e-10 19.9
#> 6 2021 0 106 127 18.6 2.72e-10 14.4 1.66e-10 14.6
#> # ℹ 6 more variables: asr_var_wld85 <dbl>, truncr_cn2000 <dbl>,
#> # truncr_wld85 <dbl>, cumur <dbl>, prop <dbl>, rank <int>
# calculate ASR based on object with class of `fbswicd`
# convert object with class of `canreg` to object with class of `fbswicd`
fbsw <- count_canreg(data)
asr <- create_asr(fbsw, event= "sws", year, sex, cancer)