Calculating lifetime cancer risk in a population

By: Karl Pettersson

Re-posted from: https://www.dusty-test.klpn.se/posts/2016-11-06-secanc.html

Calculating lifetime cancer risk in a population

Posted on 2016-11-06

by Karl Pettersson.

Tags: ,

It is common to hear statements such as one in three persons will
develop cancer during their lifetime
, one in nine women will develop
breast cancer
and so on. Most often, such statements are based on a
simple calculation of cumulative risk, i.e. age-specific incidence rates
for a given year and cancer diagnosis are summed up to a chosen maximum
age, e.g. 75 years, and the resulting cumulative incidence rate \(r\) is
then converted into a probability using the formula \(1-\exp(-r)\).
However, if lifetime cancer risk is interpreted as the proportion of
the population which will be diagnosed with cancer during their
lifetime, this method gives incorrect results, because it does not take
the following into account:

  1. Future changes in cancer rates.
  2. People who die before they reach the maximum age, due to causes
    unrelated to cancer.
  3. People who develop cancer at ages above the maximum age.
  4. People who are diagnosed with multiple primary cancers during their
    lifetime.

The first problem will not be further discussed in this post, as dealing
with it obviously would require projections into the future. The other
problems can be assessed with a method described by Sasieni et al. (2011), which
they call AMP (adjusted for multiple primaries), and which only
requires routinely available data. Their idea is to build a life table
where it is possible to be eliminated from the population either by
being diagnosed with cancer or by dying from something other than
cancer. It is then possible to calculate the proportions eliminated in
these different ways. The AMP method hinges on the independence
assumption that primary cancer incidence and mortality from causes other
than cancer are the same among people who have had cancer as in the
general population, because these groups cannot normally be
differentiated in official statistics. Only the following data are
required:

  1. Age-specific population size, in order to calculate incidence and
    mortality rates.
  2. Age-specific number of cancer cases.
  3. Age-specific number of deaths due to all causes.
  4. Age-specific number of deaths due cancer. Note that official
    statistics normally reports so-called underlying causes of deaths,
    which means that this should include complications of cancer and
    cancer treatment (otherwise, the independence assumption given above
    would be violated).

Using my LifeTable package, the
AMP method can be easily implemented in Julia. I will give examples with
calculations for Sweden 2014, using data from Statistics Sweden (2016) for
population size, National Board of Health and Welfare (2015) for cancer cases and National Board of Health and Welfare (2025) for deaths.
The data are given in 5-year age intervals from 0–4 to 80–84 years,
with an open interval for ages above 85 years. The files used in the
example are available via a
gist.
The Julia
file

contains the following code:

using LifeTable, DataFrames

function AmpLt(inframe, sex, rate = "inc")
    age = inframe[1]
    pop = inframe[2]
    acd = inframe[3]
    cd = inframe[4]
    cc = inframe[5]
    if rate == "inc"
        ncol = cc
        dcol = acd .- cd .+ cc
    elseif rate == "mort"
        ncol = cd
        dcol = acd
    end
    df = DataFrame(age = age, pop = pop, dcol = dcol)
    cprop = ncol ./ dcol 
    lt = PeriodLifeTable(df, sex)
    return CauseLife(lt, cprop)
end

Assuming the LifeTable package is installed and the files have been
downloaded, you can calculate tables with lifetime cancer risk for
Swedish females and males, at a given age:

include("amplt.jl")
fse14 = readtable("fse14.csv")
mse14 = readtable("mse14.csv")
ampfse14 = AmpLt(fse14, 2)
ampmse14 = AmpLt(mse14, 1)

The first row in the f column in a frame returned by AmpLt gives the
lifetime cancer risk at birth, which should be about 45.7 percent for
females and 49.3 percent for males. It is also possible to calculate
lifetime risk for cancer mortality, rather than incidence:

mampfse14 = AmpLt(fse14, 2, "mort")
mampmse14 = AmpLt(mse14, 1, "mort")

The first row in these frames should be about 22.3 and 26.2 percent for
females and males. With PyPlot, the frames can be plotted:

plot(ampfse14[:age], ampfse14[:f], label = "incidence, females")
plot(ampfse14[:age], ampmse14[:f], label = "incidence, males")
plot(ampfse14[:age], mampfse14[:f], label = "mortality, females")
plot(ampfse14[:age], mampmse14[:f], label = "mortality, males")
title("Lifetime cancer risk Sweden 2014")
xlim(0, 85)
ylim(0, 0.5)
legend(loc=3)
grid(1)
Lifetime probabilty of cancer incidence and mortality for Swedish females and males 2014

As the chart shows, the probabilities tend to decrease with age,
especially after age 60, which is due to increasing competition from
other causes of death, e.g. circulatory disorders.

If cancer incidence and mortality are changed, this might also influence
mortality from some non-cancer causes. For example, decreased smoking
tends to decrease lung cancer incidence and mortality, as well as
mortality from nonmalignant respiratory diseases and atherosclerotic
diseases.1 One might ask how such risk factor changes would influence
lifetime cancer risk, which might be decreased, as well as unchanged, or
even increased, due to diminished competition. The following function
recalculate a frame with cancer cases, as well as cancer deaths and
non-cancer deaths, changed by the same factor for all age groups:

function RateChange(inframe, changefac)
    ncd = inframe[4] .* changefac
    ncc = inframe[5] .* changefac
    nacd = (inframe[3].-inframe[4]).*changefac .+ ncd
    return DataFrame(age = inframe[1], pop = inframe[2],
        acd = nacd, cd = ncd, cc = ncc)
end

To calculate lifetime cancer risk for Swedish females with all three
rates reduced by one third, give AmpLt(RateChange(fse14, 2/3), 2). The
frame returned by this call gives a lifetime risk at birth of 37.5
percent. For males, the corresponding risk is 42.6 percent. For
mortality, the risks would be 19.2 and 24.0 percent for females and
males respectively. If age-specific cancer incidence and mortality and
non-cancer mortality are reduced by the same factor, in a society such
as Sweden, which already has high life expectancy, this tends to reduce
the lifetime risk of getting cancer or dying from it, because more
people will survive to higher ages where the probability of getting
cancer before succumbing to something else is lower (with greater
reductions, the risks at lower ages asymptotically approach the
corresponding risks at the highest age, i.e. 85 years in this example).

References

National Board of Health and Welfare. 2015. “Cancer.” http://www.socialstyrelsen.se/statistics/statisticaldatabase/cancer.
———. 2025. “Cause of death.” https://sdb.socialstyrelsen.se/if_dor/val_eng.aspx.
Sasieni, P. D., J. Shelton, N. Ormiston-Smith, C. S. Thomson and P. B. Silcocks. 2011. “What is the lifetime risk of developing cancer?: The effect of adjusting for multiple primaries.” British Journal of Cancer 105. doi:10.1038/bjc.2011.250.
Statistics Sweden. 2016. “Mean population by region, marital status, age and sex.” http://www.statistikdatabasen.scb.se/goto/en/ssd/MedelfolkHandelse.

  1. This shared risk factor can be expected to violate the
    independence assumption in the AMP method to some extent. However,
    as noted by Sasieni et al. (2011), these effects should not be serious when all
    cancers are studied, because there are few lung cancer survivors in
    the population.↩︎

Calculating lifetime cancer risk in a population

By: Karl Pettersson

Re-posted from: http://static-dust.klpn.se/posts/2016-11-06-secanc.html

Calculating lifetime cancer risk in a population

Posted on 2016-11-06

by Karl Pettersson.

Tags: epidemiology, julia

It is common to hear statements such as one in three persons will develop cancer during their lifetime, one in nine women will develop breast cancer and so on. Most often, such statements are based on a simple calculation of cumulative risk, i.e. age-specific incidence rates for a given year and cancer diagnosis are summed up to a chosen maximum age, e.g. 75 years, and the resulting cumulative incidence rate \(r\) is then converted into a probability using the formula \(1-\exp(-r)\). However, if lifetime cancer risk is interpreted as the proportion of the population which will be diagnosed with cancer during their lifetime, this method gives incorrect results, because it does not take the following into account:

  1. Future changes in cancer rates.
  2. People who die before they reach the maximum age, due to causes unrelated to cancer.
  3. People who develop cancer at ages above the maximum age.
  4. People who are diagnosed with multiple primary cancers during their lifetime.

