-
Notifications
You must be signed in to change notification settings - Fork 1
/
worms.py
95 lines (83 loc) · 3.42 KB
/
worms.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
92
93
94
95
#!/usr/bin/env python3
from utility import present_value_of_annuity
long_term_income_effects_givewell = {
"Deworming: effect on ln income in MK pop": 0.143,
"Deworming: num yrs between deworming and benefits": 8,
"Deworming: adjustment for el nino": 0.65,
"Deworming: adjustment for yrs of treatment in MK vs programs": 0.90,
"Deworming: replicability adjustment": 0.11,
"Deworming: additional yrs for treatment group in MK": 1.69,
}
def long_term_income_effects(
effect_on_ln_income_in_MK_pop,
discount_rate,
num_yrs_between_deworming_and_benefits,
duration_of_long_term_benefits,
multiplier_for_sharing_win_households,
adjustment_for_el_nino,
adjustment_for_yrs_of_treatment_in_MK_vs_programs,
replicability_adjustment,
additional_yrs_for_treatment_group_in_MK,
):
benefit_on_one_years_income = effect_on_ln_income_in_MK_pop / (
(1 + discount_rate) ** num_yrs_between_deworming_and_benefits
)
present_value_of_lifetime_benefits_from_year_of_deworming = present_value_of_annuity( # TODO: end of period
discount_rate, duration_of_long_term_benefits, benefit_on_one_years_income
)
adjusted_benefits_per_yr_of_deworming_in_ln_consumption = (
present_value_of_lifetime_benefits_from_year_of_deworming
* multiplier_for_sharing_win_households
* adjustment_for_el_nino
* adjustment_for_yrs_of_treatment_in_MK_vs_programs
* replicability_adjustment
/ additional_yrs_for_treatment_group_in_MK
)
return {
"Deworming: adjusted benefits per yr of deworming in ln consumption": adjusted_benefits_per_yr_of_deworming_in_ln_consumption
}
dtw_givewell = {
"DTW: proportion of deworming going to children": 1.00,
"DTW: worm intensity adjustment": 0.12,
"DTW: cost per capita per annum": 0.61,
"DTW: expected value from lev/fun": 0.71,
}
sci_givewell = {
"SCI: proportion of deworming going to children": 0.81,
"SCI: worm intensity adjustment": 0.09,
"SCI: cost per capita per annum": 0.99,
"SCI: expected value from lev/fun": 1.31,
}
sightsavers_givewell = {
"SS: proportion of deworming going to children": 1.00,
"SS: worm intensity adjustment": 0.09,
"SS: cost per capita per annum": 0.95,
"SS: expected value from lev/fun": 0.91,
}
end_givewell = {
"END: proportion of deworming going to children": 0.81,
"END: worm intensity adjustment": 0.07,
"END: cost per capita per annum": 0.81,
"END: expected value from lev/fun": 0.39,
}
def charity_specific(
name,
proportion_of_deworming_going_to_children,
adjusted_benefits_per_yr_of_deworming_in_ln_consumption,
worm_intensity_adjustment,
value_of_increasing_ln_consumption_per_capita_per_annum,
cost_per_capita_per_annum,
expected_value_from_levfun,
):
present_value_of_lifetime_benefits_from_year_of_deworming = (
adjusted_benefits_per_yr_of_deworming_in_ln_consumption
* proportion_of_deworming_going_to_children
* worm_intensity_adjustment
)
value_from_each_year_of_deworming = (
present_value_of_lifetime_benefits_from_year_of_deworming
* value_of_increasing_ln_consumption_per_capita_per_annum
)
value_per_dollar = value_from_each_year_of_deworming / cost_per_capita_per_annum
value_per_dollar_w_levfun = value_per_dollar * (1 + expected_value_from_levfun)
return {name + ": value per dollar w/ lev/fun": value_per_dollar_w_levfun}