Public
Edited
Feb 8, 2023
Importers
Insert cell
Insert cell
Insert cell
import {cea_functions, cell} from "@falk-lieder/cea_library"
Insert cell
Insert cell
Insert cell
interventionPathwayToImpact1 = FileAttachment("Intervention Pathway to Impact.png").image()
Insert cell
Insert cell
Insert cell
step2 = FileAttachment("Step2.png").image()
Insert cell
Insert cell
Insert cell
viewof effect_sizes = cell(`

//mean scores on the self-report measure of prosocial behavior.
//m stands for mean, post stands for post-test, pre stands for pre-test, t stands for the treatment group, c stands for the control group
m_post_t =4.80
m_pre_t = 4.08
m_post_c = 4.84
m_pre_c = 4.62

//standard deviations of the pre-test scores
sd_pre_t = 1.28
sd_pre_c = 1.41

// number of participants in the treatment group (n_t) and the control group (n_c)
n_t = 43
n_c = 32

// correlation between pre-test scores and post-test scores
rho = 0.47

effect_size_estimate_baumsteiger = effect_size_ppc(m_post_t,m_pre_t,m_post_c,m_pre_c,sd_pre_t,sd_pre_c,n_t,n_c)
se_effect_size_estimate = se_effect_size_ppc(m_post_t,m_pre_t,m_post_c,m_pre_c,sd_pre_t,sd_pre_c,n_t,n_c,rho)

immediate_effect = normal(effect_size_estimate_baumsteiger,se_effect_size_estimate)


`, cea_functions,{distributionChartSettings: {showSummary: true, title:"Probability distribution over the potential values of the effect size (d) of the intervention by Baumsteiger (2019).", tickFormat:","}})
Insert cell
Insert cell
viewof initial_freq_of_prosocial_behavior = cell(`

initial_increase_in_freq_of_prosocial_behavior_per_day = immediate_effect * std_freq_of_prosocial_behavior_in_acts_per_day

`, [effect_sizes,cea_functions,std_freq_prosocial,half_life_bs_samples],{distributionChartSettings: {showSummary: true, title:"Probability (y-axis) that people exposed to the intervention perform x additional acts of prosocial behavior per day (x-axis)", tickFormat:","}})
Insert cell
Insert cell
viewof effect_on_prosocial_behavior = cell(`

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)


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

// estimate of the standard deviation reported in the article
std_estimate = 1.64
n=77

std_freq_of_prosocial_behavior_in_acts_per_day = p_std_from_estimate(std_estimate,n)

`,cea_functions)
Insert cell
Insert cell
Insert cell
half_life_bs_json = FileAttachment("half_life_bs.json").json()
Insert cell
viewof half_life_bs_samples=cell(`

half_life = SampleSet.fromList($half_life_bs)`,undefined,{jsImports: {half_life_bs: half_life_bs_json},
distributionChartSettings: {showSummary: true, title:"Number of days until the effect of the intervention drops to 50%"}})
Insert cell
Insert cell
step31 = FileAttachment("Step3@1.png").image()
Insert cell
Insert cell
viewof wellbeing = cell(`

increase_in_happiness = increase_in_nr_acts_of_kindness_per_person * benefit_of_one_kind_act()

`
,[effect_on_prosocial_behavior,cea_functions],{distributionChartSettings: {showSummary: true, title:"Hours of happiness generated by each person who completes the intervention"}})
Insert cell
Insert cell
viewof benefit_of_kindness = cell(
`
/* How much happier is someone right after someone did something kind for them?
The estimate is based on the study by Pressman et al. (2015) and Zhao and Epley (2021).
*/

//According to the increase in Duchenne smiles observed by Pressman, Kraft, and Cross (2015). The effect size reported in that study was //1.1. I estimate the width of the confidence interval on that effect size to be about 0.3.
effect_of_kindness_on_smiles = normal_from_ci(1.1-1.96*0.3,1.1+1.96*0.3) // normal distribution with 95% CI [0.5,1.7]

// Effect of compliments according to Experiments 1 and 2 by Zhao & Epley (2021) being complemented boosted the recipients' mood by 0.66 // standard deviations
effect_of_compliment_on_mood = normal(0.66,0.20)

// To express the assumption that each empirically documented effect-sizes is equally likely to occur when someone benefits from prosocial behavior, we create a mixture distribution.
peak_amplitude_of_joy_beneficiary = mx(effect_of_kindness_on_smiles, effect_of_compliment_on_mood)

//How much happier does a person feel right after being kind to someone else?
peak_amplitude_of_joy_benefactor = normal_from_ci(0.16,0.41) //95% Gaussian posterior credible interval: [0.16,0.41] according to Curry et al. (2018)

//Average duration of joy according to Verduyn, van Mechelen, & Tuerlinckx (2011)
avg_duration_joy_h = lognormal_from_mean_and_std(1.7267,0.1086)

//I calculated the total joy per unit event by calculating the area under the joy intensity profile shown in Figure 6 of Verduyn, P., Van Mechelen, I., Tuerlinckx, F., Meers, K., & Van Coillie, H. (2009) using numerical integration with the trapezoid rule in Matlab (trapz). Because a unit event lasts one unit of time, the result is also the average level of joy during a unit event.
avg_intensity_of_joy = normal(0.4796,0.1) // The mean value is the area under the curve in Figure 6. The standard deviation estimates the effect of the unreported uncertainty. Given that this number corresponds to the average across 260 graphs, I believe this estimate to be high enough.
hours_of_happiness_per_SD_joy = avg_duration_joy_h * avg_intensity_of_joy

//Sum up the beneficiary's increase in affective well-being over time in hours of happiness.
//Arguably, the beneficiary's emotional response might be closer to gratitude than joy. However, according to Verduyn & Lavrijsen (2015), the durations of joy and gratitude are similar.
total_effect_of_one_act_of_kindness_on_beneficiary = peak_amplitude_of_joy_beneficiary * hours_of_happiness_per_SD_joy

//Sum up the benefactor's increase in affective well-being over time in hours of happiness.
total_effect_of_one_act_of_kindness_on_benefactor = peak_amplitude_of_joy_benefactor * hours_of_happiness_per_SD_joy

//the total benefit is the sum of the benefits to the benefactor and the beneficiary
total_effect_of_one_act_of_kindness_on_beneficiary + total_effect_of_one_act_of_kindness_on_benefactor

`, cea_functions, {distributionChartSettings: {showSummary: true, title:"Hours of Happiness created by one act of kindness.", tickFormat:","}}
)
Insert cell
Insert cell
Insert cell
viewof cost_effectiveness_of_intervention_bs = cell(`

//cost-effectiveness in hours of happiness per dollar spent on its deployment
ce_new_bs_hh = cost_effectiveness(increase_in_happiness,cost_of_online_intervention_per_person_reached())

`, [cea_functions,wellbeing],{distributionChartSettings: {showSummary: true,title:"Cost-Effectiveness of Promoting Prosocial Behavior in Hours of Happiness per $"}})
Insert cell
viewof cost_effectiveness_of_intervention_bs_WELLBY = cell(`

//cost-effectiveness in WELLBYs/1000$
ce_new_bs_WELLBYs_per_1000USD = 1000*hours_of_happiness_to_WELLBYs(ce_new_bs_hh)

`,[cea_functions,wellbeing,cost_effectiveness_of_intervention_bs],{distributionChartSettings: {showSummary: true, title:"Cost-Effectiveness of Promoting Prosocial Behavior in WELLBYs/$1000"}})
Insert cell
Insert cell
viewof cost = cell(`

//Cost of deploying an online intervention through advertising in USD per person reached

//Cost of bringing people into the digital intervention through online advertising
//https://www.businessofapps.com/ads/cpi/research/cost-per-install/
cost_per_install_in_usd = SampleSet.fromList([0.93,1.03,0.34,5.28,3.6,1.22,4.3,1.15,1.04])

//How many people complete the intervention per person who clicks on the ad?
//A meta-analysis of observational studies found that 49% (95% CI: 27%-70%) of users
//of mobile health interventions drop out of the intervention without completing it.
//https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7556375/
rate_of_followthrough = normal_from_ci(1-0.70,1-0.27)//uniform(0.05,0.5)

//The cost per person who finishes the
cost_per_install_in_usd / rate_of_followthrough

`, cea_functions,{distributionChartSettings: {showSummary: true, title:"Cost of online advertising per person completing the intervention in USD"}})
Insert cell
Insert cell
viewof comparison = cell(`

{distributions: [{name: "GiveDirectly", distribution: ce_GiveDirectly_WELLBYs}, {name:"Deworming", distribution: ce_deworming_WELLBYs}, {name: "StrongMinds", distribution: ce_StrongMinds_WELLBYs}, {name:"Anti-Malaria Foundation", distribution: ce_AMF_WELLBYs}, {name:"Prosocial Purpose", distribution: ce_new_bs_WELLBYs_per_1000USD}]}


`, [ce_of_previous_interventions, cost_effectiveness_of_intervention_bs,cost_effectiveness_of_intervention_bs_WELLBY],{distributionChartSettings: {showSummary: true, title:"Cost-Effectiveness in WELLBYs per $1000"}})
Insert cell
Insert cell
cell(`

prob_new_intervention_more_cost_effective_than_StrongMinds=1-cdf(ce_new_bs_WELLBYs_per_1000USD-ce_StrongMinds_WELLBYs,0)

`, [ce_of_previous_interventions, cost_effectiveness_of_intervention_bs,cost_effectiveness_of_intervention_bs_WELLBY])
Insert cell
Insert cell
viewof ce_of_previous_interventions = cell(`

// Cost-Effectiveness of Strong Mind's task-shifted group CBT for perinatal depression
// for women in developing countries, according to McGuire & Plant (2021).
ce_StrongMinds_SD_per_1000USD = 8.2 to 24
ce_StrongMinds_WELLBYs = sd_to_WELLBY(ce_StrongMinds_SD_per_1000USD)

ce_GiveDirectly_sd_years_per_1000USD = 0.278 to 1.77//1000/1170*normal_from_ci(0.077,0.121)
ce_GiveDirectly_WELLBYs = sd_to_WELLBY(ce_GiveDirectly_sd_years_per_1000USD)

ce_deworming_WELLBYs = normal(mean(8.67*ce_GiveDirectly_WELLBYs),(180+175)/(2*1.96))

ce_AMF_WELLBYs = 89.63-uniform(1,5)*(89.63-5.94)/5 //min(5,max(0,to(0.5,5)->SampleSet.fromDist))

//According to the HLI (Plant, 2022), the most cost-effective intervention that has already been developed and evaluated is StrongMinds' task-shifted interpersonal group therapy for perinatal depression in Zambia and Ghana. The variable below measures its cost-effectiveness in hours of happiness per dollar.
ce_best_preexisting_intervention_hh = sd_years_per_1000USD_to_hh_per_dollar(ce_StrongMinds_SD_per_1000USD)

`, [cost_effectiveness_of_intervention_bs,cea_functions,cost_effectiveness_of_intervention_bs_WELLBY],{distributionChartSettings: {showSummary: true}})
Insert cell
Insert cell
Insert cell
footnote1 = md` 1. A good way to learn Squiggle is to start from the [Overview](https://www.squiggle-language.com/docs/Overview) and then try it out on the [Playground](https://www.squiggle-language.com/playground). To get started with Observable, take a look at [this notebook](https://observablehq.com/@observablehq/getting-started) and then create a free Observable account. For more information, you can always click on the icon with the question mark on the right of a notebook. A good way to learn how to use Squiggle in Observable notebooks is to work through [Sam Nolan's tutorial](https://observablehq.com/@hazelfire/squiggle).`
Insert cell
footnote2=md` 2.The effect size measure Cohen's ${tex`d`} is defined as`
Insert cell
tex`d = \frac{\Delta}{\sigma},`
Insert cell
Insert cell
Insert cell
footnote3=md`3.The Deprivationist account of the badness of death holds that death is that all of the badness of death lies in depriving the deceased of the well-being they would experience if they stayed alive. This foregone well-being can be estimated by the product of the amount of time by which the person's life was cut short and the average amount of well-being they would have experienced during that time. A person's well-being can be either positive, zero, or negative. According to the Deprivationist account, death is bad only if the person's well-being is positive. Moreover, death becomes worse as the intensity of the foregone well-being increases. Perhaps the most commonly used self-report measure of well-being is the Satisfaction with Life Scale (Diener et al., 1985). It asks people to rate their agreement with several statements about the quality of their life and then summarizes their answers with a score that ranges from 0 to 30. The worst possible score (0) corresponds to *negative* well-being, whereas the highest possible level of well-being corresponds to *positive* well-being. People whose life is neither good nor bad (wellbeing = 0) choose an intermediate rating. For these individuals dying would be a neutral event. Therefore, the rating such individuals assign to their well-being is called *the neutral point* of the well-being scale. For people whose well-being is even lower, dying would be a positive event. For individuals whose well-being is higher, death is bad.

To estimate how bad death is on average, we need an estimate of the difference between the average well-being rating and the neutral point of the well-being scale. According to Plant, McGuire, and Dupret (2022) the neutral point of the Satisfaction with Life Scale lies somewhere between 1 and 5 life satisfaction points. We, therefore, model our knowledge about the neutral point of the Satisfaction with Life Scale as a uniform distribution ranging from 1 to 5 life satisfaction points.


One shortcoming of the Deprivationist account of the badness of death is that it ignores additional sources of badness, such as the grief of other people and preventing the person from positively contributing to society and increasing the well-being of others.`
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more