Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fhoces committed Apr 1, 2021
2 parents 3ec4423 + 09ffa77 commit b7236ed
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
5 changes: 3 additions & 2 deletions all_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ if (FALSE) {

setwd(here())

# get links
links <- read.csv("links.csv")
# change to the following when deploying:
# links <- read.csv("links.csv")
links <- read.csv("code/shiny_app/links.csv")
rownames(links) <- links$name

knitr::opts_knit$set(root.dir = here())
Expand Down
14 changes: 7 additions & 7 deletions code/01_final_opa.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "<center><div class= 'mytitle'>Open Policy Analysis for Deworming</div></center>"
date: "<center><div class='mysubtitle'>`r format(Sys.time(), '%d %B, %Y')` <br><img height = '60px' src = './shiny_app/www/BITSS_logo_horizontal.png'><img height='60px' src='./shiny_app/www/CEGA_logo.png'><img height = '60px' src = './shiny_app/www/OPA_layers.png'></div></center>"
date: "<center><div class='mysubtitle'>`r format(Sys.time(), '%d %B, %Y')` <br><img height = '60px' src = './shiny_app/www/BITSS_logo_horizontal.png'><img height='60px' src='./shiny_app/www/CEGA_logo.png'><a href = 'http://www.bitss.org/opa/projects/deworming/'><img height = '60px' src = './shiny_app/www/OPA_layers.png'></a></div></center>"
author: "<center><div class = 'contributors'>BITSS Team. Full list of contributors [here](https://github.com/BITSS-OPA/opa-deworming#list-of-contributors)</div></center>"
editor_options:
chunk_output_type: console
Expand Down Expand Up @@ -209,7 +209,7 @@ chunk_sources <- function(){
df_prevalence_so <- read_excel("data/prevalence_data.xlsx",
sheet = "Sheet1")
# prevalence_0_so <- c("hookworm" = 0.77, "roundworm" = 0.42, "whipworm" =0.55, "Schisto mansoni" = 0.22) # from Draft Cost-Effectiveness Model.xlsx ADD ORIGINAL SOURCE
prevalence_r_so <- c("india" = 0.5665, "kenya" = 0.345,
prevalence_r_so <- c("india" = 0.5665, "kenya" = 0.345,
"nigeria" = 0.27, "vietnam" = 0.145) #0.5665 0.5013121
# based on https://docs.google.com/spreadsheets/d/1drKdU-kRjlRtwXq6nCqFC6gcoQ-eOaLfT9MWHSMZ0MA/edit?usp=sharing
years_of_treat_t_so <- 2.41 #Years of Treatment in new setting
Expand Down Expand Up @@ -913,7 +913,7 @@ pv_benef_yes_ext_in <- pv_benef_f(

</details>



#### Assessing computational reproducibility of original results

Expand Down Expand Up @@ -1093,7 +1093,7 @@ s2_in <- s2_f()

</details>



#### Indirect costs: additional years of education and its costs for government

Expand Down Expand Up @@ -1270,7 +1270,7 @@ earnings_no_ext_new_in <- earnings_app2_f(t_var = 0:50,

</details>



```{r sum-tables17, purl=FALSE, echo=FALSE, eval=show_summary_tables}
Expand Down Expand Up @@ -1456,7 +1456,7 @@ irr_in <- (multiroot(function(x) get_irr(rate_var = x), .1, maxiter=10000000, po

</details>



Over this nine-year period, treated students attended school for an additional `r round(sum(delta_ed_so[,1]),2)` years on average. Thus the average cost of additional schooling per child over the nine-year period is \$`r format(round((cost_per_student_new_in*sum( (1/(1+interest_new_in))^(0:8) * delta_ed_in )),2), nsmall = 2)`.

Expand Down Expand Up @@ -2872,7 +2872,7 @@ write.csv(ea3_pe, file = ea3_save_path)
| 3.2 | 1.2 + prevalence + length | Treatment (EA) | `r round(ea2_pe, 1)` | \- |
| **3.3** | **2.1 + prevalence + length** | **Treatment (EA)** | **`r round(ea3_pe, 1)`** | **-** |



```{r generate-plot-function, purl = TRUE, echo = FALSE}
# generate_plot_f: function to generate plots for both Dynamic Document and
Expand Down
Binary file modified code/images/main_pe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion code/shiny_app/all_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (TRUE) {


# get links
links <- read.csv(here("links.csv"))
links <- read.csv(here("code/shiny_app/links.csv"))
rownames(links) <- links$name

knitr::opts_knit$set(root.dir = here())
Expand Down
8 changes: 5 additions & 3 deletions code/shiny_app/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ library(ggplot2)

# get links
setwd(here())
links <- read.csv("links.csv")
# change to the following when deploying:
# links <- read.csv("links.csv")
links <- read.csv("code/shiny_app/links.csv")
rownames(links) <- links$name

# not sure if this makes a difference
Expand Down Expand Up @@ -114,7 +116,7 @@ shinyUI(
width = "20%",
height = "auto"
),
href = links['bitss_opa','url']
href = links['dw_info','url']
)
)),
fluidRow(
Expand Down Expand Up @@ -200,7 +202,7 @@ shinyUI(
align = "center",
tags$a(
img(
src = "OPA_layers_assumptions.png",
src = "OPA_layers_output.png",
width = "70%",
height = "auto"
)
Expand Down
2 changes: 1 addition & 1 deletion code/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ img[alt = screenshot]{height: 20px}
margin: 20px 5px 20px 15px ;
background-image: url("./shiny_app/www/OPA_layers_details.png");
background-size: contain;
background-position: right;
background-position: center;
background-repeat: no-repeat;
}

Expand Down
10 changes: 8 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "<center><div class= 'mytitle'>Open Policy Analysis for Deworming</div></center>"
date: "<center><div class='mysubtitle'>01 April, 2021 <img height = '80px' src = './shiny_app/www/BITSS_logo_horizontal.png'><img height='80px' src='./shiny_app/www/CEGA_logo.png'></div></center>"
date: "<center><div class='mysubtitle'>01 April, 2021 <br><img height = '60px' src = './shiny_app/www/BITSS_logo_horizontal.png'><img height='60px' src='./shiny_app/www/CEGA_logo.png'><a href = 'http://www.bitss.org/opa/projects/deworming/'><img height = '60px' src = './shiny_app/www/OPA_layers.png'></a></div></center>"
author: "<center><div class = 'contributors'>BITSS Team. Full list of contributors [here](https://github.com/BITSS-OPA/opa-deworming#list-of-contributors)</div></center>"
editor_options:
chunk_output_type: console
Expand Down Expand Up @@ -258,7 +258,6 @@ invisible( list2env(chunk_sources(),.GlobalEnv) )
# coverage_so: Overall Saturation (0.511) / 0.75 - not reported in table, average of T & C
```

*Note: This is Version 1.0 of the OPA. Please kindly report any errors in the dynamic document [here](https://github.com/BITSS-OPA/opa-deworming/blob/master/issue_template.md).*

<img src="C:/Users/thepe/Documents/GitHub/opa-deworming/code/images/main_pe.png" width="100%" style="display: block; margin: auto;" />

Expand Down Expand Up @@ -292,6 +291,9 @@ This OPA project contains three components, following the OPA principles laid ou

This report provides a complete description of the analysis behind the results presented to inform a policy discussion on deworming interventions. It describes how to reproduce the analysis in its entirety, and includes all the methodological choices involved. In order to document all the steps without overwhelming the reader, the report is displayed in a layered fashion. The first layer consists of a narrative description of the analysis. The second layer, which appears after clicking in the ![screenshot](images/show_details.png?display%20=%20inline-block) contains equations that show how each piece of the analysis was carried out. The third and final layer displays the code used to operationalize each equation. This information is contained within this document using dynamic documentation [@xie2015dynamic], so interested readers can access the report's source file and easily reproduce the entire document in their own computing environments.

> *Note: This is Version 1.0 of the OPA. Please kindly report any errors in the dynamic document [here](https://github.com/BITSS-OPA/opa-deworming/issues/new/choose).*

# Introduction

Parasitic worm infections, also known as soil-transmitted helminths (STH) and schistosomiasis, are endemic in many countries, and disproportionately affect the poor. These parasitic worms interfere with regular bodily processes by decreasing nutrient uptake. Thus, these worms can lead to serious consequences on human health, education outcomes, and long-term economic well being. In particular, evidence indicates that these worms contribute to malnourishment, impairment of mental and physical development, lower school attendance, and decreased wages [@croke2014long; @miguel2004worms; @baird2016worms].
Expand Down Expand Up @@ -1147,10 +1149,14 @@ chunk_unit_costs2_new <- function(){
unit_cost <- ( unit_cost_local_var / ex_rate_var )
periods_temp <- floor(year_of_treat_var)
part_of_last_year_temp <- round(year_of_treat_var - periods_temp, 1)
if (periods_temp < 1) {
0
} else {
sum(
( unit_cost * (1 + interest_var)^(-(0:periods_temp)) ) *
c(rep(1,periods_temp), part_of_last_year_temp)
)
}
}

###############################################################################
Expand Down

0 comments on commit b7236ed

Please sign in to comment.