-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.js
69 lines (66 loc) · 1.47 KB
/
model.js
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
export const initialState = {
numPeople: {
value: 100,
min: 0,
max: 10000,
displayName: "Number of people"
},
years: { value: 5, min: 0, max: 100, displayName: "Number of years" },
qualityImprovement: {
value: 0.1,
min: 0,
max: 1,
displayName: "Average quality of life improvement over that time"
},
cost: { value: 10, min: 1, max: 100, displayName: "Cost (1000 USD)" },
chanceOfSuccess: {
value: 0.1,
min: 0,
max: 1,
displayName: "Chance of Success"
},
chanceOfHarm: {
value: 0.01,
min: 0,
max: 1,
displayName: "Chance of accidental harm"
},
numPeopleHarmed: {
value: 10,
min: 0,
max: 10000,
displayName: "Number of people possibly harmed"
},
yearsOfHarm: {
value: 5,
min: 0,
max: 100,
displayName: "Number of years of possible harm"
},
qualityDecrease: {
value: 0.05,
min: 0,
max: 1,
displayName: "Quality of life decrease over that time"
}
};
export function calc({
numPeople,
years,
qualityImprovement,
cost,
chanceOfSuccess,
chanceOfHarm,
numPeopleHarmed,
yearsOfHarm,
qualityDecrease
}) {
const QALY =
((numPeople * years * qualityImprovement) / cost) * chanceOfSuccess -
(chanceOfHarm * numPeopleHarmed * yearsOfHarm * qualityDecrease) / cost;
return QALY;
}
window.calc = calc;
export const modelName = "Super simple model";
export const ModelResult = ({ result }) =>
`Expected Value: ${result} QALYs / 1000 USD`;