library(tidyverse)
library(donorheuristics)
library(ggraph)
library(ggdag)
library(here)
# General settings
source(here("analysis", "options.R"))
# Make all the randomness reproducible
set.seed(1234)
# Load data
# results <- readRDS(here("data", "derived_data", "results.rds"))
Our theory and hypotheses are laid out in the causal pathway below. Organizational factors (O, or organizational practices like financial disclosure and accountability practices; I, or issue area; and F, or funding) all influence the decision to donate (D). Structural factors like an NGO’s relationship with its host government (G) also influence donation behavior, but the relationship itself is shaped by both funding and issue area.
node_colors <- tribble(
~name, ~type,
"D", "Outcome",
"I", "Organizational factor",
"F", "Organizational factor",
"O", "Organizational factor",
"G", "Structural factor"
)
# Set up DAG structure
theory_dag <- dagify(D ~ I + F + O + G,
G ~ I + F,
outcome = "D",
exposure = "C") %>%
tidy_dagitty(layout = "dh", seed = 1234)
# Add node types/colors to DAG data
theory_dag$data <- theory_dag$data %>%
left_join(node_colors, by = "name")
# Make DAG plot
plot_dag <- ggplot(theory_dag, aes(x = x, y = y, xend = xend, yend = yend)) +
geom_dag_point(size = 6, mapping = aes(color = type)) +
geom_dag_edges(start_cap = circle(4, "mm"),
end_cap = circle(4, "mm")) +
geom_dag_text(size = pts(6), family = "Roboto Condensed", fontface = "bold") +
scale_dag() +
theme_ngo() +
theme(panel.grid = element_blank(),
panel.border = element_blank(),
axis.title = element_blank(),
axis.text = element_blank())
# Show and save plot
plot_dag
## # http://dirk.eddelbuettel.com/blog/2017/11/27/#011_faster_package_installation_one
## VER=
## CCACHE=ccache
## CC=$(CCACHE) gcc$(VER)
## CXX=$(CCACHE) g++$(VER)
## CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function -Wno-unused-local-typedefs
## CXX11=$(CCACHE) g++$(VER)
## CXX14=$(CCACHE) g++$(VER)
## FLIBS = -L`gfortran -print-file-name=libgfortran.dylib | xargs dirname`
## FC=$(CCACHE) gfortran$(VER)
## F77=$(CCACHE) gfortran$(VER)
## ─ Session info ──────────────────────────────────────────────────────────
## setting value
## version R version 3.6.0 (2019-04-26)
## os macOS Mojave 10.14.4
## system x86_64, darwin15.6.0
## ui X11
## language (EN)
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz America/Denver
## date 2019-05-16
##
## ─ Packages ──────────────────────────────────────────────────────────────
## package * version date lib
## assertthat 0.2.1 2019-03-21 [1]
## backports 1.1.4 2019-04-10 [1]
## base64enc 0.1-3 2015-07-28 [1]
## boot 1.3-22 2019-04-02 [1]
## broom 0.5.2 2019-04-07 [1]
## callr 3.2.0 2019-03-15 [1]
## cellranger 1.1.0 2016-07-27 [1]
## cli 1.1.0 2019-03-19 [1]
## colorspace 1.4-1 2019-03-18 [1]
## crayon 1.3.4 2017-09-16 [1]
## curl 3.3 2019-01-10 [1]
## dagitty 0.2-2 2016-08-26 [1]
## desc 1.2.0 2018-05-01 [1]
## devtools 2.0.2 2019-04-08 [1]
## digest 0.6.18 2018-10-10 [1]
## donorheuristics * 0.0.0.9000 2019-05-02 [1]
## dplyr * 0.8.1 2019-05-14 [1]
## evaluate 0.13 2019-02-12 [1]
## farver 1.1.0 2018-11-20 [1]
## forcats * 0.4.0 2019-02-17 [1]
## fs 1.3.1 2019-05-06 [1]
## generics 0.0.2 2018-11-29 [1]
## ggdag * 0.1.0 2018-03-27 [1]
## ggforce 0.2.2 2019-04-23 [1]
## ggplot2 * 3.1.1 2019-04-07 [1]
## ggraph * 1.0.2 2018-07-07 [1]
## ggrepel 0.8.0 2018-05-09 [1]
## glue 1.3.1 2019-03-12 [1]
## gridExtra 2.3 2017-09-09 [1]
## gtable 0.3.0 2019-03-25 [1]
## haven 2.1.0 2019-02-19 [1]
## here * 0.1 2017-05-28 [1]
## hms 0.4.2 2018-03-10 [1]
## htmltools 0.3.6 2017-04-28 [1]
## httr 1.4.0 2018-12-11 [1]
## igraph 1.2.4.1 2019-04-22 [1]
## jsonlite 1.6 2018-12-07 [1]
## knitr 1.22 2019-03-08 [1]
## labeling 0.3 2014-08-23 [1]
## lattice 0.20-38 2018-11-04 [1]
## lazyeval 0.2.2 2019-03-15 [1]
## lubridate 1.7.4 2018-04-11 [1]
## magrittr 1.5 2014-11-22 [1]
## MASS 7.3-51.4 2019-03-31 [1]
## memoise 1.1.0 2017-04-21 [1]
## modelr 0.1.4 2019-02-18 [1]
## munsell 0.5.0 2018-06-12 [1]
## nlme 3.1-139 2019-04-09 [1]
## pander 0.6.3 2018-11-06 [1]
## pillar 1.4.0 2019-05-11 [1]
## pkgbuild 1.0.3 2019-03-20 [1]
## pkgconfig 2.0.2 2018-08-16 [1]
## pkgload 1.0.2 2018-10-29 [1]
## plyr 1.8.4 2016-06-08 [1]
## polyclip 1.10-0 2019-03-14 [1]
## prettyunits 1.0.2 2015-07-13 [1]
## processx 3.3.1.9000 2019-05-14 [1]
## ps 1.3.0 2018-12-21 [1]
## purrr * 0.3.2 2019-03-15 [1]
## R6 2.4.0 2019-02-14 [1]
## RColorBrewer 1.1-2 2014-12-07 [1]
## Rcpp 1.0.1 2019-03-17 [1]
## readr * 1.3.1 2018-12-21 [1]
## readxl 1.3.1 2019-03-13 [1]
## remotes 2.0.4 2019-04-10 [1]
## rlang 0.3.4 2019-04-07 [1]
## rmarkdown 1.12 2019-03-14 [1]
## rprojroot 1.3-2 2018-01-03 [1]
## rstudioapi 0.10 2019-03-19 [1]
## rvest 0.3.3 2019-04-11 [1]
## scales 1.0.0.9000 2019-05-10 [1]
## sessioninfo 1.1.1 2018-11-05 [1]
## stringi 1.4.3 2019-03-12 [1]
## stringr * 1.4.0 2019-02-10 [1]
## testthat 2.1.1 2019-04-23 [1]
## tibble * 2.1.1 2019-03-16 [1]
## tidygraph 1.1.2 2019-02-18 [1]
## tidyr * 0.8.3 2019-03-01 [1]
## tidyselect 0.2.5 2018-10-11 [1]
## tidyverse * 1.2.1 2017-11-14 [1]
## tweenr 1.0.1 2018-12-14 [1]
## usethis 1.5.0 2019-04-07 [1]
## V8 2.2 2019-04-13 [1]
## viridis 0.5.1 2018-03-29 [1]
## viridisLite 0.3.0 2018-02-01 [1]
## withr 2.1.2 2018-03-15 [1]
## xfun 0.7 2019-05-14 [1]
## xml2 1.2.0 2018-01-24 [1]
## yaml 2.2.0 2018-07-25 [1]
## source
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## local
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Github (r-pkgs/processx@505cb1f)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Github (r-lib/scales@7f6f4a5)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
##
## [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library