Public
Edited
May 8, 2023
Insert cell
Insert cell
import {cea_functions,cell,stylesheet} from "@falk-lieder/cea_library"
Insert cell
stylesheet
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof scalability = cell(`

//The target group of the new intervention is emerging adults.
//We assume that this corresponds to people of ages 15 to 35. We estimate that this
//demographic constitutes between 50% and 70% of all active internet users.
//source: https://www.statista.com/statistics/272365/age-distribution-of-internet-users-worldwide/
proportion_internet_users_between_15_and_35 = 0.5 to 0.7

// What is the maximal amount of money that the intervention could absorb?
scalability_in_usd = scalability_of_online_interventions(proportion_internet_users_between_15_and_35)


`, [cea_functions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
import {ce_of_previous_interventions,cost_effectiveness_of_intervention_bs} from "@falk-lieder/cea-baumsteiger"
Insert cell
viewof benefit_of_research = cell(`

// total amount of money that will be invested into the cause area of promoting well-being according to EA principles
budget = 10M to 1B

cost_of_RCT = 330000

// How much money would be invested into the new intervention if were is superior?
usd_deployable_to_new_intervention = investment_in_new_intervention(scalability_in_usd,budget,cost_of_research+cost_of_RCT)

// What would be the research's net effect on the total well-being of humanity?
net_effect_of_research_Baumsteiger = net_effect_of_research(ce_new_bs_hh,ce_best_preexisting_intervention_hh,usd_deployable_to_new_intervention,cost_of_research+cost_of_RCT)

net_effect_in_WELLBYs = hours_of_happiness_to_WELLBYs(net_effect_of_research_Baumsteiger)

`,[cost_effectiveness_of_intervention_bs,cea_functions,ce_of_previous_interventions,scalability,cost_of_research],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
Insert cell
viewof cost_of_research = cell(`

person_years = 0.5 to 0.7
personnel_costs = person_years*postdoc_salary_costs_per_year()

nr_participants_experiment = 116
cost_per_participant_experiment = 0 //20
nr_participants_pilot = 63
cost_per_participant_pilot = 0// 5

research_expenses = nr_participants_experiment * cost_per_participant_experiment + nr_participants_pilot*cost_per_participant_pilot

cost_of_research = personnel_costs + research_expenses


`,cea_functions,{distributionChartSettings: {showSummary: true, tickFormat: "$,f"}})
Insert cell
Insert cell
viewof cost_effectiveness_of_research = cell(`

//How cost-effective would it be to conduct this research?
ce_R_and_D_in_WELLBYs_per_dollar = cost_effectiveness(net_effect_in_WELLBYs,cost_of_research)


cost_effectiveness_of_research_hh = cost_effectiveness(net_effect_of_research_Baumsteiger,cost_of_research)

`, [benefit_of_research,cost_of_research,cea_functions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof beneft_per_time = cell(`

workweeks_per_year = 48 to 50
hours_per_week = 30 to 60
time_worked_on_project = person_years * workweeks_per_year * hours_per_week

value_per_hour = cost_effectiveness(net_effect_of_research_Baumsteiger,time_worked_on_project)

welby_per_hour = hours_of_happiness_to_WELLBYs(value_per_hour)
`, [benefit_of_research, cost_of_research, cea_functions,scalability],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof ce_ratio = cell(`

//How does the cost-effectiveness of this research compare to the cost-effectiveness of the best existing intervention?
cost_effectiveness_ratio = cost_effectiveness_of_research_hh / ce_best_preexisting_intervention_hh

`, [cost_effectiveness_of_research,benefit_of_research,ce_of_previous_interventions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof limited_uptake = cell(`

p_uptake = [.1,.2,.3,.4,.5,.6,.7,.8,.9,1]

net_benefit_full_uptake = 460M
ce_ratio_full_uptake = 135

rel_ce_by_uptake(p) = net_effect_of_research_with_limited_uptake(p,ce_new_bs_hh,ce_best_preexisting_intervention_hh,usd_deployable_to_new_intervention,cost_of_research+cost_of_RCT)/net_benefit_full_uptake*ce_ratio_full_uptake

map(p_uptake,rel_ce_by_uptake)

`, [cost_effectiveness_of_intervention_bs, cea_functions,ce_of_previous_interventions,scalability,cost_of_research,benefit_of_research],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof effect_sizes = cell(`

//Effect size for the Incredible Years program reviewed by Menting et al.
effect_menting = 0.23
se_menting = (0.31-0.15)/(2*1.96)

//Effect sizes from Figure 21.3 in Mesurado et al., the study by Hare was excluded because the average age was < 10
effects_mesurado = [0.058, 0.039, 0.115, 0.375, -0.03, 0.679, 0.398, 0.317, 0.549]
se_mesurado = [0.278, 0.287, 0.117, 0.224, 0.100, 0.152, 0.084, 0.072, 0.313]

effects_laguna_and_shin_lee = [-0.0782, -0.3082, 0.2665, 0.2367, 0.1455, -0.0175, 0.6079, 0.3491, 4.3942, 0.7730, -0.2410, 0.1223, 0.0461, 0.2987, 0.0598, 0.0231, -0.0492, 1.2782, 1.6518, 0.2168, 0.5576]
se_laguna_and_shin_lee = [0.0509, 0.0583, 0.0922, 0.0940, 0.1212, 0.1236, 0.0665, 0.0251, 0.1284, 0.3535, 0.2814, 0.0993, 0.1018, 0.0538, 0.0601, 0.0586, 0.0665, 0.1817, 0.1970, 0.0882, 0.0888]

effects = List.concat(List.concat(effects_mesurado,effects_laguna_and_shin_lee),[effect_menting])
//[effect_menting, 0.058, 0.039, 0.115, 0.375, -0.03, -0.069, 0.679, 0.398, 0.317, 0.549]
se = List.concat(List.concat(se_mesurado,se_laguna_and_shin_lee),[se_menting]) //= [se_menting, 0.278, 0.287, 0.117, 0.224, 0.100, 0.107, 0.152, 0.084, 0.072, 0.313]

SampleSet.fromList(effects)

`, cea_functions,{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof predicted_effect_size = cell(`


//1. Calculate the optimal standard deviation h of the Gaussian kernel
weights = map(se, {|se| se^-2})
normalized_weights = map(weights,{|w| w/sum(weights)})
// based on calculations in Matlab (calculations_for_kernel_density_estimation.m)
sigma_hat = 0.1573
iqr = 0.3485
n_interventions = 11
// calculate the optimal standard deviation of the Gaussian kernel according to Silverman's rule of thumb
h = 0.9*min([sigma_hat,iqr/1.34])*pow(n_interventions,-1/5)

//2. Create the kernels and combine the kernels into the estimate of p(g)
kernels = map(effects,{|g_hat| normal(g_hat,h)})
p_g_hat = mx(kernels,normalized_weights)

p_g_hat

`,[cea_functions,effect_sizes],{distributionChartSettings: {showSummary: true, title: "Effect Size on Prosocial Behavior", tickFormat:"," }})
Insert cell
Insert cell
Insert cell
half_lifeMeta = FileAttachment("half_life@3.meta.json").json()
Insert cell
viewof predicted_duration_of_benefits = cell(`

//predicted half-life of the intervention's effect on prosocial behavior in days
half_life = SampleSet.fromList($half_life_meta)


`, undefined,{jsImports: {half_life_meta: half_lifeMeta},
distributionChartSettings: {showSummary: true, title: "Number of days until the effect of the intervention drops to 50%"}}
)
Insert cell
Insert cell
viewof predicted_effect_on_wellbeing = cell(`

effect_on_happiness(p_g) = {

initial_increase_in_freq_of_prosocial_behavior_per_day = p_g *
std_freq_of_prosocial_behavior_in_acts_per_day()

additional_prosocial_acts_in_the_first_month =
initial_increase_in_freq_of_prosocial_behavior_per_day*days_per_month()
half_life_in_months = half_life/days_per_month()

increase_in_nr_acts_of_kindness_per_person =
sum_over_time(additional_prosocial_acts_in_the_first_month,half_life_in_months)

increase_in_nr_acts_of_kindness_per_person * benefit_of_one_kind_act()

}

increase_in_happiness = effect_on_happiness(p_g_hat)

increase_in_happiness

`,[cea_functions,predicted_effect_size,predicted_duration_of_benefits],{distributionChartSettings: {showSummary: true, title: "Hours of Happiness per Person Completing the Intervention"}})
Insert cell
Insert cell
viewof predicted_cost_effectiveness = cell(`


predicted_ce_intervention(p_g) = {
increase_in_happiness = effect_on_happiness(p_g)
cost_effectiveness(increase_in_happiness,cost_of_online_intervention_per_person_reached())
}

predicted_ce = predicted_ce_intervention(p_g_hat)

predicted_ce

`,[cea_functions,predicted_effect_size,predicted_duration_of_benefits,predicted_effect_on_wellbeing],{distributionChartSettings: {showSummary: true, title: "Ex-ante cost-effectiveness of a new intervention for promoting prosocial behavior"}})
Insert cell
Insert cell
viewof predicted_scalability = cell(`

//The target group of the new intervention is emerging adults.
//We assume that this corresponds to people of ages 15 to 35. We estimate that this
//demographic constitutes between 50% and 70% of all active internet users.
//source: https://www.statista.com/statistics/272365/age-distribution-of-internet-users-worldwide/
proportion_internet_users_between_15_and_35 = 0.5 to 0.7

// What is the maximal amount of money that the intervention could absorb?
predicted_scalability = scalability_of_online_interventions(proportion_internet_users_between_15_and_35)

predicted_scalability

`, [cea_functions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof predicted_cost= cell(`

//This is a list of the amounts that the Templeton World Charity Foundation Awarded to projects on project developing interventions for character development. I identified then by going to https://www.templetonworldcharity.org/projects-database and searching for projects in the Core Funding Area "Character and Virtue Development" that were part of the priority "Global Innovations for Character and Virtue Development". I went through all projects listed in the results and selected all that involved the development of a psychological intervention.

project_costs_TWCF = [100000, 233999, 234498,233393,234000,999977,1003610,229599,230940,233859,233919,228651,228870,233400,1000000,233919,231679,233753,234054,233784]

predicted_cost_of_research = SampleSet.fromList(project_costs_TWCF)

predicted_cost_of_research

`,[cea_functions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
Insert cell
viewof ex_ante_CE = cell(`


//ex-post cost-effectiveness given the outcomes of the R&D project
ex_post_CE(ce_new, cost_of_research,scalability)= {

cost_effectiveness(expected_benefit(ce_new, cost_of_research,scalability),cost_of_research)
}

//Predicted cost-effectiveness of Baumsteiger's R&D project in hours of happiness per dollar
ex_ante_CE_Baumsteiger=ex_post_CE(predicted_ce,predicted_cost_of_research,predicted_scalability)

//conversion to WELLBYs per dollar
ex_ante_CE_Baumsteiger_WELLBYs = hours_of_happiness_to_WELLBYs(ex_ante_CE_Baumsteiger)

ex_ante_CE_Baumsteiger_WELLBYs
//ex_ante_CE_Baumsteiger
`, [cea_functions,ce_of_previous_interventions,ex_ante_benefit,predicted_cost_effectiveness,predicted_cost,predicted_scalability],{distributionChartSettings: {showSummary: true, title: "Ex-ante cost-effectiveness of developing an intervention for promoting prosocial behavior"}})
Insert cell
viewof ex_ante_benefit = cell(`


//parameters
budget = 10M to 1B
cost_of_RCT = 330000

expected_benefit(ce_new, cost_of_research,scalability)= {

net_effect_of_research(ce_new,ce_best_preexisting_intervention_hh,investment_in_new_intervention(scalability,budget,cost_of_research+cost_of_RCT),cost_of_research+cost_of_RCT)
}

ex_ante_moral_value = expected_benefit(predicted_ce,predicted_cost_of_research,predicted_scalability)

ex_ante_value_in_WELLBYs = hours_of_happiness_to_WELLBYs(ex_ante_moral_value)

ex_ante_value_in_WELLBYs

`,[cea_functions,ce_of_previous_interventions,predicted_cost_effectiveness,predicted_cost,predicted_scalability],{distributionChartSettings: {showSummary: true, title: "Predicted moral value of developing an intervention for promoting prosocial behavior in WELLBYs"}})
Insert cell
Insert cell
viewof comparison_ex_ante = cell(`

//How does the ex-ante cost-effectiveness of this research compare to the cost-effectiveness of the best existing intervention?
cost_effectiveness_ratio = ex_ante_CE_Baumsteiger / ce_best_preexisting_intervention_hh

`, [ex_ante_CE,ce_of_previous_interventions],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
viewof ex_post_vs_ex_ante = cell(`

// How does the ex-ante prediction compare to the ex-post evaluation?

Plot.dists({dists: [{name: "ex-ante", value: ex_ante_CE_Baumsteiger_WELLBYs}, {name: "ex-post", value: ce_R_and_D_in_WELLBYs_per_dollar}]})

`, [cost_effectiveness_of_research,ex_ante_CE],{distributionChartSettings: {showSummary: true, title:"Cost-Effectiveness of Baumsteiger's R&D project in WELLBYs per dollar"}})
Insert cell
viewof ex_post_vs_ex_ante_CE_ratio = cell(`

ex_post_ratio = ce_R_and_D_in_WELLBYs_per_dollar/hours_of_happiness_to_WELLBYs(ce_best_preexisting_intervention_hh)

Plot.dists({dists: [{name: "ex-ante", value: cost_effectiveness_ratio}, {name: "ex-post", value: ex_post_ratio}]})

`, [cost_effectiveness_of_research,ex_ante_CE,comparison_ex_ante,ce_of_previous_interventions,cea_functions],{distributionChartSettings: {showSummary: true, title:"Cost-Effectiveness Ratio compared to the best global health and well-being charities"}})
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more