The first problem will not be further discussed in this post, as dealing with it obviously would require projections into the future. The other problems can be assessed with a method described by Sasieni et al. (2011), which they call AMP (adjusted for multiple primaries), and which only requires routinely available data. Their idea is to build a life table where it is possible to be eliminated from the population either by being diagnosed with cancer or by dying from something other than cancer. It is then possible to calculate the proportions eliminated in these different ways. The AMP method hinges on the independence assumption that primary cancer incidence and mortality from causes other than cancer are the same among people who have had cancer as in the general population, because these groups cannot normally be differentiated in official statistics. Only the following data are required:

  1. Age-specific population size, in order to calculate incidence and mortality rates.
  2. Age-specific number of cancer cases.
  3. Age-specific number of deaths due to all causes.
  4. Age-specific number of deaths due cancer. Note that official statistics normally reports so-called underlying causes of deaths, which means that this should include complications of cancer and cancer treatment (otherwise, the independence assumption given above would be violated).

Using my LifeTable package, the AMP method can be easily implemented in Julia. I will give examples with calculations for Sweden 2014, using data from Statistics Sweden (2016) for population size, National Board of Health and Welfare (2015) for cancer cases and National Board of Health and Welfare (2016) for deaths. The data are given in 5-year age intervals from 0–4 to 80–84 years, with an open interval for ages above 85 years. The files used in the example are available via a gist. The Julia file contains the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using LifeTable, DataFrames

function AmpLt(inframe, sex, rate = "inc")
	age = inframe[1]
	pop = inframe[2]
	acd = inframe[3]
	cd = inframe[4]
	cc = inframe[5]
	if rate == "inc"
		ncol = cc
		dcol = acd .- cd .+ cc
	elseif rate == "mort"
		ncol = cd
		dcol = acd
	end
	df = DataFrame(age = age, pop = pop, dcol = dcol)
	cprop = ncol ./ dcol 
	lt = PeriodLifeTable(df, sex)
	return CauseLife(lt, cprop)
end

Assuming the LifeTable package is installed and the files have been downloaded, you can calculate tables with lifetime cancer risk for Swedish females and males, at a given age:

1
2
3
4
5
include("amplt.jl")
fse14 = readtable("fse14.csv")
mse14 = readtable("mse14.csv")
ampfse14 = AmpLt(fse14, 2)
ampmse14 = AmpLt(mse14, 1)

The first row in the f column in a frame returned by AmpLt gives the lifetime cancer risk at birth, which should be about 45.7 percent for females and 49.3 percent for males. It is also possible to calculate lifetime risk for cancer mortality, rather than incidence:

1
2
mampfse14 = AmpLt(fse14, 2, "mort")
mampmse14 = AmpLt(mse14, 1, "mort")

The first row in these frames should be about 22.3 and 26.2 percent for females and males. With PyPlot, the frames can be plotted:

1
2
3
4
5
6
7
8
9
plot(ampfse14[:age], ampfse14[:f], label = "incidence, females")
plot(ampfse14[:age], ampmse14[:f], label = "incidence, males")
plot(ampfse14[:age], mampfse14[:f], label = "mortality, females")
plot(ampfse14[:age], mampmse14[:f], label = "mortality, males")
title("Lifetime cancer risk Sweden 2014")
xlim(0, 85)
ylim(0, 0.5)
legend(loc=3)
grid(1)
Lifetime probabilty of cancer incidence and mortality for Swedish females and males 2014

Lifetime probabilty of cancer incidence and mortality for Swedish females and males 2014

As the chart shows, the probabilities tend to decrease with age, especially after age 60, which is due to increasing competition from other causes of death, e.g. circulatory disorders.

If cancer incidence and mortality are changed, this might also influence mortality from some non-cancer causes. For example, decreased smoking tends to decrease lung cancer incidence and mortality, as well as mortality from nonmalignant respiratory diseases and atherosclerotic diseases.1 One might ask how such risk factor changes would influence lifetime cancer risk, which might be decreased, as well as unchanged, or even increased, due to diminished competition. The following function recalculate a frame with cancer cases, as well as cancer deaths and non-cancer deaths, changed by the same factor for all age groups:

1
2
3
4
5
6
7
function RateChange(inframe, changefac)
	ncd = inframe[4] .* changefac
	ncc = inframe[5] .* changefac
	nacd = (inframe[3].-inframe[4]).*changefac .+ ncd
	return DataFrame(age = inframe[1], pop = inframe[2],
		acd = nacd, cd = ncd, cc = ncc)
end

To calculate lifetime cancer risk for Swedish females with all three rates reduced by one third, give AmpLt(RateChange(fse14, 2/3), 2). The frame returned by this call gives a lifetime risk at birth of 37.5 percent. For males, the corresponding risk is 42.6 percent. For mortality, the risks would be 19.2 and 24.0 percent for females and males respectively. If age-specific cancer incidence and mortality and non-cancer mortality are reduced by the same factor, in a society such as Sweden, which already has high life expectancy, this tends to reduce the lifetime risk of getting cancer or dying from it, because more people will survive to higher ages where the probability of getting cancer before succumbing to something else is lower (with greater reductions, the risks at lower ages asymptotically approach the corresponding risks at the highest age, i.e. 85 years in this example).

References

National Board of Health and Welfare. 2015. “Cancer.” http://www.socialstyrelsen.se/statistics/statisticaldatabase/cancer.

Sasieni, P.D., J. Shelton, N. Ormiston-Smith, C.S. Thomson and P.B. Silcocks. 2011. “What is the lifetime risk of developing cancer?: The effect of adjusting for multiple primaries.” British Journal of Cancer 105. doi:10.1038/bjc.2011.250.

Statistics Sweden. 2016. “Mean population by region, marital status, age and sex.” http://www.statistikdatabasen.scb.se/goto/en/ssd/MedelfolkHandelse.


  1. This shared risk factor can be expected to violate the independence assumption in the AMP method to some extent. However, as noted by Sasieni et al. (2011), these effects should not be serious when all cancers are studied, because there are few lung cancer survivors in the population.

Julia Day in New York

Julia Computing invites you to the first Julia Day in New York on November 30th, 2016. This event will introduce you to Julia, the easy-to-learn high-performance mathematical programming language that is taking the finance industry by storm.

Julia Day takes place on Wednesday, November 30th from 3.30 PM to 6.30 PM at Fitch Learning Center, 3rd Floor, 55 Broad St, New York, NY 10004. This will be followed by drinks, dinner and networking.

Come find out how quants, traders and data scientists from hedge funds, investment banks, and across financial services industry worldwide are using Julia to gain a mathematical computing advantage over their competitors by processing more data up to 1,000x faster than before. Also learn why Nobel Laureate Thomas J. Sargent calls Julia a ‘great tool’ for building high-dimensional macroeconomic models.

There will be product demos, benchmarks, customer stories and use cases in Finance and Insurance, especially around trading, risk analytics and asset management among others.

Please register below to attend. We look forward to seeing you in New York.

##Tentative Schedule

Topic Time
Julia Computing – Company overview and vision 3:30 PM
Customer Speak – Insurance 3:45 PM
Julia Computing – Overview of Products 4:00 PM
Customer Speak – Hedge Fund 4:15 PM
Julia in Finance 4:30 PM
Customer Speak – Fintech 5:00 PM
JuliaBox – Scale Julia on the Cloud 5:15 PM
Customer Speak – Asset Management 5:30 PM
Getting started with JuliaPro 5:45 PM
Customer Speak 6:00 PM
Wrap up and concluding remarks 6:15 PM
Drinks, dinner and networking 6:30 PM

About Julia

Julia is the simplest, fastest and most powerful numerical computing language available today. Julia combines the functionality of quantitative environments such as Python, R, MATLAB, SAS, SPSS and Stata, with the speed of production programming languages like Java and C++ to solve big data and analytics problems. Julia delivers dramatic improvements in simplicity, speed, capacity, and productivity for data scientists, algorithmic traders, quants, scientists, and engineers who need to solve massive computational problems quickly and accurately.

Julia offers an unbeatable combination of simplicity and productivity with speed that is thousands of times faster than other mathematical, scientific and statistical computing languages.

Partners and users include: Intel, The Federal Reserve Bank of New York, Lincoln Laboratory (MIT), The Moore Foundation and a number of private sector finance and industry leaders, including several of the world’s leading hedge funds, investment banks, asset managers and insurers.

Julia was co-created by Prof. Alan Edelman (MIT), Dr. Viral Shah (UCSB), Dr. Jeff Bezanson (MIT, Harvard) and Stefan Karpinski (Harvard).

##About Julia Computing

Julia Computing was founded in 2013 to develop products around Julia such as Julia for Finance, which enables financial service companies to leverage the 1,000x improvement in speed and productivity that Julia provides for trading, risk analytics, asset management, macroeconomic modeling and other areas. Products of Julia Computing make Julia easy to develop, easy to deploy and easy to scale. The co-founders of Julia Computing include the four co-authors of the Julia computing language plus Deepak Vinchhi (IIT-Mumbai) and Keno Fischer (Harvard).