-
Notifications
You must be signed in to change notification settings - Fork 1
/
stats.py
91 lines (82 loc) · 2.29 KB
/
stats.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'''
Statistics needed for POMDP model
'''
# Sensitivity and specificity statistics for self-diagnosis
SDStats = {
"sens": 0.44,
"spec": 0.92
}
# Sensitivity and specificity statistics for mammography
MStats = {
# Age group 40-49
0: {
"sens": 0.722,
"spec": 0.889
},
# Age group 50-54
1: {
"sens": 0.722,
"spec": 0.893
},
# Age group 55-59
2: {
"sens": 0.81,
"spec": 0.893
},
# Age group 60-69
3: {
"sens": 0.81,
"spec": 0.897
},
# Age group 70+
4: {
"sens": 0.862,
"spec": 0.897
}
}
''' Transition Probabilities
Matrix Structure:
healthy, in-situ, invasive, post-in-situ, post-invasive, death
healthy
in-situ
invasive
post-in-situ
post-invasive
death
Probabilities:
Healthy -> in-situ: same for each (.001)
In-situ -> invasive: same for each (.58)
Invasive -> death: same for each (.1)
Invasive -> invasive: same for each (1 - .1 = .9)
Healthy -> healthy: 1 - the rest in row
In-situ -> in-situ: 1 - the rest in row'''
# -1's in TDPMatrix denote probabilities that are age-specific
TDPMatrix = [
[-1, .001, -1, 0, 0, -1],
[0, -1, .58, 0, 0, -1],
[0, 0, .9, 0, 0, .1],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1]
]
TMatrix = [
[.993, .001, .002, 0, 0, .004],
[0, .416, .58, 0, 0, .004],
[0, 0, .9, 0, 0, .1],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1]
]
# Healthy -> death / In-situ -> death probabilities
# http://www.cdc.gov/nchs/data/nvsr/nvsr65/nvsr65_08.pdf
# data provided for every five years from ages 40 to 100; assume uniform and
# divide by 10 to get probability for each timestep
death_probs_from_lit = [.009868, 0.015637, 0.024290, 0.035348, 0.049706,
0.071703, 0.109255, 0.170906, 0.271119, 0.426073, 0.614941, 0.786733]
death_probs = [dp / 10.0 for dp in death_probs_from_lit]
# Healthy -> invasive probabilities
# https://seer.cancer.gov/csr/1975_2013/results_merged/topic_lifetime_risk.pdf
# data provided for every ten years from ages 40 to 100; assume uniform and
# divide by 20 to get probability for each timestep
healthy_inv_from_lit = [.0147, .0230, .0347, .0395, .030, .030]
healthy_inv_probs = [hip / 20.0 for hip in healthy_inv_from_lit]