Last active
November 6, 2016 13:34
-
-
Save klpn/3ab1feff67d6e938fecc61c8307ce394 to your computer and use it in GitHub Desktop.
Calculate lifetime cancer risk in Sweden (using data from Statstics Sweden and National Board of Health and Welfare), built on the method defined by Sasieni et. al, (doi:10.1038/bjc.2011.250).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
age | pop | acd | cd | cc | |
---|---|---|---|---|---|
0 | 284203.5 | 125 | 5 | 64 | |
5 | 282010.5 | 24 | 9 | 26 | |
10 | 259758 | 15 | 2 | 41 | |
15 | 252815.5 | 46 | 5 | 52 | |
20 | 322598 | 77 | 11 | 125 | |
25 | 326973.5 | 87 | 21 | 243 | |
30 | 299041.5 | 114 | 36 | 392 | |
35 | 297083 | 114 | 41 | 657 | |
40 | 320812.5 | 233 | 118 | 1055 | |
45 | 327841.5 | 401 | 185 | 1637 | |
50 | 312030.5 | 613 | 329 | 1767 | |
55 | 287827.5 | 941 | 536 | 2340 | |
60 | 280823.5 | 1506 | 830 | 3179 | |
65 | 300502.5 | 2688 | 1376 | 4682 | |
70 | 252674 | 3328 | 1550 | 4572 | |
75 | 181861.5 | 4332 | 1601 | 3442 | |
80 | 139668.5 | 6829 | 1729 | 3084 | |
85 | 169057.5 | 24149 | 2759 | 3612 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
age | pop | acd | cd | cc | |
---|---|---|---|---|---|
0 | 300984 | 177 | 12 | 75 | |
5 | 298355.5 | 17 | 6 | 41 | |
10 | 274276.5 | 22 | 9 | 33 | |
15 | 272038.5 | 85 | 11 | 64 | |
20 | 341390.5 | 224 | 17 | 150 | |
25 | 342110.5 | 226 | 13 | 185 | |
30 | 315183 | 262 | 27 | 226 | |
35 | 309386 | 229 | 45 | 312 | |
40 | 330216.5 | 363 | 79 | 435 | |
45 | 338742 | 614 | 147 | 682 | |
50 | 321224 | 900 | 269 | 1302 | |
55 | 291923.5 | 1382 | 495 | 2216 | |
60 | 279481 | 2299 | 874 | 3997 | |
65 | 293532 | 3963 | 1573 | 6401 | |
70 | 242539 | 4826 | 1917 | 5976 | |
75 | 158417.5 | 5782 | 2040 | 4800 | |
80 | 103383 | 7238 | 2058 | 3545 | |
85 | 88420 | 14831 | 2602 | 3145 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment