├── .Rprofile ├── .gitattributes ├── .gitignore ├── CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── R ├── funs_data-generation.R ├── funs_knitting.R ├── funs_notebook.R ├── funs_plots.R ├── funs_survey.R └── graphics.R ├── README.Rmd ├── README.md ├── _packages.R ├── _targets.R ├── analysis ├── 01_clean-generate-data.Rmd ├── 02_tables.Rmd ├── 03_analysis.Rmd ├── Makefile ├── _site.yml ├── experiment.Rmd ├── files │ ├── byu-irb-approval.pdf │ ├── cnu-irb-approval.pdf │ └── gsu-irb-approval.pdf ├── html │ ├── fixes.css │ └── footer.html ├── index.Rmd ├── output └── text │ ├── experiment.md │ └── experiment_anonymized.md ├── data ├── DO-NOT-EDIT-ANY-FILES-IN-HERE-BY-HAND ├── derived_data │ ├── survey_results.csv │ └── survey_results.yaml └── raw_data │ ├── Market Simulator Version 01.xlsx │ ├── data-FTjUv.csv │ ├── data-xextT.csv │ └── posterior_draws │ └── .gitignore ├── img ├── data_large_color.png ├── materials_large_color.png └── preregistered_large_color.png ├── manuscript ├── _output.yaml ├── appendix.Rmd ├── bibliography.bib ├── manuscript.Rmd ├── output │ ├── extracted-citations.bib │ └── html-support │ │ ├── ath-1.0.0 │ │ └── ath-clean.css │ │ ├── header-attrs-2.7 │ │ └── header-attrs.js │ │ ├── kePrint-0.0.1 │ │ └── kePrint.js │ │ └── lightable-0.0.1 │ │ └── lightable.css └── pandoc │ ├── bin │ ├── anonymize.py │ └── replacements.csv │ ├── csl │ ├── american-political-science-association.csl │ ├── apa.csl │ ├── apsa-no-bib.csl │ ├── chicago-author-date.csl │ ├── chicago-fullnote-no-bib.csl │ ├── chicago-syllabus-no-bib.csl │ ├── chicago-syllabus.csl │ └── the-open-university-harvard.csl │ ├── css │ └── ath-clean.css │ └── templates │ ├── ath-manuscript.docx │ ├── html.html │ ├── odt-manuscript.odt │ ├── odt.odt │ ├── reference-manuscript.odt │ ├── reference.odt │ ├── xelatex-manuscript.tex │ └── xelatex.tex ├── renv.lock ├── renv ├── .gitignore ├── activate.R └── settings.dcf └── whocares.Rproj /.Rprofile: -------------------------------------------------------------------------------- 1 | source("renv/activate.R") 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Site output 2 | analysis/_site/* 3 | analysis/survey/*.pdf 4 | analysis/survey/*.html 5 | README.html 6 | 7 | # Site output 8 | analysis/_site/* 9 | analysis/site_libs/* 10 | 11 | # knitr and caching stuff 12 | *_files/* 13 | *_cache/* 14 | 15 | # Targets stuff 16 | _targets 17 | 18 | # Manuscript output 19 | manuscript/*.log 20 | manuscript/output/*.docx 21 | manuscript/output/*.html 22 | manuscript/output/*.pdf 23 | manuscript/output/*.tex 24 | manuscript/output/figures/* 25 | manuscript/submissions/* 26 | 27 | # Large data files (these get downloaded automatically with 28 | # targets::tar_make(c(survey_results_file, gamma_draws_file))) 29 | data/private_data/* 30 | data/raw_data/final_data.rds 31 | data/raw_data/posterior_draws/*.rds 32 | 33 | # Other folders 34 | admin/* 35 | private/* 36 | 37 | # R stuff 38 | .Rproj.user 39 | .Rhistory 40 | .RData 41 | .Ruserdata 42 | 43 | # Miscellaneous 44 | *.~lock.* 45 | .DS_Store 46 | .dropbox 47 | Icon? 48 | -------------------------------------------------------------------------------- /CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who 4 | contribute through reporting issues, posting feature requests, updating documentation, 5 | submitting pull requests or patches, and other activities. 6 | 7 | We are committed to making participation in this project a harassment-free experience for 8 | everyone, regardless of level of experience, gender, gender identity and expression, 9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 10 | 11 | Examples of unacceptable behavior by participants include the use of sexual language or 12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment, 13 | insults, or other unprofessional conduct. 14 | 15 | Project maintainers have the right and responsibility to remove, edit, or reject comments, 16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this 17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed 18 | from the project team. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by 21 | opening an issue or contacting one or more of the project maintainers. 22 | 23 | This Code of Conduct is adapted from the Contributor Covenant 24 | (http:contributor-covenant.org), version 1.0.0, available at 25 | http://contributor-covenant.org/version/1/0/0/ 26 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We love pull requests from everyone. By participating in this project, you 4 | agree to abide by our [code of conduct](CONDUCT.md). 5 | 6 | ## Getting Started 7 | 8 | * Make sure you have a [GitHub account](https://github.com/signup/free). If you are not familar with git and GitHub, take a look at to get started. 9 | * [Submit a post for your issue](https://github.com///issues/), assuming one does not already exist. 10 | * Clearly describe your issue, including steps to reproduce when it is a bug, or some justification for a proposed improvement. 11 | * [Fork](https://github.com///#fork-destination-box) the repository on GitHub to make a copy of the repository on your account. Or use this line in your shell terminal: 12 | 13 | `git clone git@github.com:your-username/.git` 14 | 15 | ## Making changes 16 | 17 | * Edit the files, save often, and make commits of logical units, where each commit indicates one concept 18 | * Follow our [style guide](http://adv-r.had.co.nz/Style.html). 19 | * Make sure you write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 20 | * Make sure you have added the necessary tests for your code changes. 21 | * Run _all_ the tests using `devtools::check()` to assure nothing else was accidentally broken. 22 | * If you need help or unsure about anything, post an update to [your issue](https://github.com///issues/). 23 | 24 | ## Submitting your changes 25 | 26 | Push to your fork and [submit a pull request](https://github.com///compare/). 27 | 28 | At this point you're waiting on us. We like to at least comment on pull requests 29 | within a few days (and, typically, one business day). We may suggest 30 | some changes or improvements or alternatives. 31 | 32 | Some things you can do that will increase the chance that your pull request is accepted: 33 | 34 | * Engage in discussion on [your issue](https://github.com///issues/). 35 | * Be familiar with the backround literature cited in the [README](README.Rmd) 36 | * Write tests that pass. 37 | * Follow our [code style guide](http://adv-r.had.co.nz/Style.html). 38 | * Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2021 Suparna Chaudhry, Marc Dotson, and Andrew Heiss 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /R/funs_knitting.R: -------------------------------------------------------------------------------- 1 | library(bib2df) 2 | library(rvest) 3 | library(xml2) 4 | library(stringi) 5 | 6 | render_html <- function(input, output, csl, support_folder, ...) { 7 | # Add CSS file as a dependency so it goes into the _files directory 8 | dep <- htmltools::htmlDependency( 9 | name = "ath", 10 | version = "1.0.0", 11 | "pandoc/css", 12 | stylesheet = "ath-clean.css" 13 | ) 14 | extra_dependencies <- list(dep) 15 | 16 | # IMPORTANT 17 | # When knitting to docx, bookdown deletes the _files directory for whatever 18 | # reason, so if you knit to HTML and then docx, you get a nice *_files 19 | # directly that then disappears when the Word file is done. One way around 20 | # this is to specify lib_dir here in rmarkdown::render() 21 | 22 | out <- rmarkdown::render( 23 | input = input, 24 | output_file = output, 25 | bookdown::html_document2( 26 | template = "pandoc/templates/html.html", 27 | pandoc_args = c("--metadata", "link-citations=true", 28 | "--metadata", "linkReferences=true", 29 | paste0("--csl=", csl)), 30 | md_extensions = "+raw_tex+smart-autolink_bare_uris+ascii_identifiers", 31 | toc = TRUE, 32 | number_sections = FALSE, 33 | self_contained = FALSE, 34 | theme = NULL, 35 | extra_dependencies = extra_dependencies, 36 | lib_dir = support_folder 37 | ), 38 | encoding = "UTF-8" 39 | ) 40 | 41 | return(fs::path_rel(out)) 42 | } 43 | 44 | render_pdf <- function(input, output, bibstyle, ...) { 45 | out <- rmarkdown::render( 46 | input = input, 47 | output_file = output, 48 | bookdown::pdf_document2( 49 | template = "pandoc/templates/xelatex.tex", 50 | latex_engine = "xelatex", 51 | dev = "cairo_pdf", 52 | pandoc_args = c("--top-level-division=section", 53 | "--shift-heading-level-by=0", 54 | "-V", bibstyle, 55 | "-V", "chapterstyle=hikma-article"), 56 | md_extensions = "+raw_tex+smart-autolink_bare_uris", 57 | toc = FALSE, 58 | keep_tex = FALSE, 59 | citation_package = "biblatex" 60 | ), 61 | encoding = "UTF-8" 62 | ) 63 | 64 | return(fs::path_rel(out)) 65 | } 66 | 67 | render_pdf_ms <- function(input, output, bibstyle, ...) { 68 | out <- rmarkdown::render( 69 | input = input, 70 | output_file = output, 71 | bookdown::pdf_document2( 72 | template = "pandoc/templates/xelatex-manuscript.tex", 73 | latex_engine = "xelatex", 74 | dev = "cairo_pdf", 75 | pandoc_args = c("--top-level-division=section", 76 | "--shift-heading-level-by=0", 77 | "-V", bibstyle), 78 | md_extensions = "+raw_tex+smart-autolink_bare_uris", 79 | toc = FALSE, 80 | keep_tex = FALSE, 81 | citation_package = "biblatex" 82 | ), 83 | encoding = "UTF-8" 84 | ) 85 | 86 | return(fs::path_rel(out)) 87 | } 88 | 89 | render_docx <- function(input, output, csl, ...) { 90 | out <- rmarkdown::render( 91 | input = input, 92 | output_file = output, 93 | bookdown::word_document2( 94 | reference_docx = "pandoc/templates/ath-manuscript.docx", 95 | pandoc_args = c(paste0("--csl=", csl)), 96 | md_extensions = "+raw_tex+smart-autolink_bare_uris", 97 | toc = FALSE, 98 | number_sections = FALSE 99 | ), 100 | encoding = "UTF-8" 101 | ) 102 | 103 | return(fs::path_rel(out)) 104 | } 105 | 106 | 107 | extract_bib <- function(input_rmd, input_bib, output, ...) { 108 | # Load the document 109 | document <- readLines(input_rmd) 110 | 111 | # Find all the citation-looking things in the document. This picks up e-mail 112 | # addresses (like example@gsu.edu) and it picks up bookdown-style references, 113 | # like \@ref(fig:thing). I filter out the "ref" entries, but leave the e-mail 114 | # addresses because there's too much possible variation there to easily remove 115 | # them. As long as there aren't citation keys like "gsu" or "gmail", it should 116 | # be fine. I also remove pandoc-crossref-style references like @fig:thing, 117 | # @tbl:thing, @eq:thing, and @sec:thing 118 | found_citations <- document %>% 119 | map(~as_tibble(str_match_all(., "@([[:alnum:]:&!~=_+-]+)")[[1]][,2])) %>% 120 | bind_rows() %>% 121 | filter(value != "ref", 122 | !str_starts(value, "fig:"), 123 | !str_starts(value, "tbl:"), 124 | !str_starts(value, "eq:"), 125 | !str_starts(value, "sec:")) %>% 126 | distinct(value) %>% 127 | pull(value) 128 | 129 | # Load the bibliography and convert to a data frame 130 | # When year is the last key in an entry and the closing entry brace is on the 131 | # same line, like `Year = {2006}}`, bib2df() parses the year as "2006}" and 132 | # includes the closing }, which then causes warnings about year not being an 133 | # integer. So here I remove all curly braces from the YEAR column 134 | suppressWarnings(suppressMessages({ 135 | bib_df <- bib2df(input_bib) %>% 136 | mutate(YEAR = str_remove_all(YEAR, "\\{|\\}")) 137 | })) 138 | 139 | # In biblatex, entries can be cross-referenced using the crossref key. When 140 | # including something that's cross-referenced, like an incollection item, the 141 | # containing item should also be extracted 142 | if (any(names(bib_df) == "CROSSREF")) { 143 | crossrefs <- bib_df %>% 144 | filter(BIBTEXKEY %in% found_citations) %>% 145 | filter(!is.na(CROSSREF)) %>% 146 | pull(CROSSREF) 147 | } else { 148 | crossrefs <- as.character(0) 149 | } 150 | 151 | # Write a simplified bibtex file to disk (no BibDesk-specific entries) and only 152 | # include citations that appear in the document or that are cross-referenced 153 | bib_df %>% 154 | filter(BIBTEXKEY %in% c(found_citations, crossrefs)) %>% 155 | select(-starts_with("BDSK"), -RATING, -READ, 156 | -starts_with("DATE."), -KEYWORDS) %>% 157 | arrange(CATEGORY, BIBTEXKEY) %>% 158 | df2bib(output) 159 | } 160 | 161 | 162 | # string::stri_count_words() counts, um, words. That's its whole job. But it 163 | # doesn't count them like Microsoft Word counts them, and academic publishing 164 | # portals tend to care about Word-like counts. For instance, Word considers 165 | # hyphenated words to be one word, while stringr counts them as two (and even 166 | # worse, stringi counts / as word boundaries, so URLs can severely inflate your 167 | # word count). 168 | # 169 | # Also, academic writing typically doesn't count the title, abstract, table 170 | # text, figure captions, or equations as words in the manuscript (and it 171 | # SHOULDN'T count bibliographies, but it always seems to ugh). 172 | # 173 | # This parses the rendered HTML, removes extra elements, adjusts the text so 174 | # that stringi treats it more like Word, and then finally provides a more 175 | # accurate word count. 176 | count_words <- function(html) { 177 | # Read the HTML file 178 | ms_raw <- read_html(html) 179 | 180 | # Extract just the article, ignoring title, abstract, etc. 181 | ms <- ms_raw %>% 182 | html_nodes("article") 183 | 184 | # Get rid of figures, tables, and math 185 | xml_remove(ms %>% html_nodes("figure")) 186 | xml_remove(ms %>% html_nodes("table")) 187 | xml_remove(ms %>% html_nodes(".display")) # Block math 188 | xml_replace(ms %>% html_nodes(".inline"), read_xml("MATH")) %>% 189 | invisible() 190 | 191 | # Go through each child element in the article and extract it 192 | ms_cleaned_list <- map(html_children(ms), ~ { 193 | .x %>% 194 | html_text(trim = TRUE) %>% 195 | # ICU counts hyphenated words as multiple words, so replace - with DASH 196 | str_replace_all("\\-", "DASH") %>% 197 | # ICU also counts / as multiple words, so URLs go crazy. Replace / with SLASH 198 | str_replace_all("\\/", "SLASH") %>% 199 | # ICU *also* counts [things] in brackets multiple times, so kill those too 200 | str_replace_all("\\[|\\]", "") %>% 201 | # Other things to ignore 202 | str_replace_all("×", "") 203 | }) 204 | 205 | # Get count of words! (close enough to Word) 206 | final_count <- sum(stri_count_words(ms_cleaned_list)) 207 | 208 | class(final_count) <- c("wordcount", "numeric") 209 | 210 | return(final_count) 211 | } 212 | 213 | print.wordcount <- function(x) { 214 | cat(scales::comma(x), "words in manuscript\n") 215 | } 216 | -------------------------------------------------------------------------------- /R/funs_notebook.R: -------------------------------------------------------------------------------- 1 | # This is adapted from TJ Mahr's {notestar} 2 | # (https://github.com/tjmahr/notestar/blob/main/R/tar-notebook.R). 3 | # 4 | # He did all the hard work figuring out how to dynamically generate targets 5 | # based on a bunch of files, while also checking for targets dependencies with 6 | # tarchetypes::tar_knitr_deps(), based on this issue in {tarchetypes}: 7 | # https://github.com/ropensci/tarchetypes/issues/23 8 | # 9 | # I just adapted it for an R Markdown website 10 | 11 | notebook_rmd_collate <- function(dir_notebook = "analysis") { 12 | index <- file.path(dir_notebook, "index.Rmd") 13 | posts <- list.files( 14 | path = dir_notebook, 15 | pattern = ".*[^index].Rmd", 16 | full.names = TRUE 17 | ) 18 | c(index, posts) 19 | } 20 | 21 | rmd_to_html <- function(x) gsub("[.]Rmd$", ".html", x = x) 22 | html_to_rmd <- function(x) gsub("[.]html$", ".Rmd", x = x) 23 | 24 | lazy_list <- function(...) { 25 | q <- rlang::enexprs(..., .named = TRUE, .check_assign = TRUE) 26 | data <- list() 27 | for (x in seq_along(q)) { 28 | data[names(q[x])] <- list(rlang::eval_tidy(q[[x]], data = data)) 29 | } 30 | data 31 | } 32 | 33 | knit_notebook_page <- function(rmd_in, html_out) { 34 | rmarkdown::render_site(rmd_in, encoding = "UTF-8") 35 | html_out 36 | } 37 | 38 | tar_notebook_pages <- function( 39 | dir_notebook = "analysis", 40 | dir_html = "analysis/_site", 41 | yaml_config = "analysis/_site.yml" 42 | ) { 43 | 44 | rmds <- notebook_rmd_collate(dir_notebook) 45 | 46 | values <- lazy_list( 47 | rmd_file = !! rmds, 48 | rmd_page = basename(.data$rmd_file), 49 | sym_rmd_page = rlang::syms(.data$rmd_page), 50 | rmd_deps = lapply(.data$rmd_file, tarchetypes::tar_knitr_deps_expr), 51 | html_page = rmd_to_html(.data$rmd_page), 52 | html_file = file.path(!! dir_html, .data$html_page) 53 | ) 54 | 55 | list( 56 | # Add _site.yml as a dependency 57 | # Have to use tar_target_raw() instead of tar_target() so that yaml_config is usable 58 | tar_target_raw("site_yml", yaml_config, format = "file"), 59 | 60 | # Prepare targets for each of the notebook pages 61 | tarchetypes::tar_eval_raw( 62 | quote( 63 | targets::tar_target(rmd_page, c(rmd_file, site_yml), format = "file") 64 | ), 65 | values = values 66 | ), 67 | 68 | tarchetypes::tar_eval_raw( 69 | quote( 70 | targets::tar_target( 71 | html_page, 72 | command = { 73 | rmd_deps 74 | sym_rmd_page 75 | knit_notebook_page(rmd_file, html_file); 76 | html_file 77 | }, 78 | format = "file" 79 | ) 80 | ), 81 | values = values 82 | ) 83 | ) 84 | } 85 | 86 | copy_notebook_supporting_files <- function(rmd, ...) { 87 | rmarkdown::render_site(rmd, encoding = "UTF-8") 88 | } 89 | -------------------------------------------------------------------------------- /R/funs_plots.R: -------------------------------------------------------------------------------- 1 | library(patchwork) 2 | library(scales) 3 | 4 | plot_income <- function(grey = FALSE) { 5 | if (grey) { 6 | color_pairs <- c("grey30", "grey80") 7 | } else { 8 | color_pairs <- clrs_ngo_pairs[[1]] 9 | } 10 | 11 | plot_income_issue <- sim_final %>% 12 | group_by(org_issue, persona_income) %>% 13 | summarize(avg_share = mean(share)) %>% 14 | mutate(facet = "Issue area") %>% 15 | ggplot(aes(y = fct_rev(str_wrap_factor(org_issue, 15)), 16 | x = avg_share, color = fct_rev(persona_income))) + 17 | geom_pointrange(size = 0.75, fatten = 1.5, 18 | aes(xmin = 0, xmax = ..x..), position = position_dodge(width = 0.5)) + 19 | scale_x_continuous(labels = percent_format(accuracy = 1), expand = expansion(add = c(0, 0.002)), 20 | breaks = seq(0, 0.06, 0.02)) + 21 | scale_color_manual(values = color_pairs, guide = FALSE) + 22 | coord_cartesian(xlim = c(0, 0.06)) + 23 | labs(x = "Average donation share", y = NULL, color = NULL) + 24 | facet_wrap(vars(facet)) + 25 | theme_ngo() + 26 | theme(panel.grid.major.y = element_blank()) 27 | 28 | plot_income_funding <- sim_final %>% 29 | group_by(org_funding, persona_income) %>% 30 | summarize(avg_share = mean(share)) %>% 31 | mutate(facet = "Funding sources") %>% 32 | ggplot(aes(y = fct_rev(str_wrap_factor(org_funding, 10)), 33 | x = avg_share, color = fct_rev(persona_income))) + 34 | geom_pointrange(size = 0.75, fatten = 1.5, 35 | aes(xmin = 0, xmax = ..x..), position = position_dodge(width = 0.5)) + 36 | scale_x_continuous(labels = percent_format(accuracy = 1), expand = expansion(add = c(0, 0.002))) + 37 | coord_cartesian(xlim = c(0, 0.06)) + 38 | scale_color_manual(values = color_pairs, guide = FALSE) + 39 | labs(x = "Average donation share", y = NULL, color = NULL) + 40 | facet_wrap(vars(facet)) + 41 | theme_ngo() + 42 | theme(panel.grid.major.y = element_blank()) 43 | 44 | plot_income_relationship <- sim_final %>% 45 | mutate(persona_income = fct_recode(persona_income, 46 | "< $61,372/year" = "Lower income", 47 | "> $61,372/year" = "Higher income")) %>% 48 | group_by(org_relationship, persona_income) %>% 49 | summarize(avg_share = mean(share)) %>% 50 | mutate(facet = "Relationship with host government") %>% 51 | ggplot(aes(y = fct_rev(str_wrap_factor(org_relationship, 10)), 52 | x = avg_share, color = fct_rev(persona_income))) + 53 | geom_pointrange(size = 0.75, fatten = 1.5, 54 | aes(xmin = 0, xmax = ..x..), position = position_dodge(width = 0.5)) + 55 | scale_x_continuous(labels = percent_format(accuracy = 1), expand = expansion(add = c(0, 0.003))) + 56 | coord_cartesian(xlim = c(0, 0.1)) + 57 | scale_color_manual(values = color_pairs, 58 | guide = guide_legend(reverse = TRUE, nrow = 1, 59 | override.aes = list(size = 0.25, 60 | linetype = 0))) + 61 | labs(x = "Average donation share", y = NULL, color = NULL) + 62 | facet_wrap(vars(str_wrap(facet, 50))) + 63 | theme_ngo() + 64 | theme(panel.grid.major.y = element_blank(), 65 | legend.key.width = unit(0.5, "lines")) 66 | 67 | plot_income_relationship_extreme <- sim_excel_final %>% 68 | mutate(persona_income = fct_recode(persona_income, 69 | "$50,000/year" = "Lower income", 70 | "$100,000/year" = "Higher income"), 71 | org_relationship = fct_recode(org_relationship, 72 | "Under crackdown" = "Crackdown")) %>% 73 | group_by(org_relationship, persona_income) %>% 74 | summarize(avg_share = mean(share)) %>% 75 | mutate(facet = "Relationship with host government") %>% 76 | ggplot(aes(y = fct_rev(str_wrap_factor(org_relationship, 10)), 77 | x = avg_share, color = fct_rev(persona_income))) + 78 | geom_pointrange(size = 0.75, fatten = 1.5, linetype = "21", pch = 2, 79 | aes(xmin = 0, xmax = ..x..), position = position_dodge(width = 0.5)) + 80 | scale_x_continuous(labels = percent_format(accuracy = 1), expand = expansion(add = c(0, 0.002))) + 81 | coord_cartesian(xlim = c(0, 0.1)) + 82 | scale_color_manual(values = color_pairs, 83 | guide = guide_legend(reverse = TRUE, nrow = 1, 84 | override.aes = list(size = 0.25, 85 | linetype = 0))) + 86 | labs(x = "Average donation share", y = NULL, color = NULL) + 87 | facet_wrap(vars(str_wrap(facet, 50))) + 88 | theme_ngo() + 89 | theme(panel.grid.major.y = element_blank(), 90 | legend.key.width = unit(0.5, "lines")) 91 | 92 | plot_income <- ((plot_income_issue + labs(x = NULL)) + 93 | (plot_income_funding + labs(x = NULL))) / 94 | (plot_income_relationship + plot_income_relationship_extreme) 95 | 96 | plot_income 97 | } 98 | -------------------------------------------------------------------------------- /R/funs_survey.R: -------------------------------------------------------------------------------- 1 | create_sample_summary <- function(survey_results) { 2 | vars_to_summarize <- tribble( 3 | ~category, ~variable, ~clean_name, 4 | "Demographics", "Q5.12", "Gender", 5 | "Demographics", "Q5.17", "Age", 6 | "Demographics", "Q5.13", "Marital status", 7 | "Demographics", "Q5.14", "Education", 8 | "Demographics", "Q5.15", "Income", 9 | "Attitudes toward charity", "Q2.5", "Frequency of donating to charity", 10 | "Attitudes toward charity", "Q2.6", "Amount of donations to charity last year", 11 | "Attitudes toward charity", "Q2.7_f", "Importance of trusting charities", 12 | "Attitudes toward charity", "Q2.8_f", "Level of trust in charities", 13 | "Attitudes toward charity", "Q2.10", "Frequency of volunteering", 14 | "Politics, ideology, and religion", "Q2.1", "Frequency of following national news", 15 | "Politics, ideology, and religion", "Q5.7", "Traveled to a developing country", 16 | "Politics, ideology, and religion", "Q5.1", "Voted in last election", 17 | "Politics, ideology, and religion", "Q5.6_f", "Trust in political institutions and the state", 18 | "Politics, ideology, and religion", "Q5.2_f", "Political ideology", 19 | "Politics, ideology, and religion", "Q5.4", "Involvement in activist causes", 20 | "Politics, ideology, and religion", "Q5.8", "Frequency of attending religious services", 21 | "Politics, ideology, and religion", "Q5.9", "Importance of religion" 22 | ) 23 | 24 | summarize_factor <- function(x) { 25 | output <- table(x) %>% 26 | as_tibble() %>% 27 | magrittr::set_colnames(., c("level", "count")) %>% 28 | mutate(level = factor(level, levels = levels(x))) %>% 29 | mutate(prop = count / sum(count), 30 | nice_prop = scales::percent(prop)) 31 | 32 | return(list(output)) 33 | } 34 | 35 | participant_summary <- survey_results %>% 36 | select(one_of(vars_to_summarize$variable)) %>% 37 | summarize(across(everything(), summarize_factor)) %>% 38 | pivot_longer(cols = everything(), names_to = "variable", values_to = "details") %>% 39 | left_join(vars_to_summarize, by = "variable") %>% 40 | unnest(details) %>% 41 | mutate(level = as.character(level)) %>% 42 | mutate(level = case_when( 43 | variable == "Q2.7_f" & level == "1" ~ "1 (not important)", 44 | variable == "Q2.7_f" & level == "7" ~ "7 (important)", 45 | variable == "Q2.8_f" & level == "1" ~ "1 (no trust)", 46 | variable == "Q2.8_f" & level == "7" ~ "7 (complete trust)", 47 | variable == "Q5.6_f" & level == "1" ~ "1 (no trust)", 48 | variable == "Q5.6_f" & level == "7" ~ "7 (complete trust)", 49 | variable == "Q5.2_f" & level == "1" ~ "1 (extremely liberal)", 50 | variable == "Q5.2_f" & level == "7" ~ "7 (extremely conservative)", 51 | variable == "Q5.15" & level == "Less than median" ~ "Less than 2017 national median ($61,372)", 52 | variable == "Q5.17" & level == "Less than median" ~ "Less than 2017 national median (36)", 53 | TRUE ~ level 54 | )) %>% 55 | mutate(category = fct_inorder(category, ordered = TRUE)) 56 | 57 | return(participant_summary) 58 | } 59 | -------------------------------------------------------------------------------- /R/graphics.R: -------------------------------------------------------------------------------- 1 | # ggplot themes ----------------------------------------------------------- 2 | 3 | #' theme_ngo 4 | #' 5 | #' A custom ggplot2 theme used throughout this project 6 | #' 7 | #' @param base_size base font size (default is 11) 8 | #' @param base_family base font family (default is IBM Plex Sans Condensed) 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' library(ggplot2) 14 | #' 15 | #' ggplot(mtcars, aes(x = mpg, y = wt)) + 16 | #' geom_point() + 17 | #' theme_ngo() 18 | theme_ngo <- function(base_size = 9, base_family = "IBM Plex Sans Condensed") { 19 | ret <- theme_bw(base_size, base_family) + 20 | theme(plot.title = element_text(size = rel(1.4), face = "bold", 21 | family = "IBM Plex Sans Condensed"), 22 | plot.subtitle = element_text(size = rel(1), face = "plain", 23 | family = "IBM Plex Sans Condensed Light"), 24 | plot.caption = element_text(size = rel(0.8), color = "grey50", face = "plain", 25 | family = "IBM Plex Sans Condensed Light", 26 | margin = margin(t = 10)), 27 | panel.border = element_rect(color = "grey50", fill = NA, size = 0.15), 28 | panel.spacing = unit(1, "lines"), 29 | panel.grid.minor = element_blank(), 30 | strip.text = element_text(size = rel(0.9), hjust = 0, 31 | family = "IBM Plex Sans Condensed", face = "bold"), 32 | strip.background = element_rect(fill = "#ffffff", colour = NA), 33 | axis.ticks = element_blank(), 34 | axis.title = element_text(family = "IBM Plex Sans Condensed SemiBold", face = "plain", 35 | size = rel(0.8)), 36 | axis.title.x = element_text(margin = margin(t = 5)), 37 | axis.text = element_text(family = "IBM Plex Sans Condensed Light", face = "plain"), 38 | legend.key = element_blank(), 39 | legend.text = element_text(size = rel(0.75), 40 | family = "IBM Plex Sans Condensed Light", face = "plain"), 41 | legend.spacing = unit(0.1, "lines"), 42 | legend.box.margin = margin(t = -0.5, unit = "lines"), 43 | legend.margin = margin(t = 0), 44 | legend.position = "bottom") 45 | 46 | ret 47 | } 48 | 49 | 50 | # Colors ------------------------------------------------------------------ 51 | 52 | # colors_plasma <- viridisLite::plasma(6, begin = 0, end = 0.85) 53 | # colors_plasma %>% scales::show_col() 54 | # 55 | # colors_viridis <- viridisLite::viridis(6, begin = 0, end = 0.97) 56 | # colors_viridis %>% scales::show_col() 57 | 58 | # colors_viridis <- viridisLite::viridis(4, option = "viridis") 59 | 60 | # Okabe and Ito (2008) colorblind-safe qualitative palette: https://jfly.uni-koeln.de/color/ 61 | # See also https://clauswilke.com/dataviz/color-pitfalls.html 62 | clrs_okabe_ito <- list(orange = "#E69F00", 63 | sky_blue = colorspace::lighten("#56B4E9", 0.25), 64 | bluish_green = "#009E73", 65 | yellow = "#F0E442", 66 | blue = colorspace::lighten("#0072B2", 0.25), 67 | vermilion = "#D55E00", 68 | reddish_purple = "#CC79A7", 69 | black = "#000000") 70 | 71 | clrs_ngo_pairs <- list(c(clrs_okabe_ito[[1]], clrs_okabe_ito[[2]]), 72 | c(clrs_okabe_ito[[3]], clrs_okabe_ito[[4]]), 73 | c(clrs_okabe_ito[[5]], clrs_okabe_ito[[6]]), 74 | c(clrs_okabe_ito[[7]], clrs_okabe_ito[[8]])) 75 | 76 | 77 | # Helper functions -------------------------------------------------------- 78 | 79 | # Wrap factor levels 80 | # via Hadley: https://github.com/tidyverse/stringr/issues/107#issuecomment-233723948 81 | str_wrap_factor <- function(x, ...) { 82 | levels(x) <- str_wrap(levels(x), ...) 83 | x 84 | } 85 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, echo = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "README-" 12 | ) 13 | 14 | Title <- "Who Cares About Crackdowns? Exploring the Role of Trust in Individual Philanthropy" 15 | Authors <- "Suparna Chaudhry, Marc Dotson, and Andrew Heiss" 16 | Year <- "2021" 17 | ``` 18 | 19 | # `r Title` 20 | 21 | [Suparna Chaudhry](http://www.suparnachaudhry.com/) • Department of International Affairs • Lewis & Clark College 22 | [Marc Dotson](https://marriottschool.byu.edu/directory/details?id=50683) • Marriott School of Business • Brigham Young University 23 | [Andrew Heiss](https://www.andrewheiss.com/) • Andrew Young School of Policy Studies • Georgia State University 24 | 25 | --- 26 | 27 | [![Global Policy DOI](https://img.shields.io/badge/Global%20Policy%20DOI-10.1111%2F1758--5899.12984-brightgreen)](https://doi.org/10.1111/1758-5899.12984) [![OSF DOI](https://img.shields.io/badge/OSF-10.17605%2FOSF.IO%2FSM5EW-blue)](https://doi.org/10.17605/OSF.IO/SM5EW) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4064840.svg)](https://doi.org/10.5281/zenodo.4064840) 28 | 29 | > `r Authors`. `r Year`. ["`r Title`,"](https://doi.org/10.17605/OSF.IO/SM5EW) *Global Policy* (forthcoming), doi: [`10.1111/1758-5899.12984`](https://doi.org/10.1111/1758-5899.12984) 30 | 31 | **All this project's materials are free and open:** 32 | 33 | - [Download the data](#data) 34 | - [See the analysis notebook website](https://stats.andrewheiss.com/who-cares-about-crackdowns/) 35 | 36 | ![Preregistered](img/preregistered_large_color.png)   ![Open data](img/data_large_color.png)   ![Open](img/materials_large_color.png) 37 | 38 | --- 39 | 40 | ## Abstract 41 | 42 | The phenomenon of closing civic space has adversely impacted INGO funding. We argue that individual private donors can be important in sustaining the operations of INGOs working in repressive contexts. Individual donors do not use the same performance-based metrics as official aid donors. Rather, trust can be an important component of individual donor support for nonprofits working towards difficult goals. How does trust in charitable organizations influence individuals' preferences to donate, especially when these groups face crackdown? Using a simulated market for philanthropic donations based on data from a nationally representative sample of individuals in the United States who regularly donate to charity, we find that trust in INGOs matters substantially in shaping donor preferences. Donor profiles with high levels of social trust are likely to donate to INGOs with friendly relationships with host governments. This support holds steady if INGOs face criticism or crackdown. In contrast, donor profiles with lower levels of social trust prefer to donate to organizations that do not face criticism or crackdown abroad. The global crackdown on NGOs may thus possibly sour NGOs' least trusting individual donors. Our findings have practical implications for INGOs raising funds from individuals amid closing civic space. 43 | 44 | --- 45 | 46 | This repository contains the data and code for our paper. Our preprint is online here: 47 | 48 | > `r Authors`. `r Year`. "`r Title`". Online at 49 | 50 | The paper is published at *Global Policy*: 51 | 52 | > `r Authors`. `r Year`. ["`r Title`,"](https://doi.org/10.17605/OSF.IO/SM5EW) *Global Policy* (forthcoming), doi: [`10.1111/1758-5899.12984`](https://doi.org/10.1111/1758-5899.12984) 53 | 54 | ## How to download and replicate 55 | 56 | You can either [download the compendium as a ZIP file](/archive/master.zip) or use GitHub to clone or fork the compendium repository (see the green "Clone or download" button at the top of the GitHub page). 57 | 58 | We use the [**renv** package](https://rstudio.github.io/renv/articles/renv.html) to create a stable version-specific library of packages, and we use the [**targets** package](https://docs.ropensci.org/targets/) to manage all file dependencies and run the analysis. To reproduce the findings and re-run the analysis, do the following: 59 | 60 | 1. Download and install these fonts: 61 | - [IBM Plex Sans](https://fonts.google.com/specimen/IBM+Plex+Sans) 62 | - [IBM Plex Sans Condensed](https://fonts.google.com/specimen/IBM+Plex+Sans+Condensed) 63 | - [Lora](https://fonts.google.com/specimen/Lora) 64 | - [Linux Libertine O](https://www.cufonfonts.com/font/linux-libertine-o) (also [here](https://sourceforge.net/projects/linuxlibertine/)) 65 | - [Libertinus Math](https://github.com/alerque/libertinus) 66 | - [Source Sans Pro](https://fonts.google.com/specimen/Source+Sans+Pro) 67 | - [InconsolataGo](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/InconsolataGo) 68 | 2. [Install R](https://cloud.r-project.org/) (and preferably [RStudio](https://www.rstudio.com/products/rstudio/download/#download)). 69 | - If you're using macOS, [install XQuartz too](https://www.xquartz.org/), so that you have access to the Cairo graphics library 70 | 3. Open `whocares.Rproj` to open an [RStudio Project](https://r4ds.had.co.nz/workflow-projects.html). 71 | 4. Make sure you have a working installation of LaTeX: 72 | - *Easy-and-recommended way*: Install the [**tinytex** package](https://yihui.org/tinytex/) by running `install.packages("tinytex")` in the R console, then running `tinytex::install_tinytex()` 73 | - *Easy-but-requires-huge-4+-GB-download way*: Download TeX Live ([macOS](http://www.tug.org/mactex/); [Windows](https://miktex.org/)) 74 | 5. If it's not installed already, R *should* try to install the **renv** package when you open the RStudio Project for the first time. If you don't see a message about package installation, install it yourself by running `install.packages("renv")` in the R console. 75 | 6. Run `renv::restore()` in the R console to install all the required packages for this project. 76 | 7. Run `targets::tar_make()` in the R console to automatically download all data files, process the data, run the analysis, and compile the paper and appendix. 77 | 78 | Running `targets::tar_make()` will create several helpful outputs: 79 | 80 | 1. All project data in `data/` 81 | 2. An analysis notebook website in `analysis/_site/index.html` 82 | 3. PDF, HTML, and Word versions of the manuscript in `manuscript/output/` 83 | 84 | 85 | ## Data 86 | 87 | This project includes the following data files: 88 | 89 | - [**`data/raw_data/final_data.rds`**](https://osf.io/n2hwm/): Original results from the Qualtrics survey. This is [hosted at OSF](https://osf.io/n2hwm/) because of its size. Running `targets::tar_make(survey_results_file)` will download the `.rds` file from OSF and place it in `data/raw_data`. The [code for cleaning and processing this data is part of a separate project, "Why Donors Donate"](https://github.com/andrewheiss/why-donors-donate). 90 | - [**`data/derived_data/survey_results.csv`**](data/derived_data/survey_results.csv): CSV version of the survey data. 91 | - [**`data/derived_data/survey_results.yaml`**](data/derived_data/survey_results.yaml): [YAML metadata](https://csvy.org/) describing the syntax of the survey data. 92 | - [**`data/raw_data/posterior_draws/public_political_social_charity_demo.rds`**](https://osf.io/msaz8/): Gamma (Γ) coefficients from our multilevel Bayesian model. This is [hosted at OSF](https://osf.io/msaz8/) because of its size. Running `targets::tar_make(gamma_draws_file)` will download the `.rds` file from OSF and place it in `data/raw_data/posterior_draws`. The [code for running this model is part of a separate project, "Why Donors Donate"](https://github.com/andrewheiss/why-donors-donate). 93 | - [**`data/raw_data/Market Simulator Version 01.xlsx`**](data/raw_data/Market Simulator Version 01.xlsx): An interactive Excel version of the market simulator to help demonstrate the intuition behind all the moving parts of the simulation. 94 | - [**`data/raw_data/data-xextT.csv`**](data/raw_data/data-xextT.csv): Per capita charitable donations in the US (2000–2014), downloaded from the [Datawrapper widget "How much money Americans give away"](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291#xextT) at ["Fewer Americans are giving money to charity but total donations are at record levels anyway"](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291). 95 | - [**`data/raw_data/data-FTjUv.csv`**](data/raw_data/data-FTjUv.csv): Aggregate charitable donations in the US (1977–2017), downloaded from the [Datawrapper widget "Four decades of American charitable giving"](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291#FTjUv) at ["Fewer Americans are giving money to charity but total donations are at record levels anyway"](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291). 96 | 97 | 98 | ## Licenses 99 | 100 | **Text and figures:** All prose and images are licensed under Creative Commons ([CC-BY-4.0](http://creativecommons.org/licenses/by/4.0/)). 101 | 102 | **Code:** All code is licensed under the [MIT License](LICENSE.md). 103 | 104 | 105 | ## Contributions 106 | 107 | We welcome contributions from everyone. Before you get started, please see our [contributor guidelines](CONTRIBUTING.md). Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Who Cares About Crackdowns? Exploring the Role of Trust in Individual Philanthropy 5 | 6 | [Suparna Chaudhry](http://www.suparnachaudhry.com/) • Department of 7 | International Affairs • Lewis & Clark College 8 | [Marc Dotson](https://marriottschool.byu.edu/directory/details?id=50683) 9 | • Marriott School of Business • Brigham Young University 10 | [Andrew Heiss](https://www.andrewheiss.com/) • Andrew Young School of 11 | Policy Studies • Georgia State University 12 | 13 | ------------------------------------------------------------------------ 14 | 15 | [![Global Policy 16 | DOI](https://img.shields.io/badge/Global%20Policy%20DOI-10.1111%2F1758--5899.12984-brightgreen)](https://doi.org/10.1111/1758-5899.12984) 17 | [![OSF 18 | DOI](https://img.shields.io/badge/OSF-10.17605%2FOSF.IO%2FSM5EW-blue)](https://doi.org/10.17605/OSF.IO/SM5EW) 19 | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4064840.svg)](https://doi.org/10.5281/zenodo.4064840) 20 | 21 | > Suparna Chaudhry, Marc Dotson, and Andrew Heiss. 2021. [“Who Cares 22 | > About Crackdowns? Exploring the Role of Trust in Individual 23 | > Philanthropy,”](https://doi.org/10.17605/OSF.IO/SM5EW) *Global Policy* 24 | > (forthcoming), doi: 25 | > [`10.1111/1758-5899.12984`](https://doi.org/10.1111/1758-5899.12984) 26 | 27 | **All this project’s materials are free and open:** 28 | 29 | - [Download the data](#data) 30 | - [See the analysis notebook 31 | website](https://stats.andrewheiss.com/who-cares-about-crackdowns/) 32 | 33 | ![Preregistered](img/preregistered_large_color.png)   ![Open 34 | data](img/data_large_color.png)   ![Open](img/materials_large_color.png) 35 | 36 | ------------------------------------------------------------------------ 37 | 38 | ## Abstract 39 | 40 | The phenomenon of closing civic space has adversely impacted INGO 41 | funding. We argue that individual private donors can be important in 42 | sustaining the operations of INGOs working in repressive contexts. 43 | Individual donors do not use the same performance-based metrics as 44 | official aid donors. Rather, trust can be an important component of 45 | individual donor support for nonprofits working towards difficult goals. 46 | How does trust in charitable organizations influence individuals’ 47 | preferences to donate, especially when these groups face crackdown? 48 | Using a simulated market for philanthropic donations based on data from 49 | a nationally representative sample of individuals in the United States 50 | who regularly donate to charity, we find that trust in INGOs matters 51 | substantially in shaping donor preferences. Donor profiles with high 52 | levels of social trust are likely to donate to INGOs with friendly 53 | relationships with host governments. This support holds steady if INGOs 54 | face criticism or crackdown. In contrast, donor profiles with lower 55 | levels of social trust prefer to donate to organizations that do not 56 | face criticism or crackdown abroad. The global crackdown on NGOs may 57 | thus possibly sour NGOs’ least trusting individual donors. Our findings 58 | have practical implications for INGOs raising funds from individuals 59 | amid closing civic space. 60 | 61 | ------------------------------------------------------------------------ 62 | 63 | This repository contains the data and code for our paper. Our preprint 64 | is online here: 65 | 66 | > Suparna Chaudhry, Marc Dotson, and Andrew Heiss. 2021. “Who Cares 67 | > About Crackdowns? Exploring the Role of Trust in Individual 68 | > Philanthropy”. Online at 69 | 70 | The paper is published at *Global Policy*: 71 | 72 | > Suparna Chaudhry, Marc Dotson, and Andrew Heiss. 2021. [“Who Cares 73 | > About Crackdowns? Exploring the Role of Trust in Individual 74 | > Philanthropy,”](https://doi.org/10.17605/OSF.IO/SM5EW) *Global Policy* 75 | > (forthcoming), doi: 76 | > [`10.1111/1758-5899.12984`](https://doi.org/10.1111/1758-5899.12984) 77 | 78 | ## How to download and replicate 79 | 80 | You can either [download the compendium as a ZIP 81 | file](/archive/master.zip) or use GitHub to clone or fork the compendium 82 | repository (see the green “Clone or download” button at the top of the 83 | GitHub page). 84 | 85 | We use the [**renv** 86 | package](https://rstudio.github.io/renv/articles/renv.html) to create a 87 | stable version-specific library of packages, and we use the [**targets** 88 | package](https://docs.ropensci.org/targets/) to manage all file 89 | dependencies and run the analysis. To reproduce the findings and re-run 90 | the analysis, do the following: 91 | 92 | 1. Download and install these fonts: 93 | - [IBM Plex Sans](https://fonts.google.com/specimen/IBM+Plex+Sans) 94 | - [IBM Plex Sans 95 | Condensed](https://fonts.google.com/specimen/IBM+Plex+Sans+Condensed) 96 | - [Lora](https://fonts.google.com/specimen/Lora) 97 | - [Linux Libertine 98 | O](https://www.cufonfonts.com/font/linux-libertine-o) (also 99 | [here](https://sourceforge.net/projects/linuxlibertine/)) 100 | - [Libertinus Math](https://github.com/alerque/libertinus) 101 | - [Source Sans 102 | Pro](https://fonts.google.com/specimen/Source+Sans+Pro) 103 | - [InconsolataGo](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/InconsolataGo) 104 | 2. [Install R](https://cloud.r-project.org/) (and preferably 105 | [RStudio](https://www.rstudio.com/products/rstudio/download/#download)). 106 | - If you’re using macOS, [install XQuartz 107 | too](https://www.xquartz.org/), so that you have access to the 108 | Cairo graphics library 109 | 3. Open `whocares.Rproj` to open an [RStudio 110 | Project](https://r4ds.had.co.nz/workflow-projects.html). 111 | 4. Make sure you have a working installation of LaTeX: 112 | - *Easy-and-recommended way*: Install the [**tinytex** 113 | package](https://yihui.org/tinytex/) by running 114 | `install.packages("tinytex")` in the R console, then running 115 | `tinytex::install_tinytex()` 116 | - *Easy-but-requires-huge-4+-GB-download way*: Download TeX Live 117 | ([macOS](http://www.tug.org/mactex/); 118 | [Windows](https://miktex.org/)) 119 | 5. If it’s not installed already, R *should* try to install the 120 | **renv** package when you open the RStudio Project for the first 121 | time. If you don’t see a message about package installation, install 122 | it yourself by running `install.packages("renv")` in the R console. 123 | 6. Run `renv::restore()` in the R console to install all the required 124 | packages for this project. 125 | 7. Run `targets::tar_make()` in the R console to automatically download 126 | all data files, process the data, run the analysis, and compile the 127 | paper and appendix. 128 | 129 | Running `targets::tar_make()` will create several helpful outputs: 130 | 131 | 1. All project data in `data/` 132 | 2. An analysis notebook website in `analysis/_site/index.html` 133 | 3. PDF, HTML, and Word versions of the manuscript in 134 | `manuscript/output/` 135 | 136 | ## Data 137 | 138 | This project includes the following data files: 139 | 140 | - [**`data/raw_data/final_data.rds`**](https://osf.io/n2hwm/): 141 | Original results from the Qualtrics survey. This is [hosted at 142 | OSF](https://osf.io/n2hwm/) because of its size. Running 143 | `targets::tar_make(survey_results_file)` will download the `.rds` 144 | file from OSF and place it in `data/raw_data`. The [code for 145 | cleaning and processing this data is part of a separate project, 146 | “Why Donors 147 | Donate”](https://github.com/andrewheiss/why-donors-donate). 148 | - [**`data/derived_data/survey_results.csv`**](data/derived_data/survey_results.csv): 149 | CSV version of the survey data. 150 | - [**`data/derived_data/survey_results.yaml`**](data/derived_data/survey_results.yaml): 151 | [YAML metadata](https://csvy.org/) describing the syntax of the 152 | survey data. 153 | - [**`data/raw_data/posterior_draws/public_political_social_charity_demo.rds`**](https://osf.io/msaz8/): 154 | Gamma (Γ) coefficients from our multilevel Bayesian model. This is 155 | [hosted at OSF](https://osf.io/msaz8/) because of its size. Running 156 | `targets::tar_make(gamma_draws_file)` will download the `.rds` file 157 | from OSF and place it in `data/raw_data/posterior_draws`. The [code 158 | for running this model is part of a separate project, “Why Donors 159 | Donate”](https://github.com/andrewheiss/why-donors-donate). 160 | - [**`data/raw_data/Market Simulator Version 01.xlsx`**](data/raw_data/Market%20Simulator%20Version%2001.xlsx): 161 | An interactive Excel version of the market simulator to help 162 | demonstrate the intuition behind all the moving parts of the 163 | simulation. 164 | - [**`data/raw_data/data-xextT.csv`**](data/raw_data/data-xextT.csv): 165 | Per capita charitable donations in the US (2000–2014), downloaded 166 | from the [Datawrapper widget “How much money Americans give 167 | away”](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291#xextT) 168 | at [“Fewer Americans are giving money to charity but total donations 169 | are at record levels 170 | anyway”](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291). 171 | - [**`data/raw_data/data-FTjUv.csv`**](data/raw_data/data-FTjUv.csv): 172 | Aggregate charitable donations in the US (1977–2017), downloaded 173 | from the [Datawrapper widget “Four decades of American charitable 174 | giving”](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291#FTjUv) 175 | at [“Fewer Americans are giving money to charity but total donations 176 | are at record levels 177 | anyway”](https://theconversation.com/fewer-americans-are-giving-money-to-charity-but-total-donations-are-at-record-levels-anyway-98291). 178 | 179 | ## Licenses 180 | 181 | **Text and figures:** All prose and images are licensed under Creative 182 | Commons ([CC-BY-4.0](http://creativecommons.org/licenses/by/4.0/)). 183 | 184 | **Code:** All code is licensed under the [MIT License](LICENSE.md). 185 | 186 | ## Contributions 187 | 188 | We welcome contributions from everyone. Before you get started, please 189 | see our [contributor guidelines](CONTRIBUTING.md). Please note that this 190 | project is released with a [Contributor Code of Conduct](CONDUCT.md). By 191 | participating in this project you agree to abide by its terms. 192 | -------------------------------------------------------------------------------- /_packages.R: -------------------------------------------------------------------------------- 1 | # Generated by targets::tar_renv(): do not edit by hand 2 | library(bs4Dash) 3 | library(clustermq) 4 | library(fs) 5 | library(future) 6 | library(gt) 7 | library(here) 8 | library(pingr) 9 | library(rstudioapi) 10 | library(scales) 11 | library(shiny) 12 | library(shinycssloaders) 13 | library(shinyWidgets) 14 | library(tidyverse) 15 | library(visNetwork) 16 | library(withr) 17 | -------------------------------------------------------------------------------- /_targets.R: -------------------------------------------------------------------------------- 1 | library(targets) 2 | library(tarchetypes) 3 | library(tibble) 4 | 5 | # General variables 6 | csl <- "pandoc/csl/apa.csl" 7 | bibstyle <- "bibstyle-apa" 8 | 9 | options(tidyverse.quiet = TRUE, 10 | dplyr.summarise.inform = FALSE) 11 | 12 | set.seed(1746) # From random.org 13 | 14 | tar_option_set(packages = c("tidyverse", "here", "fs", "scales", "withr")) 15 | 16 | source("R/funs_data-generation.R") 17 | source("R/funs_survey.R") 18 | source("R/funs_notebook.R") 19 | source("R/funs_knitting.R") 20 | 21 | # here::here() returns an absolute path, which then gets stored in tar_meta and 22 | # becomes computer-specific (i.e. /Users/andrew/Research/blah/thing.Rmd). 23 | # There's no way to get a relative path directly out of here::here(), but 24 | # fs::path_rel() works fine with it (see 25 | # https://github.com/r-lib/here/issues/36#issuecomment-530894167) 26 | here_rel <- function(...) {fs::path_rel(here::here(...))} 27 | 28 | # Pipeline 29 | list( 30 | # Define raw data files 31 | tar_target(excel_simulator_file, 32 | here_rel("data", "raw_data", "Market Simulator Version 01.xlsx"), 33 | format = "file"), 34 | tar_target(gamma_draws_file, 35 | get_from_osf(osf_url = "https://osf.io/msaz8/", 36 | out_dir = here_rel("data", "raw_data", "posterior_draws")), 37 | format = "file"), 38 | tar_target(survey_results_file, 39 | get_from_osf(osf_url = "https://osf.io/n2hwm/", 40 | out_dir = here_rel("data", "raw_data")), 41 | format = "file"), 42 | tar_target(giving_aggregate_file, 43 | here_rel("data", "raw_data", "data-FTjUv.csv")), 44 | tar_target(giving_per_capita_file, 45 | here_rel("data", "raw_data", "data-xextT.csv")), 46 | 47 | # Define helper functions 48 | tar_target(plot_funs, here_rel("R", "graphics.R"), format = "file"), 49 | 50 | # Process and clean data 51 | tar_target(sim_excel_final, process_excel_simulation(excel_simulator_file)), 52 | tar_target(gammas, load_gammas(gamma_draws_file)), 53 | tar_target(personas, build_personas()), 54 | tar_target(orgs, build_orgs()), 55 | tar_target(market_shares, create_predicted_market_shares(gammas, personas, orgs)), 56 | tar_target(sim_final, create_simulation(market_shares, personas, orgs)), 57 | tar_target(survey_results, read_rds(survey_results_file)), 58 | tar_target(survey_csvy, 59 | save_csvy(survey_results, 60 | here_rel("data", "derived_data", "survey_results.csv"), 61 | here_rel("data", "derived_data", "survey_results.yaml")), 62 | format = "file"), 63 | tar_target(participant_summary, create_sample_summary(survey_results)), 64 | tar_target(giving_aggregate, { 65 | read_csv(giving_aggregate_file, col_types = cols()) %>% 66 | mutate(total = `Total donations` * 1000000000) 67 | }), 68 | tar_target(giving_per_capita, read_csv(giving_per_capita_file, col_types = cols())), 69 | 70 | # Render the analysis notebook 71 | tar_notebook_pages(), 72 | 73 | # This is only here to trigger a re-build of the R Markdown website's 74 | # supporting files in `_site`, which copies the files in `output` to 75 | # `_site/output`. I unfortunately haven't found a way to make it so that the 76 | # site building occurs independently of `rmarkdown::render()`, so this is the 77 | # workaround: re-knit index.Rmd 78 | tar_target(supporting_files, 79 | copy_notebook_supporting_files(here_rel("analysis", "index.Rmd"), 80 | main_manuscript, html, 81 | appendix, app_html)), 82 | 83 | # tarchetypes::tar_render() automatically detects target dependencies in Rmd 84 | # files and knits them, but there's no easy way to pass a custom rendering 85 | # script like bookdown::html_document2(), so two things happen here: 86 | # 1. Set a file-based target with tar_target_raw() and use tar_knitr_deps() 87 | # to detect the target dependencies in the Rmd file 88 | # 2. Use a bunch of other file-based targets to actually render the document 89 | # through different custom functions 90 | tar_target(bib_file, 91 | here_rel("manuscript", "bibliography.bib"), 92 | format = "file"), 93 | 94 | tar_target_raw("main_manuscript", here_rel("manuscript", "manuscript.Rmd"), 95 | format = "file", 96 | deps = c("bib_file", 97 | tar_knitr_deps(here_rel("manuscript", "manuscript.Rmd")))), 98 | tar_target(html, 99 | render_html( 100 | input = main_manuscript, 101 | output = here_rel("manuscript", "output", "manuscript.html"), 102 | csl = csl, 103 | bib_file, 104 | support_folder = "output/html-support"), 105 | format = "file"), 106 | tar_target(pdf, 107 | render_pdf( 108 | input = main_manuscript, 109 | output = here_rel("manuscript", "output", "manuscript.pdf"), 110 | bibstyle = bibstyle, 111 | bib_file), 112 | format = "file"), 113 | tar_target(ms_pdf, 114 | render_pdf_ms( 115 | input = main_manuscript, 116 | output = here_rel("manuscript", "output", "manuscript-ms.pdf"), 117 | bibstyle = bibstyle, 118 | bib_file), 119 | format = "file"), 120 | tar_target(docx, 121 | render_docx( 122 | input = main_manuscript, 123 | output = here_rel("manuscript", "output", "manuscript.docx"), 124 | csl = csl, 125 | bib_file), 126 | format = "file"), 127 | tar_target(bib, 128 | extract_bib( 129 | input_rmd = main_manuscript, 130 | input_bib = bib_file, 131 | output = here_rel("manuscript", "output", "extracted-citations.bib")), 132 | format = "file"), 133 | 134 | # Appendix stuff 135 | tar_target_raw("appendix", here_rel("manuscript", "appendix.Rmd"), 136 | format = "file", 137 | deps = c("bib_file", 138 | tar_knitr_deps(here_rel("manuscript", "appendix.Rmd")))), 139 | tar_target(app_html, 140 | render_html( 141 | input = appendix, 142 | output = here_rel("manuscript", "output", "appendix.html"), 143 | csl = csl, 144 | bib_file, 145 | support_folder = "output/html-support"), 146 | format = "file"), 147 | tar_target(app_pdf, 148 | render_pdf( 149 | input = appendix, 150 | output = here_rel("manuscript", "output", "appendix.pdf"), 151 | bibstyle = bibstyle, 152 | bib_file), 153 | format = "file"), 154 | tar_target(app_ms_pdf, 155 | render_pdf_ms( 156 | input = appendix, 157 | output = here_rel("manuscript", "output", "appendix-ms.pdf"), 158 | bibstyle = bibstyle, 159 | bib_file), 160 | format = "file"), 161 | tar_target(app_docx, 162 | render_docx( 163 | input = appendix, 164 | output = here_rel("manuscript", "output", "appendix.docx"), 165 | csl = csl, 166 | bib_file), 167 | format = "file"), 168 | 169 | # Always show a word count 170 | tar_target(word_count, count_words(html)), 171 | tar_force(show_word_count, print(word_count), TRUE), 172 | 173 | # Knit the README 174 | tar_render(readme, here_rel("README.Rmd")) 175 | ) 176 | -------------------------------------------------------------------------------- /analysis/01_clean-generate-data.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Generate and clean simulated data" 3 | author: "Suparna Chaudhry, Marc Dotson, and Andrew Heiss" 4 | date: "Last run: `r format(Sys.time(), '%F')`" 5 | output: 6 | html_document: 7 | code_folding: hide 8 | editor_options: 9 | chunk_output_type: console 10 | --- 11 | 12 | # `targets` pipeline 13 | 14 | Here's the general process for building and running this analysis. This is all done with [the magical **`targets`** package](https://docs.ropensci.org/targets/), which orchestrates all the dependencies automatically. 15 | 16 | ```{r show-targets-pipeline, echo=FALSE} 17 | withr::with_dir(here::here(), { 18 | targets::tar_glimpse() 19 | }) 20 | ``` 21 | 22 | \ 23 | 24 | 25 | # Actual code 26 | 27 | All the simulation and data processing is handled with dataset-specific functions that live in `R/funs_data-generation.R`, which **`targets`** then runs as needed. For the sake of transparency, here's that code: 28 | 29 | ```{r, code=xfun::read_utf8(here::here("R", "funs_data-generation.R")), eval=FALSE, class.source="fold-show"} 30 | ``` 31 | 32 | \ 33 | 34 | 35 | # Original computing environment 36 | 37 | 38 | 39 |
40 | 41 | ```{r show-session-info, echo=TRUE, width=100} 42 | devtools::session_info() 43 | 44 | writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars"))) 45 | ``` 46 | 47 |
48 | -------------------------------------------------------------------------------- /analysis/02_tables.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Tables" 3 | author: "Suparna Chaudhry, Marc Dotson, and Andrew Heiss" 4 | date: "Last run: `r format(Sys.time(), '%F')`" 5 | output: 6 | html_document: 7 | code_folding: hide 8 | editor_options: 9 | chunk_output_type: console 10 | --- 11 | 12 | ```{r setup, include=FALSE} 13 | knitr::opts_chunk$set(fig.retina = 3, 14 | tidy.opts = list(width.cutoff = 120), # For code 15 | options(width = 90), # For output 16 | fig.asp = 0.618, fig.width = 7, 17 | fig.align = "center", out.width = "85%") 18 | 19 | options(dplyr.summarise.inform = FALSE, 20 | knitr.kable.NA = "") 21 | ``` 22 | 23 | ```{r load-libraries-data, message=FALSE, warning=FALSE} 24 | library(tidyverse) 25 | library(targets) 26 | library(kableExtra) 27 | library(glue) 28 | library(scales) 29 | library(janitor) 30 | library(here) 31 | 32 | # Generated via random.org 33 | set.seed(8316) 34 | 35 | # Load data 36 | # Need to use this withr thing because tar_read() and tar_load() need to see the 37 | # _targets folder in the current directory, but this .Rmd file is in a subfolder 38 | withr::with_dir(here::here(), { 39 | tar_load(personas) 40 | tar_load(orgs) 41 | tar_load(sim_final) 42 | tar_load(survey_results) 43 | tar_load(participant_summary) 44 | }) 45 | ``` 46 | 47 | # Organization attributes 48 | 49 | ## All possible conjoint attributes 50 | 51 | ```{r organization-attributes-full} 52 | orgs$org_attributes %>% 53 | select(Organization, `Issue area`, `Organizational practices`, `Funding sources`, `Relationship with government`) %>% 54 | kbl(align = "lllll", 55 | caption = "Organization attributes varied in the experiment") %>% 56 | kable_styling() 57 | ``` 58 | 59 | ## Attributes varied in simulation 60 | 61 | ```{r organization-attributes} 62 | orgs$org_attributes %>% 63 | select(`Issue area`, `Relationship with government`, `Funding`) %>% 64 | kbl(align = "lll", 65 | caption = "Organization attributes varied in the simulation, resulting in 24 hypothetical organizations") %>% 66 | kable_styling() 67 | ``` 68 | 69 | # Persona attributes 70 | 71 | ## Attributes varied in simulation 72 | 73 | ```{r persona-attributes} 74 | personas$persona_attributes %>% 75 | kbl(align = "lll", 76 | caption = "Individual attributes varied in the simulation, resulting in 64 persona profiles") %>% 77 | kable_styling() 78 | ``` 79 | 80 | # Example simulation output 81 | 82 | ```{r example-personas} 83 | example_personas <- c("persona2", "persona63") 84 | 85 | example_persona_details <- sim_final %>% 86 | filter(persona_id %in% example_personas) %>% 87 | select(starts_with("persona")) %>% 88 | slice(1:2) 89 | 90 | example_persona_details %>% 91 | select(-persona_id) %>% 92 | pivot_longer(cols = !persona) %>% 93 | pivot_wider(names_from = "persona", values_from = "value") %>% 94 | select(-name) %>% 95 | kbl(align = "ll", 96 | caption = "Example personas") %>% 97 | kable_styling() 98 | ``` 99 | 100 | ```{r sim-output} 101 | example_persona_results <- sim_final %>% 102 | filter(persona_id %in% example_personas) %>% 103 | mutate(org_funding = str_to_sentence(str_remove(org_funding, "Mostly funded by "))) %>% 104 | mutate(org_clean = glue("{organization}: {org_issue}, {org_funding}, {org_relationship}")) %>% 105 | mutate(persona_desc = recode( 106 | persona_id, 107 | "persona2" = "Lower income high school graduate who rarely attends religious services; liberal who reads and travels; doesn't trust or donate", 108 | "persona63" = "Higher income college graduate who attends religious services; conservative who doesn't read or travel; trusts and donates") 109 | ) %>% 110 | mutate(persona_clean = glue("{persona}: {persona_desc}")) %>% 111 | select(persona_clean, share, org_clean) %>% 112 | pivot_wider(names_from = "persona_clean", values_from = "share") %>% 113 | adorn_totals(where = "row", name = "Total") 114 | 115 | example_persona_results_small <- example_persona_results %>% 116 | slice(c(1, 2, 3, 7, 8, 9, 16, 17, 25)) %>% 117 | mutate(across(where(is.numeric), ~ percent_format(accuracy = 0.1)(.))) %>% 118 | add_row(org_clean = "…", .after = 3) %>% 119 | add_row(org_clean = "…", .after = 7) %>% 120 | add_row(org_clean = "…", .after = 10) %>% 121 | mutate(across(everything(), ~replace_na(., "…"))) %>% 122 | rename(Organization = org_clean) 123 | 124 | example_persona_results_small %>% 125 | mutate(Organization = text_spec(Organization, bold = Organization == "Total")) %>% 126 | kbl(align = "lcc", 127 | caption = "Sample simulation output", 128 | escape = FALSE) %>% 129 | kable_styling() 130 | ``` 131 | 132 | 133 | # Sample details 134 | 135 | ```{r sample-details} 136 | participant_summary %>% 137 | select(Question = clean_name, 138 | Response = level, 139 | N = count, 140 | `%` = nice_prop) %>% 141 | kbl(align = "lllcc", 142 | caption = "Summary of individual respondent characteristics") %>% 143 | pack_rows(index = table(fct_inorder(participant_summary$category))) %>% 144 | collapse_rows(columns = 1, valign = "top") %>% 145 | kable_styling() 146 | ``` 147 | 148 | \ 149 | 150 | # Original computing environment 151 | 152 | 153 | 154 |
155 | 156 | ```{r show-session-info, echo=TRUE, width=100} 157 | devtools::session_info() 158 | 159 | writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars"))) 160 | ``` 161 | 162 |
163 | -------------------------------------------------------------------------------- /analysis/Makefile: -------------------------------------------------------------------------------- 1 | remote_host = cloud 2 | remote_dir = ~/sites/stats/public_html/who-cares-about-crackdowns 3 | remote_dest = $(remote_host):$(remote_dir) 4 | 5 | .PHONY: clean html upload serve 6 | 7 | serve: 8 | Rscript -e "servr::httw(dir = '_site', port = 7000)" 9 | 10 | html: 11 | Rscript -e "rmarkdown::render_site(encoding = 'UTF-8')" 12 | 13 | clean: 14 | Rscript -e "rmarkdown::clean_site()" 15 | 16 | upload: 17 | rsync -crvP --delete _site/ $(remote_dest) 18 | -------------------------------------------------------------------------------- /analysis/_site.yml: -------------------------------------------------------------------------------- 1 | name: who-cares-about-crackdowns 2 | exclude: 3 | - Makefile 4 | - Icon? 5 | navbar: 6 | title: Who Cares About Crackdowns? 7 | type: inverse 8 | right: 9 | - text: Experiment 10 | icon: fas fa-flask 11 | href: experiment.html 12 | - text: Data 13 | icon: fas fa-magic 14 | href: 01_clean-generate-data.html 15 | - text: Tables 16 | icon: fas fa-table 17 | href: 02_tables.html 18 | - text: Figures 19 | icon: fas fa-chart-bar 20 | href: 03_analysis.html 21 | - text: Manuscript 22 | icon: far fa-file-alt 23 | menu: 24 | - text: "PDF" 25 | href: "output/manuscript.pdf" 26 | - text: "Manuscripty PDF" 27 | href: "output/manuscript-ms.pdf" 28 | - text: "HTML" 29 | href: "output/manuscript.html" 30 | - text: "Word" 31 | href: "output/manuscript.docx" 32 | - text: "Citations" 33 | href: "output/extracted-citations.bib" 34 | - text: "Appendix (PDF)" 35 | href: "output/appendix.pdf" 36 | - text: "Appendix (Manuscripty PDF)" 37 | href: "output/appendix-ms.pdf" 38 | - text: "Appendix (HTML)" 39 | href: "output/appendix.html" 40 | - icon: fab fa-github 41 | href: https://github.com/andrewheiss/who-cares-about-crackdown 42 | output: 43 | html_document: 44 | theme: journal 45 | css: html/fixes.css 46 | include: 47 | after_body: html/footer.html 48 | highlight: pygments 49 | code_folding: show 50 | code_download: yes 51 | toc: yes 52 | toc_float: 53 | collapsed: no 54 | smooth_scroll: yes 55 | toc_depth: 4 56 | fig_height: 4 57 | fig_width: 6 58 | lib_dir: site_libs 59 | self_contained: no 60 | output_dir: _site 61 | new_session: true 62 | -------------------------------------------------------------------------------- /analysis/experiment.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Experiment" 3 | author: "Suparna Chaudhry, Marc Dotson, and Andrew Heiss" 4 | date: "Last run: `r format(Sys.time(), '%F')`" 5 | output: 6 | html_document: 7 | code_folding: hide 8 | editor_options: 9 | chunk_output_type: console 10 | --- 11 | 12 | # Description 13 | 14 | This survey was hosted on [Qualtrics](https://www.qualtrics.com) and participants were recruited through [Centiment](https://www.centiment.co/). 15 | 16 | # Survey experiment {.survey} 17 | 18 | ```{r child = "text/experiment.md"} 19 | ``` 20 | -------------------------------------------------------------------------------- /analysis/files/byu-irb-approval.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/analysis/files/byu-irb-approval.pdf -------------------------------------------------------------------------------- /analysis/files/cnu-irb-approval.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/analysis/files/cnu-irb-approval.pdf -------------------------------------------------------------------------------- /analysis/files/gsu-irb-approval.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/analysis/files/gsu-irb-approval.pdf -------------------------------------------------------------------------------- /analysis/html/fixes.css: -------------------------------------------------------------------------------- 1 | .pull-left { 2 | padding-right: 15px; 3 | } 4 | 5 | .pull-right { 6 | padding-left: 15px; 7 | } 8 | 9 | .center { 10 | margin: 0 auto; 11 | } 12 | 13 | .footer { 14 | margin-top: 4em; 15 | font-size: 0.8em; 16 | } 17 | 18 | blockquote { 19 | font-size: 1em; 20 | margin-left: 2em; 21 | margin-right: 2em; 22 | } 23 | 24 | pre { 25 | font-size: 90%; 26 | } 27 | 28 | .datatables { 29 | margin-bottom: 10.5px; 30 | } 31 | 32 | /* These overrides are necessary because pandoc now creates actual sections instead of
, but the Bootstrap template still looks for classes named section. */ 33 | section h1, section h2, section h3, section h4, section h5, section h6 { 34 | padding-top: 50px; 35 | margin-top: -50px; 36 | } 37 | 38 | /* These overrides are necessary because of the fixed navbar in Bootstrap. The template inserts CSS in the that adds top-margin: -50px and top-padding: 50px to allow anchored links to show up correctly. But doing that also kills the space before the headings, which is dumb. So here I add 21px/10.5px (the original amounts) of top padding for each heading, on top of the 65px for anchor jumping. */ 39 | section h1, section h2, section h3 { 40 | padding-top: 71px !important; 41 | } 42 | 43 | section h4, section h5, section h6 { 44 | padding-top: 60.5px !important; 45 | } 46 | 47 | /* Don't add first line indent to TOC entries */ 48 | .tocify-header { 49 | text-indent: initial; 50 | } 51 | -------------------------------------------------------------------------------- /analysis/html/footer.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /analysis/index.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Who Cares About Crackdowns? Exploring the Role of Trust in Individual Philanthropy" 3 | author: "Suparna Chaudhry, Marc Dotson, and Andrew Heiss" 4 | date: "Last run: `r format(Sys.time(), '%F')`" 5 | --- 6 | 7 | ## Abstract 8 | 9 | The phenomenon of closing civic space has adversely impacted INGO funding. We argue that individual private donors can be important in sustaining the operations of INGOs working in repressive contexts. Individual donors do not use the same performance-based metrics as official aid donors. Rather, trust can be an important component of individual donor support for nonprofits working towards difficult goals. How does trust in charitable organizations influence individuals' preferences to donate, especially when these groups face crackdown? Using a simulated market for philanthropic donations based on data from a nationally representative sample of individuals in the United States who regularly donate to charity, we find that trust in INGOs matters substantially in shaping donor preferences. Donor profiles with high levels of social trust are likely to donate to INGOs with friendly relationships with host governments. This support holds steady if INGOs face criticism or crackdown. In contrast, donor profiles with lower levels of social trust prefer to donate to organizations that do not face criticism or crackdown abroad. The global crackdown on NGOs may thus possibly sour NGOs' least trusting individual donors. Our findings have practical implications for INGOs raising funds from individuals amid closing civic space. 10 | -------------------------------------------------------------------------------- /analysis/output: -------------------------------------------------------------------------------- 1 | ../manuscript/output -------------------------------------------------------------------------------- /analysis/text/experiment.md: -------------------------------------------------------------------------------- 1 | ## Consent 2 | 3 | ***Q1.1***: You have been invited to participate in an academic research survey about international nongovernmental organizations. This study is being conducted by Suparna Chaudhry from Christopher Newport University and Andrew Heiss and Marc Dotson from Brigham Young University. If you qualify to complete the survey, it should take about **10 minutes** to complete. 4 | 5 | Your participation in this study is entirely voluntary and you are free to skip any question or withdraw from the experiment at any time. You will not be asked to provide any personal information, and your answers will remain anonymous. There are no reasonably foreseeable risks or discomforts associated with participating in this study. **There will be questions designed to check that you're paying attention to the details of the experiment. If you answer these incorrectly, the survey will end early and you may not receive compensation.** 6 | 7 | You will receive no direct benefits from participating in this research study. 8 | 9 | If you have any questions at any time about the study or the procedures, you can contact Suparna Chaudhry (suparna.chaudhry@cnu.edu; Reiff Center for Human Rights and Conflict Resolution, Christopher Newport University, Newport News, VA 23606) or Andrew Heiss (andrew_heiss@byu.edu; Romney Institute of Public Management, Brigham Young University, Provo, UT 84602). This research has been reviewed by the Institutional Review Board (IRB) at Christopher Newport University (757-594-7461; IRB@cnu.edu) and the IRB administrator at Brigham Young University (801-422-1461; irb@byu.edu). 10 | 11 | By clicking "Yes" below you are indicating that you are at least 18 years old, have read and understood this consent form and agree to participate in this research study. Please print a copy of this page for your records. 12 | 13 | I have read the above information, and I consent to take part in the study. 14 | 15 | : Single answer 16 | 17 | - Yes 18 | - No 19 | 20 | **Terminate if Q1.1 == "No"** 21 | 22 | --- 23 | 24 | ## First demographic section 25 | 26 | *Q2.1*: How often do you follow national news? 27 | 28 | : Single answer 29 | 30 | - Multiple times a day 31 | - Every day 32 | - Once a week 33 | - Hardly ever 34 | - Never 35 | 36 | *Q2.2*: How often do you follow international news? 37 | 38 | : Single answer 39 | 40 | - Always 41 | - Sometimes 42 | - Never 43 | 44 | *Q2.3*: Which mediums do you use to follow news? (Select all that apply.) 45 | 46 | : Multiple answers allowed 47 | 48 | - TV 49 | - Print 50 | - Online (excluding social media) 51 | - Social media 52 | - Radio 53 | - Email newsletters 54 | - News app 55 | 56 | *Q2.4*: Some people seem to follow what's going on in government and public affairs most of the time, whether there's an election going on or not. Others aren't that interested. How often would you say you follow what's going on in government and public affairs? 57 | 58 | : Single answer 59 | 60 | - Most of the time 61 | - Some of the time 62 | - Only now and then 63 | - Hardly at all 64 | 65 | *Q2.5*: How often do you donate to charity (with either cash or in-kind)? 66 | 67 | : Single answer 68 | 69 | - Once a week 70 | - Once a month 71 | - Once every three months 72 | - Once every six months 73 | - Once a year 74 | - Once every few years 75 | - Never 76 | 77 | **Terminate if Q2.5 == "Once every few years" OR Q2.5 == "Never"** 78 | 79 | *Q2.6*: How much did you donate to charity last year? 80 | 81 | : Single answer 82 | 83 | - \$1 to \$49 84 | - \$50 to \$99 85 | - \$100 to \$499 86 | - \$500 to \$999 87 | - \$1000 to \$4,999 88 | - \$5000 to \$9,999 89 | - \$10,000 or more 90 | 91 | *Q2.7*: On a scale of not at all important (1) to essential (7), how important is it for you to trust charities? 92 | 93 | : Single answer 94 | 95 | - 1 (Not at all important) 96 | - 2 97 | - 3 98 | - 4 99 | - 5 100 | - 6 101 | - 7 (Essential) 102 | 103 | *Q2.8*: On a scale of no trust at all (1) to complete trust (7), how much do you trust charities? 104 | 105 | : Single answer 106 | 107 | - 1 (No trust at all) 108 | - 2 109 | - 3 110 | - 4 111 | - 5 112 | - 6 113 | - 7 (Complete trust) 114 | 115 | *Q2.9*: Have you volunteered in the past 12 months? 116 | 117 | : Single answer 118 | 119 | - Yes 120 | - No 121 | 122 | **Display Q2.10 if Q2.9 == "Yes"** 123 | 124 | *Q2.10*: How often do you volunteer? 125 | 126 | : Single answer 127 | 128 | - Once a week 129 | - Once a month 130 | - Once every three months 131 | - Once every six months 132 | - Once a year 133 | - Once every few years 134 | 135 | *Q2.11*: Please select blue from the following list: 136 | 137 | : Single answer 138 | 139 | - Red 140 | - Yellow 141 | - Blue 142 | - Green 143 | 144 | **Terminate if Q2.11 != "Blue"** 145 | 146 | --- 147 | 148 | ## Conjoint explanation 149 | 150 | *Q3.1*: In the following set of questions, we will ask you to select organizations you would donate to. The following terms will be important. Please read through this list carefully. 151 | 152 | **Organizations:** 153 | 154 | - *Amnesty International*: A London-based non-governmental organization known for its focus on human rights. 155 | - *Greenpeace*: An independent, nonprofit, global campaigning organization known for using non-violent, creative confrontation to expose global environmental problems and their causes. 156 | - *Oxfam*: An international group known for providing help to poor countries and disaster areas, with a focus on helping create lasting solutions to the injustice of poverty. 157 | - *Red Cross*: An international organization known for caring for the wounded, sick, and homeless in wartime and following natural disasters. 158 | 159 | **Issue areas:** 160 | 161 | - *Emergency response*: Respond to situations that pose an immediate risk to health, life, property, or the environment. 162 | - *Environment*: Protecting the natural world and the impact of human activity on its condition. 163 | - *Human rights*: Protect the inalienable fundamental rights to which a person is inherently entitled simply because he or she is a human being. 164 | - *Refugee relief*: Provide relief for those who have been forced to flee his or her country because of persecution, war or violence. 165 | 166 | **Organizational practices:** 167 | 168 | - *Financial transparency*: Organization discloses information regarding its donations and financial allocations in a timely and reliable manner. 169 | - *Accountability*: Organization undergoes a regular third-party audit to ensure that it is meeting its program goals and obligations. 170 | 171 | **Funding sources:** 172 | 173 | - *Funded primarily by many small private donations*: Funds by individuals who make small independent contributions. 174 | - *Funded primarily by a handful of wealthy private donors*: Funds by wealthy individuals or families, who receive tax deductions for donations. 175 | - *Funded primarily by government grants*: Non-repayable funds gifted by a government department. 176 | 177 | **Relationship with host government:** 178 | 179 | - *Friendly relationship with government*: Organization has a friendly relationship with its host government. 180 | - *Criticized by government*: Organization faces public condemnation from the government. 181 | - *Under government crackdown*: Host government has undertaken official action to limit or stop the organization. 182 | 183 | *Q3.2*: For each of the next 12 questions, imagine you are selecting an organization you will donate to and that each of the listed organizations exists. 184 | 185 | --- 186 | 187 | ## Conjoint questions 188 | 189 | *Q4.1–12*: Which of the following organizations would you donate to? 190 | 191 | : Single option or "none" selected 192 | 193 | | | Option 1 | Option 2 | Option 3 | None | 194 | | --------------------------------- | :------: | :------: | :------: | :--: | 195 | | Organization | Random | Random | Random | — | 196 | | Issue area | Random | Random | Random | — | 197 | | Financial transparency | Random | Random | Random | — | 198 | | Accountability | Random | Random | Random | — | 199 | | Funding sources | Random | Random | Random | — | 200 | | Relationship with host government | Random | Random | Random | — | 201 | 202 | --- 203 | 204 | ## Additional demographic questions 205 | 206 | *Q5.1*: Did you vote in the last election? 207 | 208 | : Single answer 209 | 210 | - Yes 211 | - No 212 | 213 | *Q5.2*: On a scale of extremely liberal (1) to extremely conservative (7), how would you describe your political views? 214 | 215 | : Single answer 216 | 217 | - 1 (Extremely liberal) 218 | - 2 219 | - 3 220 | - 4 221 | - 5 222 | - 6 223 | - 7 (Extremely conservative) 224 | 225 | *Q5.3*: Here is a list of different types of voluntary organizations. For each organization, indicate whether you are an active member, an inactive member, or not a member of that type of organization: 226 | 227 | : Matrix table 228 | 229 | | | Active member | Inactive member | Don't belong | 230 | | --------------------------------------- | :-----------: | :-------------: | :----------: | 231 | | Church or religious organization | • | • | • | 232 | | Sport or recreational organization | • | • | • | 233 | | Art, music, or educational organization | • | • | • | 234 | | Labor union | • | • | • | 235 | | Political party | • | • | • | 236 | | Environmental organization | • | • | • | 237 | | Professional association | • | • | • | 238 | | Humanitarian or charitable organization | • | • | • | 239 | | Consumer organization | • | • | • | 240 | | Other organization | • | • | • | 241 | 242 | *Q5.4*: Historically, how involved have you been in activist causes? 243 | 244 | : Single answer 245 | 246 | - Extremely involved 247 | - Very involved 248 | - Moderately involved 249 | - Slightly involved 250 | - Never involved 251 | 252 | *Q5.5*: Historically, how involved has your family been in activist causes? 253 | 254 | : Single answer 255 | 256 | - Extremely involved 257 | - Very involved 258 | - Moderately involved 259 | - Slightly involved 260 | - Never involved 261 | 262 | *Q5.6*: On a scale of no trust (1) to complete trust (7), how much do you trust political institutions and the state? 263 | 264 | : Single answer 265 | 266 | - 1 (No trust) 267 | - 2 268 | - 3 269 | - 4 270 | - 5 271 | - 6 272 | - 7 (Complete trust) 273 | 274 | *Q5.7*: Have you ever traveled to a developing country? 275 | 276 | : Single answer 277 | 278 | - Yes 279 | - No 280 | 281 | *Q5.8*: How often do you attend religious or worship services, not including weddings and funerals? 282 | 283 | : Single answer 284 | 285 | - More than once a week 286 | - Once a week 287 | - Once or twice a month 288 | - A few times a year 289 | - Seldom 290 | - Never 291 | - Don't know 292 | 293 | *Q5.9*: How important is religion in your life? 294 | 295 | : Single answer 296 | 297 | - Extremely important 298 | - Very important 299 | - Moderately important 300 | - Slightly important 301 | - Not at all important 302 | 303 | *Q5.10*: What is your current religion, if any? 304 | 305 | : Single answer 306 | 307 | - Catholic (including Roman Catholic and Orthodox) 308 | - Protestant (United Church of Canada, Anglican, Orthodox, Baptist, Lutheran) 309 | - Christian Orthodox 310 | - Jewish 311 | - Muslim 312 | - Sikh 313 | - Hindu 314 | - Buddhist 315 | - Atheist (do not believe in God) 316 | - Other: _________ 317 | 318 | *Q5.11*: On a scale of strongly agree (1) to strongly disagree (7), rate your response to the following statement: People should be more charitable towards others in society. 319 | 320 | : Single answer 321 | 322 | - 1 (Strongly agree) 323 | - 2 324 | - 3 325 | - 4 326 | - 5 327 | - 6 328 | - 7 (Strongly disagree) 329 | 330 | *Q5.12*: What is your gender? 331 | 332 | : Single answer 333 | 334 | - Male 335 | - Female 336 | - Transgender 337 | - Prefer not to say 338 | - Other: _________ 339 | 340 | *Q5.13*: Are you now married, widowed, divorced, separated, or never married? 341 | 342 | : Single answer 343 | 344 | - Married 345 | - Widowed 346 | - Divorced 347 | - Separated 348 | - Never married 349 | 350 | *Q5.14*: What is the highest degree or level of school you have completed? 351 | 352 | : Single answer 353 | 354 | - Less than high school 355 | - High school graduate 356 | - Some college 357 | - 2 year degree 358 | - 4 year degree 359 | - Graduate or professional degree 360 | - Doctorate 361 | 362 | *Q5.15*: What is your annual household income before taxes? 363 | 364 | : Single answer 365 | 366 | - Less than \$10,000 367 | - \$10,000 to \$19,999 368 | - \$20,000 to \$29,999 369 | - \$30,000 to \$39,999 370 | - \$40,000 to \$49,999 371 | - \$50,000 to \$59,999 372 | - \$60,000 to \$69,999 373 | - \$70,000 to \$79,999 374 | - \$80,000 to \$89,999 375 | - \$90,000 to \$99,999 376 | - \$100,000 to \$149,999 377 | - \$150,000 to \$199,999 378 | - \$200,000 to \$299,999 379 | - \$300,000 or more 380 | 381 | *Q5.16*: Choose one or more races that you consider yourself to be: 382 | 383 | : Multiple answers allowed 384 | 385 | - White 386 | - Black or African American 387 | - American Indian or Alaska Native 388 | - Asian 389 | - Native Hawaiian or Pacific Islander 390 | - Other: _________ 391 | 392 | *Q5.17*: How old are you? 393 | 394 | : Single answer 395 | 396 | - Under 18 397 | - 18 - 24 398 | - 25 - 34 399 | - 35 - 44 400 | - 45 - 54 401 | - 55 - 64 402 | - 65 - 74 403 | - 75 - 84 404 | - 85 or older 405 | 406 | *Q5.18*: What is your ZIP code? 407 | 408 | : Text field 409 | -------------------------------------------------------------------------------- /analysis/text/experiment_anonymized.md: -------------------------------------------------------------------------------- 1 | ## Consent 2 | 3 | ***Q1.1***: You have been invited to participate in an academic research survey about international nongovernmental organizations. This study is being conducted by Author 1 from Institution 1 and Author 2 and Author 3 from Institution 2. If you qualify to complete the survey, it should take about **10 minutes** to complete. 4 | 5 | Your participation in this study is entirely voluntary and you are free to skip any question or withdraw from the experiment at any time. You will not be asked to provide any personal information, and your answers will remain anonymous. There are no reasonably foreseeable risks or discomforts associated with participating in this study. **There will be questions designed to check that you're paying attention to the details of the experiment. If you answer these incorrectly, the survey will end early and you may not receive compensation.** 6 | 7 | You will receive no direct benefits from participating in this research study. 8 | 9 | If you have any questions at any time about the study or the procedures, you can contact Author 1 (author_1@example.com; Department 1, Institution 1, Address 1) or Author 2 (author_2@example.com; Department 2, Institution 2, Address 2). This research has been reviewed by the Institutional Review Board (IRB) at Institution 1 (IRB phone 1; IRB e-mail 1) and the IRB administrator at Institution 2 (IRB phone 2; IRB e-mail 2). 10 | 11 | By clicking "Yes" below you are indicating that you are at least 18 years old, have read and understood this consent form and agree to participate in this research study. Please print a copy of this page for your records. 12 | 13 | I have read the above information, and I consent to take part in the study. 14 | 15 | : Single answer 16 | 17 | - Yes 18 | - No 19 | 20 | **Terminate if Q1.1 == "No"** 21 | 22 | --- 23 | 24 | ## First demographic section 25 | 26 | *Q2.1*: How often do you follow national news? 27 | 28 | : Single answer 29 | 30 | - Multiple times a day 31 | - Every day 32 | - Once a week 33 | - Hardly ever 34 | - Never 35 | 36 | *Q2.2*: How often do you follow international news? 37 | 38 | : Single answer 39 | 40 | - Always 41 | - Sometimes 42 | - Never 43 | 44 | *Q2.3*: Which mediums do you use to follow news? (Select all that apply.) 45 | 46 | : Multiple answers allowed 47 | 48 | - TV 49 | - Print 50 | - Online (excluding social media) 51 | - Social media 52 | - Radio 53 | - Email newsletters 54 | - News app 55 | 56 | *Q2.4*: Some people seem to follow what's going on in government and public affairs most of the time, whether there's an election going on or not. Others aren't that interested. How often would you say you follow what's going on in government and public affairs? 57 | 58 | : Single answer 59 | 60 | - Most of the time 61 | - Some of the time 62 | - Only now and then 63 | - Hardly at all 64 | 65 | *Q2.5*: How often do you donate to charity (with either cash or in-kind)? 66 | 67 | : Single answer 68 | 69 | - Once a week 70 | - Once a month 71 | - Once every three months 72 | - Once every six months 73 | - Once a year 74 | - Once every few years 75 | - Never 76 | 77 | **Terminate if Q2.5 == "Once every few years" OR Q2.5 == "Never"** 78 | 79 | *Q2.6*: How much did you donate to charity last year? 80 | 81 | : Single answer 82 | 83 | - \$1 to \$49 84 | - \$50 to \$99 85 | - \$100 to \$499 86 | - \$500 to \$999 87 | - \$1000 to \$4,999 88 | - \$5000 to \$9,999 89 | - \$10,000 or more 90 | 91 | *Q2.7*: On a scale of not at all important (1) to essential (7), how important is it for you to trust charities? 92 | 93 | : Single answer 94 | 95 | - 1 (Not at all important) 96 | - 2 97 | - 3 98 | - 4 99 | - 5 100 | - 6 101 | - 7 (Essential) 102 | 103 | *Q2.8*: On a scale of no trust at all (1) to complete trust (7), how much do you trust charities? 104 | 105 | : Single answer 106 | 107 | - 1 (No trust at all) 108 | - 2 109 | - 3 110 | - 4 111 | - 5 112 | - 6 113 | - 7 (Complete trust) 114 | 115 | *Q2.9*: Have you volunteered in the past 12 months? 116 | 117 | : Single answer 118 | 119 | - Yes 120 | - No 121 | 122 | **Display Q2.10 if Q2.9 == "Yes"** 123 | 124 | *Q2.10*: How often do you volunteer? 125 | 126 | : Single answer 127 | 128 | - Once a week 129 | - Once a month 130 | - Once every three months 131 | - Once every six months 132 | - Once a year 133 | - Once every few years 134 | 135 | *Q2.11*: Please select blue from the following list: 136 | 137 | : Single answer 138 | 139 | - Red 140 | - Yellow 141 | - Blue 142 | - Green 143 | 144 | **Terminate if Q2.11 != "Blue"** 145 | 146 | --- 147 | 148 | ## Conjoint explanation 149 | 150 | *Q3.1*: In the following set of questions, we will ask you to select organizations you would donate to. The following terms will be important. Please read through this list carefully. 151 | 152 | **Organizations:** 153 | 154 | - *Amnesty International*: A London-based non-governmental organization known for its focus on human rights. 155 | - *Greenpeace*: An independent, nonprofit, global campaigning organization known for using non-violent, creative confrontation to expose global environmental problems and their causes. 156 | - *Oxfam*: An international group known for providing help to poor countries and disaster areas, with a focus on helping create lasting solutions to the injustice of poverty. 157 | - *Red Cross*: An international organization known for caring for the wounded, sick, and homeless in wartime and following natural disasters. 158 | 159 | **Issue areas:** 160 | 161 | - *Emergency response*: Respond to situations that pose an immediate risk to health, life, property, or the environment. 162 | - *Environment*: Protecting the natural world and the impact of human activity on its condition. 163 | - *Human rights*: Protect the inalienable fundamental rights to which a person is inherently entitled simply because he or she is a human being. 164 | - *Refugee relief*: Provide relief for those who have been forced to flee his or her country because of persecution, war or violence. 165 | 166 | **Organizational practices:** 167 | 168 | - *Financial transparency*: Organization discloses information regarding its donations and financial allocations in a timely and reliable manner. 169 | - *Accountability*: Organization undergoes a regular third-party audit to ensure that it is meeting its program goals and obligations. 170 | 171 | **Funding sources:** 172 | 173 | - *Funded primarily by many small private donations*: Funds by individuals who make small independent contributions. 174 | - *Funded primarily by a handful of wealthy private donors*: Funds by wealthy individuals or families, who receive tax deductions for donations. 175 | - *Funded primarily by government grants*: Non-repayable funds gifted by a government department. 176 | 177 | **Relationship with host government:** 178 | 179 | - *Friendly relationship with government*: Organization has a friendly relationship with its host government. 180 | - *Criticized by government*: Organization faces public condemnation from the government. 181 | - *Under government crackdown*: Host government has undertaken official action to limit or stop the organization. 182 | 183 | *Q3.2*: For each of the next 12 questions, imagine you are selecting an organization you will donate to and that each of the listed organizations exists. 184 | 185 | --- 186 | 187 | ## Conjoint questions 188 | 189 | *Q4.1–12*: Which of the following organizations would you donate to? 190 | 191 | : Single option or "none" selected 192 | 193 | | | Option 1 | Option 2 | Option 3 | None | 194 | | --------------------------------- | :------: | :------: | :------: | :--: | 195 | | Organization | Random | Random | Random | — | 196 | | Issue area | Random | Random | Random | — | 197 | | Financial transparency | Random | Random | Random | — | 198 | | Accountability | Random | Random | Random | — | 199 | | Funding sources | Random | Random | Random | — | 200 | | Relationship with host government | Random | Random | Random | — | 201 | 202 | --- 203 | 204 | ## Additional demographic questions 205 | 206 | *Q5.1*: Did you vote in the last election? 207 | 208 | : Single answer 209 | 210 | - Yes 211 | - No 212 | 213 | *Q5.2*: On a scale of extremely liberal (1) to extremely conservative (7), how would you describe your political views? 214 | 215 | : Single answer 216 | 217 | - 1 (Extremely liberal) 218 | - 2 219 | - 3 220 | - 4 221 | - 5 222 | - 6 223 | - 7 (Extremely conservative) 224 | 225 | *Q5.3*: Here is a list of different types of voluntary organizations. For each organization, indicate whether you are an active member, an inactive member, or not a member of that type of organization: 226 | 227 | : Matrix table 228 | 229 | | | Active member | Inactive member | Don't belong | 230 | | --------------------------------------- | :-----------: | :-------------: | :----------: | 231 | | Church or religious organization | • | • | • | 232 | | Sport or recreational organization | • | • | • | 233 | | Art, music, or educational organization | • | • | • | 234 | | Labor union | • | • | • | 235 | | Political party | • | • | • | 236 | | Environmental organization | • | • | • | 237 | | Professional association | • | • | • | 238 | | Humanitarian or charitable organization | • | • | • | 239 | | Consumer organization | • | • | • | 240 | | Other organization | • | • | • | 241 | 242 | *Q5.4*: Historically, how involved have you been in activist causes? 243 | 244 | : Single answer 245 | 246 | - Extremely involved 247 | - Very involved 248 | - Moderately involved 249 | - Slightly involved 250 | - Never involved 251 | 252 | *Q5.5*: Historically, how involved has your family been in activist causes? 253 | 254 | : Single answer 255 | 256 | - Extremely involved 257 | - Very involved 258 | - Moderately involved 259 | - Slightly involved 260 | - Never involved 261 | 262 | *Q5.6*: On a scale of no trust (1) to complete trust (7), how much do you trust political institutions and the state? 263 | 264 | : Single answer 265 | 266 | - 1 (No trust) 267 | - 2 268 | - 3 269 | - 4 270 | - 5 271 | - 6 272 | - 7 (Complete trust) 273 | 274 | *Q5.7*: Have you ever traveled to a developing country? 275 | 276 | : Single answer 277 | 278 | - Yes 279 | - No 280 | 281 | *Q5.8*: How often do you attend religious or worship services, not including weddings and funerals? 282 | 283 | : Single answer 284 | 285 | - More than once a week 286 | - Once a week 287 | - Once or twice a month 288 | - A few times a year 289 | - Seldom 290 | - Never 291 | - Don't know 292 | 293 | *Q5.9*: How important is religion in your life? 294 | 295 | : Single answer 296 | 297 | - Extremely important 298 | - Very important 299 | - Moderately important 300 | - Slightly important 301 | - Not at all important 302 | 303 | *Q5.10*: What is your current religion, if any? 304 | 305 | : Single answer 306 | 307 | - Catholic (including Roman Catholic and Orthodox) 308 | - Protestant (United Church of Canada, Anglican, Orthodox, Baptist, Lutheran) 309 | - Christian Orthodox 310 | - Jewish 311 | - Muslim 312 | - Sikh 313 | - Hindu 314 | - Buddhist 315 | - Atheist (do not believe in God) 316 | - Other: _________ 317 | 318 | *Q5.11*: On a scale of strongly agree (1) to strongly disagree (7), rate your response to the following statement: People should be more charitable towards others in society. 319 | 320 | : Single answer 321 | 322 | - 1 (Strongly agree) 323 | - 2 324 | - 3 325 | - 4 326 | - 5 327 | - 6 328 | - 7 (Strongly disagree) 329 | 330 | *Q5.12*: What is your gender? 331 | 332 | : Single answer 333 | 334 | - Male 335 | - Female 336 | - Transgender 337 | - Prefer not to say 338 | - Other: _________ 339 | 340 | *Q5.13*: Are you now married, widowed, divorced, separated, or never married? 341 | 342 | : Single answer 343 | 344 | - Married 345 | - Widowed 346 | - Divorced 347 | - Separated 348 | - Never married 349 | 350 | *Q5.14*: What is the highest degree or level of school you have completed? 351 | 352 | : Single answer 353 | 354 | - Less than high school 355 | - High school graduate 356 | - Some college 357 | - 2 year degree 358 | - 4 year degree 359 | - Graduate or professional degree 360 | - Doctorate 361 | 362 | *Q5.15*: What is your annual household income before taxes? 363 | 364 | : Single answer 365 | 366 | - Less than \$10,000 367 | - \$10,000 to \$19,999 368 | - \$20,000 to \$29,999 369 | - \$30,000 to \$39,999 370 | - \$40,000 to \$49,999 371 | - \$50,000 to \$59,999 372 | - \$60,000 to \$69,999 373 | - \$70,000 to \$79,999 374 | - \$80,000 to \$89,999 375 | - \$90,000 to \$99,999 376 | - \$100,000 to \$149,999 377 | - \$150,000 to \$199,999 378 | - \$200,000 to \$299,999 379 | - \$300,000 or more 380 | 381 | *Q5.16*: Choose one or more races that you consider yourself to be: 382 | 383 | : Multiple answers allowed 384 | 385 | - White 386 | - Black or African American 387 | - American Indian or Alaska Native 388 | - Asian 389 | - Native Hawaiian or Pacific Islander 390 | - Other: _________ 391 | 392 | *Q5.17*: How old are you? 393 | 394 | : Single answer 395 | 396 | - Under 18 397 | - 18 - 24 398 | - 25 - 34 399 | - 35 - 44 400 | - 45 - 54 401 | - 55 - 64 402 | - 65 - 74 403 | - 75 - 84 404 | - 85 or older 405 | 406 | *Q5.18*: What is your ZIP code? 407 | 408 | : Text field 409 | -------------------------------------------------------------------------------- /data/DO-NOT-EDIT-ANY-FILES-IN-HERE-BY-HAND: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/data/DO-NOT-EDIT-ANY-FILES-IN-HERE-BY-HAND -------------------------------------------------------------------------------- /data/derived_data/survey_results.yaml: -------------------------------------------------------------------------------- 1 | profile: tabular-data-package 2 | name: NA 3 | fields: 4 | - name: id 5 | type: integer 6 | - name: version 7 | type: number 8 | - name: Q1.1 9 | type: number 10 | - name: Q2.1 11 | type: string 12 | levels: 13 | - Rarely 14 | - Once a week 15 | - At least once a day 16 | - name: Q2.2 17 | type: string 18 | levels: 19 | - Always 20 | - Sometimes 21 | - Never 22 | - name: Q2.3_1 23 | type: number 24 | - name: Q2.3_2 25 | type: number 26 | - name: Q2.3_3 27 | type: number 28 | - name: Q2.3_4 29 | type: number 30 | - name: Q2.3_5 31 | type: number 32 | - name: Q2.3_6 33 | type: number 34 | - name: Q2.3_7 35 | type: number 36 | - name: Q2.4 37 | type: string 38 | levels: 39 | - Not often 40 | - Often 41 | - name: Q2.5 42 | type: string 43 | levels: 44 | - More than once a month, less than once a year 45 | - At least once a month 46 | - name: Q2.6 47 | type: string 48 | levels: 49 | - $1-$49 50 | - $50-$99 51 | - $100-$499 52 | - $500-$999 53 | - $1000-$4,999 54 | - $5000-$9,999 55 | - $10,000+ 56 | - name: Q2.7 57 | type: number 58 | - name: Q2.8 59 | type: number 60 | - name: Q2.9 61 | type: string 62 | levels: 63 | - 'Yes' 64 | - 'No' 65 | - name: Q2.10 66 | type: string 67 | levels: 68 | - Haven't volunteered in past 12 months 69 | - Rarely 70 | - More than once a month, less than once a year 71 | - At least once a month 72 | - name: Q2.11 73 | type: number 74 | - name: Q3.1 75 | type: number 76 | - name: Q3.2 77 | type: number 78 | - name: Q4.1 79 | type: number 80 | - name: Q4.2 81 | type: number 82 | - name: Q4.3 83 | type: number 84 | - name: Q4.4 85 | type: number 86 | - name: Q4.5 87 | type: number 88 | - name: Q4.6 89 | type: number 90 | - name: Q4.7 91 | type: number 92 | - name: Q4.8 93 | type: number 94 | - name: Q4.9 95 | type: number 96 | - name: Q4.10 97 | type: number 98 | - name: Q4.11 99 | type: number 100 | - name: Q4.12 101 | type: number 102 | - name: Q5.1 103 | type: string 104 | levels: 105 | - 'Yes' 106 | - 'No' 107 | - name: Q5.2 108 | type: number 109 | - name: Q5.3_1 110 | type: number 111 | - name: Q5.3_2 112 | type: number 113 | - name: Q5.3_3 114 | type: number 115 | - name: Q5.3_4 116 | type: number 117 | - name: Q5.3_5 118 | type: number 119 | - name: Q5.3_6 120 | type: number 121 | - name: Q5.3_7 122 | type: number 123 | - name: Q5.3_8 124 | type: number 125 | - name: Q5.3_9 126 | type: number 127 | - name: Q5.3_10 128 | type: number 129 | - name: Q5.4 130 | type: string 131 | levels: 132 | - Not involved 133 | - Involved 134 | - name: Q5.5 135 | type: string 136 | levels: 137 | - Not involved 138 | - Involved 139 | - name: Q5.6 140 | type: number 141 | - name: Q5.7 142 | type: string 143 | levels: 144 | - 'Yes' 145 | - 'No' 146 | - name: Q5.8 147 | type: string 148 | levels: 149 | - Not sure 150 | - Rarely 151 | - At least once a month 152 | - name: Q5.9 153 | type: string 154 | levels: 155 | - Not important 156 | - Important 157 | - name: Q5.10 158 | type: number 159 | - name: Q5.10_TEXT 160 | type: string 161 | - name: Q5.11 162 | type: number 163 | - name: Q5.12 164 | type: string 165 | levels: 166 | - Male 167 | - Female 168 | - Transgender 169 | - Prefer not to say 170 | - Other 171 | - name: Q5.12_TEXT 172 | type: string 173 | - name: Q5.13 174 | type: string 175 | levels: 176 | - Married 177 | - Widowed 178 | - Divorced 179 | - Separated 180 | - Never married 181 | - name: Q5.14 182 | type: string 183 | levels: 184 | - Less than high school 185 | - High school graduate 186 | - Some college 187 | - 2 year degree 188 | - 4 year degree 189 | - Graduate or professional degree 190 | - Doctorate 191 | - name: Q5.15 192 | type: string 193 | levels: 194 | - Less than median 195 | - More than median 196 | - name: Q5.16_1 197 | type: number 198 | - name: Q5.16_2 199 | type: number 200 | - name: Q5.16_3 201 | type: number 202 | - name: Q5.16_4 203 | type: number 204 | - name: Q5.16_5 205 | type: number 206 | - name: Q5.16_6 207 | type: number 208 | - name: Q5.16_6_TEXT 209 | type: string 210 | - name: Q5.17 211 | type: string 212 | levels: 213 | - Less than median 214 | - More than median 215 | - name: Q5.18 216 | type: string 217 | - name: Q2.7_f 218 | type: string 219 | levels: 220 | - '1' 221 | - '2' 222 | - '3' 223 | - '4' 224 | - '5' 225 | - '6' 226 | - '7' 227 | - name: Q2.8_f 228 | type: string 229 | levels: 230 | - '1' 231 | - '2' 232 | - '3' 233 | - '4' 234 | - '5' 235 | - '6' 236 | - '7' 237 | - name: Q5.2_f 238 | type: string 239 | levels: 240 | - '1' 241 | - '2' 242 | - '3' 243 | - '4' 244 | - '5' 245 | - '6' 246 | - '7' 247 | - name: Q5.6_f 248 | type: string 249 | levels: 250 | - '1' 251 | - '2' 252 | - '3' 253 | - '4' 254 | - '5' 255 | - '6' 256 | - '7' 257 | - name: Q5.11_f 258 | type: string 259 | levels: 260 | - '1' 261 | - '2' 262 | - '3' 263 | - '4' 264 | - '5' 265 | - '6' 266 | - '7' 267 | -------------------------------------------------------------------------------- /data/raw_data/Market Simulator Version 01.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/data/raw_data/Market Simulator Version 01.xlsx -------------------------------------------------------------------------------- /data/raw_data/data-FTjUv.csv: -------------------------------------------------------------------------------- 1 | Year,Total donations 2 | 1977,142.4 3 | 1978,144.93 4 | 1979,145.6 5 | 1980,144.65 6 | 1981,149.03 7 | 1982,150.15 8 | 1983,155.56 9 | 1984,161.82 10 | 1985,163.36 11 | 1986,186.17 12 | 1987,177.33 13 | 1988,182.49 14 | 1989,194.37 15 | 1990,184.75 16 | 1991,184.62 17 | 1992,194.41 18 | 1993,197.82 19 | 1994,198.53 20 | 1995,198.02 21 | 1996,217.05 22 | 1997,248.09 23 | 1998,265.5 24 | 1999,299 25 | 2000,326.91 26 | 2001,321.29 27 | 2002,317.13 28 | 2003,316.4 29 | 2004,337.75 30 | 2005,367.04 31 | 2006,360.02 32 | 2007,367.74 33 | 2008,341.1 34 | 2009,313.95 35 | 2010,323.92 36 | 2011,325.28 37 | 2012,355.1 38 | 2013,349.89 39 | 2014,370.24 40 | 2015,388.91 41 | 2016,397.94 42 | 2017,410.02 -------------------------------------------------------------------------------- /data/raw_data/data-xextT.csv: -------------------------------------------------------------------------------- 1 | Year,Average giving 2 | 2000,2041.2 3 | 2002,1906.49 4 | 2004,2120.29 5 | 2006,2219.53 6 | 2008,2320.89 7 | 2010,2371.7 8 | 2012,2442.35 9 | 2014,2514.03 -------------------------------------------------------------------------------- /data/raw_data/posterior_draws/.gitignore: -------------------------------------------------------------------------------- 1 | *.rds 2 | -------------------------------------------------------------------------------- /img/data_large_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/img/data_large_color.png -------------------------------------------------------------------------------- /img/materials_large_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/img/materials_large_color.png -------------------------------------------------------------------------------- /img/preregistered_large_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/img/preregistered_large_color.png -------------------------------------------------------------------------------- /manuscript/_output.yaml: -------------------------------------------------------------------------------- 1 | knit: stop('\n\nDon\'t knit with the "Knit" button in RStudio.\nRun one of these commands in an R console:\n\ntargets::tar_make(html)\ntargets::tar_make(pdf)\ntargets::tar_make(ms_pdf)\ntargets::tar_make(docx)\n\nYou can also run targets::tar_make() to build the whole project.\n\n') 2 | -------------------------------------------------------------------------------- /manuscript/appendix.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Online appendix for "Who Cares About Crackdowns? Exploring the Role of Trust in Individual Philanthropy"' 3 | short-title: 'Online appendix for "Who Cares About Crackdowns?"' 4 | author: 5 | - name: Suparna Chaudhry 6 | affiliation: Lewis & Clark College 7 | url: http://www.suparnachaudhry.com/ 8 | email: schaudhry@lclark.edu 9 | - name: Marc Dotson 10 | affiliation: Brigham Young University 11 | url: https://marriottschool.byu.edu/directory/details?id=50683 12 | email: marc_dotson@byu.edu 13 | - name: Andrew Heiss 14 | affiliation: Georgia State University 15 | url: https://www.andrewheiss.com/ 16 | email: aheiss@gsu.edu 17 | date: "April 23, 2021" 18 | title-page: false 19 | # published: Working paper. 20 | code-repo: "Access the code and full analysis notebook at " 21 | reference-section-title: References 22 | toc: true 23 | appendix: true 24 | mainfont: Lora 25 | sansfont: IBM Plex Sans 26 | editor_options: 27 | chunk_output_type: console 28 | --- 29 | 30 | ```{r setup, include=FALSE} 31 | # Figure out output format 32 | is_docx <- knitr::pandoc_to("docx") | knitr::pandoc_to("odt") 33 | is_latex <- knitr::pandoc_to("latex") 34 | is_html <- knitr::pandoc_to("html") 35 | 36 | # Word-specific things 37 | table_format <- ifelse(is_docx, "huxtable", "kableExtra") # Huxtable tables 38 | conditional_dpi <- ifelse(is_docx, 300, 300) # Higher DPI 39 | conditional_align <- ifelse(is_docx, "default", "center") # Word doesn't support align 40 | 41 | # Knitr options 42 | knitr::opts_chunk$set( 43 | echo = FALSE, warning = FALSE, message = FALSE, 44 | tidy.opts = list(width.cutoff = 120), # Code width 45 | fig.retina = 3, dpi = conditional_dpi, 46 | fig.width = 7, fig.asp = 0.618, 47 | fig.align = conditional_align, out.width = "100%", 48 | fig.path = "output/figures/", 49 | cache.path = "output/_cache/", 50 | fig.process = function(x) { # Remove "-1" from figure names 51 | x2 = sub('-\\d+([.][a-z]+)$', '\\1', x) 52 | if (file.rename(x, x2)) x2 else x 53 | } 54 | ) 55 | 56 | # R options 57 | options( 58 | width = 90, # Output width 59 | dplyr.summarise.inform = FALSE, # Turn off dplyr's summarize() auto messages 60 | knitr.kable.NA = "", # Make NAs blank in kables 61 | kableExtra.latex.load_packages = FALSE, # Don't add LaTeX preamble stuff 62 | modelsummary_default = table_format # Set modelsummary backend 63 | ) 64 | ``` 65 | 66 | ```{r libraries-data, include=FALSE} 67 | library(tidyverse) 68 | library(kableExtra) 69 | library(huxtable) 70 | library(here) 71 | ``` 72 | 73 | # Model details 74 | 75 | We analyze the effect of the various combinations of organizational features and donor characteristics with the following hierarchical Bayesian multinomial logit model: 76 | 77 | $$ 78 | \begin{aligned} 79 | \beta &\sim \operatorname{Multivariate} \mathcal{N}(Z \Gamma, \xi) \\ 80 | y &\sim \operatorname{Multinomial\ logit}(X \beta, \varepsilon) 81 | \end{aligned} 82 | $$ 83 | 84 | where $y$ = which alternative the respondent chooses to donate to, $X$ = design matrix of attribute levels (i.e. organizations, issue areas, organizational practices, funding sources, and government relations), $\beta$ = latent individual preferences for the attribute levels, $Z$ = matrix of individual-level covariates (i.e. demographics, political knowledge, attitudes towards charity, etc.), $\Gamma$ = matrix of coefficients mapping individual-level covariates onto the latent individual-level preferences, and $\varepsilon$ and $\xi$ = errors. Simply put, the first level of the model predicts individual donor preferences for various combinations of features (e.g. the combination of human rights issues, financial transparency, government funding, and government crackdown), while the second level of the model uses these fitted preferences to predict the ultimate choice of donation. 85 | 86 | We collected many individual level covariates in our survey. To aid in analysis, we categorized these survey questions into five broader theoretical themes that include smaller groups of variables. Table A\@ref(tab:individual-covariates) shows how we map individual survey questions to different groups. In this paper, we base our simulated market on a model that uses all individual characteristics in the first level: 87 | 88 | $$ 89 | \text{Donation preferences } (\beta) \sim \operatorname{Multivariate} \mathcal{N}(Z \Gamma, \xi) 90 | $$ 91 | 92 | where: 93 | 94 | $$ 95 | \begin{aligned} 96 | Z\Gamma =& \Gamma_a \text{Public affairs} + \Gamma_b\text{Political ideology} + \Gamma_c \text{Social views} + \\ 97 | & \Gamma_d \text{Charity and voluntarism} + \Gamma_e \text{Demographics} 98 | \end{aligned} 99 | $$ 100 | 101 | The alphabetic subscripts for the $\Gamma$ coefficients here (i.e. $\Gamma_a$) represent multiple values, since broader categories like "Public affairs" comprise multiple variables, each with their own coefficients. 102 | 103 | The second level of the model incorporates the $\beta$ estimates from the first level and uses a design matrix of organizational characteristics: 104 | 105 | $$ 106 | \text{Donation choice } (y) \sim \operatorname{Multinomial\ logit}(X \beta, \varepsilon) 107 | $$ 108 | 109 | where (count of distinct values included in parentheses): 110 | 111 | $$ 112 | \begin{aligned} 113 | X = \{&\text{Organization } (4),\ \text{Issue area } (4),\ \text{Organizational practices } (2), \\ 114 | & \text{Funding sources } (3),\ \text{Government relations } (3)\} 115 | \end{aligned} 116 | $$ 117 | \newpage 118 | 119 | \stgroup 120 | 121 | \singlespacing 122 | 123 | ```{r individual-covariates} 124 | all_covariates <- tribble( 125 | ~`Broader category`, ~Group, ~`Survey question`, 126 | "Public affairs", "Public affairs knowledge", "Q2.1: How often do you follow national news?", 127 | "Public affairs", "Public affairs knowledge", "Q2.2: How often do you follow international news?", 128 | "Public affairs", "Public affairs knowledge", "Q2.3: Which mediums do you use to follow news?", 129 | "Public affairs", "Public affairs knowledge", "Q2.4: How often would you say you follow what's going on in government and public affairs?", 130 | "Public affairs", "Public affairs knowledge", "Q5.7: Have you ever traveled to a developing country?", 131 | "Public affairs", "Public affairs activity", "Q5.1: Did you vote in the last election?", 132 | "Political ideology", "Ideology", "Q5.2: 7-point scale on which the political views that people might hold are arranged from extremely liberal (left) to extremely conservative (right).", 133 | "Social views", "Public affairs trust", "Q5.6: 7-point scale of trust in political institutions and the state, arranged from no trust (left) to complete trust (right)", 134 | "Social views", "Social ideology", "Q5.11: 7-point scale of agreement with statement \"People should be more charitable towards others in society\", from strongly agree (1) to strongly disagree (7)", 135 | "Social views", "Religiosity", "Q5.8: How often do you attend religious or worship services, not including weddings and funerals?", 136 | "Social views", "Religiosity", "Q5.9: How important is religion in your life?", 137 | "Social views", "Religiosity", "Q5.10: What is your current religion, if any?", 138 | "Charity and voluntarism", "Charity trust", "Q2.7: How important is it that you trust a charity before giving to it?", 139 | "Charity and voluntarism", "Charity trust", "Q2.8: How much do you trust charities?", 140 | "Charity and voluntarism", "Charity activity", "Q2.5: How often do you donate to charity?", 141 | "Charity and voluntarism", "Charity activity", "Q2.6: How much did you donate to charity last year?", 142 | "Charity and voluntarism", "Volunteer activity", "Q2.9: Have you volunteered in the past 12 months?", 143 | "Charity and voluntarism", "Volunteer activity", "Q2.10: How often do you volunteer?", 144 | "Charity and voluntarism", "Activism activity", "Q5.4: Historically, how involved have you been in activist causes?", 145 | "Charity and voluntarism", "Activism activity", "Q5.5: Historically, how involved has your family been in activist causes?", 146 | "Charity and voluntarism", "Association membership", "Q5.3: List of possible types of organizations and associations", 147 | "Demographics", "Gender", "Q5.12: What is your gender?", 148 | "Demographics", "Marital status", "Q5.13: Are you now married, widowed, divorced, separated, or never married?", 149 | "Demographics", "Education", "Q5.14: What is the highest degree or level of school you have completed?", 150 | "Demographics", "Income", "Q5.15: What is your annual household income before taxes?", 151 | "Demographics", "Race", "Q5.16: Choose one or more races that you consider yourself to be:", 152 | "Demographics", "Age", "Q5.17: How old are you?" 153 | ) 154 | 155 | covariate_caption <- "Individual covariates used in $Z$ to estmate the $\\Gamma$s in the first level of the model, or $\\operatorname{Multivariate} \\mathcal{N}(Z \\Gamma, \\xi)$" 156 | 157 | if (!is_docx) { 158 | all_covariates %>% 159 | select(Group, `Survey question`) %>% 160 | kbl(align = c("l", "l"), 161 | longtable = TRUE, booktabs = TRUE, linesep = "", 162 | caption = covariate_caption) %>% 163 | pack_rows(index = table(fct_inorder(all_covariates$`Broader category`)), 164 | latex_gap_space = "1.5em", indent = FALSE) %>% 165 | kable_styling(latex_options = c("repeat_header")) %>% 166 | column_spec(1, width = "0.25\\\\textwidth") %>% 167 | column_spec(2, width = "0.68\\\\textwidth") %>% 168 | collapse_rows(columns = 1, valign = "top", latex_hline = "major") 169 | } else { 170 | all_covariates %>% 171 | select(Group, `Survey question`) %>% 172 | hux() %>% 173 | set_font_size(10) %>% 174 | set_all_padding(3) %>% 175 | set_align(everywhere, 1:2, "left") %>% 176 | merge_repeated_rows(col = 1) %>% 177 | insert_row("Public affairs", "", after = 1) %>% 178 | insert_row("\nPolitical ideology", "", after = 8) %>% 179 | insert_row("\nSocial views", "", after = 10) %>% 180 | insert_row("\nCharity and voluntarism", "", after = 16) %>% 181 | insert_row("\nDemographics", "", after = 26) %>% 182 | merge_cells(2, 1:2) %>% 183 | merge_cells(9, 1:2) %>% 184 | merge_cells(11, 1:2) %>% 185 | merge_cells(17, 1:2) %>% 186 | merge_cells(27, 1:2) %>% 187 | set_bold(1, everywhere) %>% 188 | set_bold(c(2, 9, 11, 17, 27), everywhere) %>% 189 | set_top_border(1, everywhere) %>% 190 | set_bottom_border(1, everywhere) %>% 191 | set_bottom_border(c(7, 12, 13, 19, 21, 23, 25, 28:32), everywhere) %>% 192 | set_width(1) %>% 193 | set_col_width(1, 0.25) %>% 194 | set_col_width(2, 0.75) %>% 195 | set_wrap(TRUE) %>% 196 | huxtable::set_caption(covariate_caption) %>% 197 | huxtable::as_flextable() %>% 198 | flextable::font(fontname = "Times New Roman") 199 | } 200 | ``` 201 | 202 | \fingroup 203 | 204 | \newpage 205 | 206 | # Survey experiment 207 | 208 | \stgroup 209 | 210 | \singlespacing 211 | 212 | ```{r child = "../analysis/text/experiment_anonymized.md"} 213 | ``` 214 | 215 | \fingroup 216 | -------------------------------------------------------------------------------- /manuscript/output/html-support/ath-1.0.0/ath-clean.css: -------------------------------------------------------------------------------- 1 | /* 2 | Title: ATH Clean 3 | Author: Andrew Heiss @andrewheiss 4 | Description: Nice clean theme for Pandoc, based in part on "Pesto" 5 | (https://github.com/ttscoff/MarkedCustomStyles/blob/master/Pesto.scss) by 6 | Andrew Patton (@acusti ) 7 | Non-standard fonts used: Work Sans, Gentium Basic 8 | --- 9 | */ 10 | @import url("https://fonts.googleapis.com/css?family=Work+Sans:300,400,700"); 11 | @import url("https://fonts.googleapis.com/css?family=Gentium+Basic"); 12 | *, *:before, *:after { 13 | -moz-box-sizing: border-box; 14 | -webkit-box-sizing: border-box; 15 | box-sizing: border-box; 16 | } 17 | 18 | html, button, input, select, textarea { 19 | font-family: sans-serif; 20 | } 21 | 22 | html, body, button, input, select, textarea { 23 | color: #0a0a0a; 24 | font-family: "Gentium Basic", "Palatino", serif; 25 | } 26 | 27 | body { 28 | margin: 0 auto; 29 | background-color: white; 30 | } 31 | 32 | body, textarea { 33 | line-height: 1.5; 34 | } 35 | 36 | body:after { 37 | clear: both; 38 | content: ""; 39 | display: table; 40 | } 41 | 42 | body { 43 | padding: 1rem 1.25rem; 44 | margin-left: auto; 45 | margin-right: auto; 46 | max-width: 1050px; 47 | display: block; 48 | } 49 | @media (min-width: base) { 50 | body { 51 | padding-left: 1rem; 52 | padding-right: 1rem; 53 | } 54 | } 55 | @media (min-width: 466px) { 56 | body { 57 | padding-left: 1.75rem; 58 | padding-right: 1.75rem; 59 | } 60 | } 61 | @media (min-width: 612px) { 62 | body { 63 | padding-left: 3rem; 64 | padding-right: 3rem; 65 | } 66 | } 67 | @media (min-width: 874.8px) { 68 | body { 69 | padding-left: 4rem; 70 | padding-right: 4rem; 71 | } 72 | } 73 | @media (min-width: 1014.96px) { 74 | body { 75 | padding-left: 5rem; 76 | padding-right: 5rem; 77 | } 78 | } 79 | 80 | /* Headings */ 81 | h1, h2, h3, h4, h5, h6 { 82 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 83 | } 84 | 85 | h1 { 86 | font-size: 2.8em; 87 | font-weight: 300; 88 | line-height: 1.2; 89 | margin: 1.75em 0 0.333em; 90 | } 91 | 92 | h1 + h2 { 93 | margin-top: 0; 94 | } 95 | 96 | h2 { 97 | font-size: 1.9em; 98 | font-weight: 300; 99 | line-height: 1.2; 100 | margin: 1.5em 0 0.333em; 101 | } 102 | 103 | h2 + h3 { 104 | margin-top: 0; 105 | } 106 | 107 | h3 { 108 | font-size: 1.5em; 109 | font-weight: 300; 110 | line-height: 1.2; 111 | margin: 1.3em 0 0; 112 | } 113 | 114 | h4 { 115 | font-size: 1.2em; 116 | font-weight: 300; 117 | margin: 1.3em 0 0; 118 | } 119 | 120 | h5 { 121 | font-size: 1em; 122 | font-weight: 300; 123 | margin: 1.3em 0 0; 124 | } 125 | 126 | h6 { 127 | font-size: 0.8em; 128 | font-weight: 300; 129 | margin: 1.3em 0 0; 130 | } 131 | 132 | /* Links */ 133 | a { 134 | color: #c7402d; 135 | text-decoration: none; 136 | } 137 | 138 | a:hover { 139 | color: #eaaca3; 140 | } 141 | 142 | /* Monospaced stuff */ 143 | code, pre, kbd, samp, tt { 144 | font-family: "Consolas", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; 145 | background-color: #f2f2f2; 146 | font-size: 80%; 147 | padding: 0; 148 | } 149 | 150 | pre { 151 | font-size: 1.3em; 152 | margin: 1em 0; 153 | line-height: 1.1; 154 | background-color: #f2f2f2; 155 | overflow-x: auto; 156 | padding: 1.3rem; 157 | position: relative; 158 | white-space: pre; 159 | word-wrap: normal; 160 | } 161 | 162 | code, tt { 163 | margin: 0 2px; 164 | padding: 0 7px; 165 | white-space: nowrap; 166 | border: 1px solid #e3e3e3; 167 | background-color: #f2f2f2; 168 | color: #0a0a0a; 169 | } 170 | 171 | pre > code { 172 | margin: 0; 173 | padding: 0; 174 | white-space: pre; 175 | border: none; 176 | background: transparent; 177 | } 178 | 179 | /* General typography */ 180 | p { 181 | font-size: 1.3em; 182 | margin: 1em 0; 183 | } 184 | 185 | b, strong { 186 | font-weight: bold; 187 | font-weight: 700; 188 | } 189 | 190 | blockquote { 191 | margin: 2em 4em; 192 | } 193 | 194 | small { 195 | display: block; 196 | font-size: 0.8rem; 197 | line-height: 1.2; 198 | } 199 | 200 | .footnote-ref, sup { 201 | font-size: 0.9rem; 202 | vertical-align: super; 203 | line-height: 0; 204 | } 205 | 206 | .footnotes { 207 | font-size: 80%; 208 | } 209 | 210 | .footnote-back { 211 | padding-left: 0.5em; 212 | } 213 | 214 | sub { 215 | font-size: 0.9rem; 216 | vertical-align: sub; 217 | } 218 | 219 | hr { 220 | -moz-border-bottom-colors: none; 221 | -moz-border-left-colors: none; 222 | -moz-border-right-colors: none; 223 | -moz-border-top-colors: none; 224 | border-color: -moz-use-text-color -moz-use-text-color #0a0a0a; 225 | border-image: none; 226 | border-style: none none solid; 227 | border-width: medium medium 1px; 228 | margin: 3em 6em; 229 | } 230 | 231 | /* Extra document parts */ 232 | .article-meta { 233 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 234 | font-weight: 300; 235 | } 236 | 237 | .title { 238 | font-size: 3.3em; 239 | } 240 | 241 | .subtitle { 242 | font-size: 1.9em; 243 | margin-top: 0; 244 | } 245 | 246 | .date { 247 | font-size: 1em; 248 | } 249 | 250 | .published { 251 | font-size: 1em; 252 | } 253 | 254 | .code-repo { 255 | font-size: 0.8em; 256 | } 257 | 258 | .authors { 259 | margin: 2em 0; 260 | } 261 | 262 | .author { 263 | font-size: 1.5em; 264 | margin-bottom: 0; 265 | } 266 | 267 | .affilation { 268 | font-size: 1em; 269 | margin-top: 0; 270 | } 271 | 272 | .abstract { 273 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 274 | font-weight: 300; 275 | font-size: 1em; 276 | margin: 0 3em 0; 277 | padding: 5px; 278 | } 279 | 280 | .keywords { 281 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 282 | font-weight: 300; 283 | font-size: 1em; 284 | margin: 1.5em 3em 0; 285 | padding: 5px; 286 | } 287 | 288 | .acknowledgments { 289 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 290 | font-weight: 300; 291 | font-size: 1em; 292 | margin: 2em 3em; 293 | padding: 5px; 294 | background: #f2f2f2; 295 | } 296 | 297 | .keywords-title, .acknowledgments-title { 298 | font-weight: 700; 299 | font-style: italic; 300 | } 301 | 302 | .epigraph-wrapper { 303 | overflow: hidden; 304 | } 305 | 306 | .epigraph { 307 | width: 50%; 308 | float: right; 309 | color: #8a8a8a; 310 | font-size: 0.9em; 311 | } 312 | 313 | .epigraph-text { 314 | padding-top: 0.8em; 315 | font-style: italic; 316 | } 317 | 318 | .epigraph-source { 319 | text-align: right; 320 | } 321 | 322 | p.epigraph-text { 323 | margin-bottom: 0; 324 | } 325 | 326 | p.epigraph-source { 327 | margin-top: 0; 328 | } 329 | 330 | .references .csl-entry { 331 | padding-left: 3rem; 332 | text-indent: -3rem; 333 | font-size: 1.1em; 334 | line-height: 1.3; 335 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 336 | font-weight: 300; 337 | } 338 | 339 | /* Images */ 340 | /* figure { 341 | display: inline-block; 342 | position: relative; 343 | margin: 1em 0 2em; 344 | text-align: center; 345 | } 346 | 347 | img { 348 | margin: 0 auto; 349 | border: 0 none; 350 | display: block; 351 | width: auto; 352 | max-width: 100%; 353 | } */ 354 | figure { 355 | display: table; 356 | text-align: center; 357 | margin: 0 auto; 358 | } 359 | 360 | figure img { 361 | display: block; 362 | max-width: 100%; 363 | } 364 | 365 | figcaption { 366 | display: table-caption; 367 | caption-side: bottom; 368 | } 369 | 370 | p img { 371 | display: inline; 372 | } 373 | 374 | /* Lists */ 375 | ol > li:before { 376 | color: #0a0a0a; 377 | content: counter(ol, decimal) "."; 378 | counter-increment: ol; 379 | margin-right: 0.333em; 380 | position: absolute; 381 | right: 100%; 382 | } 383 | 384 | ul > li:before { 385 | background-color: #0a0a0a; 386 | border-radius: 50%; 387 | content: ""; 388 | height: 0.3em; 389 | width: 0.3em; 390 | margin-right: 0.5em; 391 | margin-top: 0.6em; 392 | position: absolute; 393 | right: 100%; 394 | } 395 | 396 | ol, ul, dl { 397 | margin-left: 3.1em; 398 | padding: 0; 399 | font-size: 1.3em; 400 | } 401 | 402 | ol ol, ul ul, dl dl, 403 | dl ol, dl ul { 404 | margin-left: 2em; 405 | font-size: 100%; 406 | } 407 | 408 | dl ol, dl ul { 409 | margin-bottom: 0.75em; 410 | } 411 | 412 | ol p, ul p, dl p { 413 | font-size: 100%; 414 | } 415 | 416 | dl table { 417 | font-size: 80%; 418 | } 419 | 420 | ol { 421 | counter-reset: ol; 422 | } 423 | 424 | li + li, dd + dt { 425 | margin-top: 0em; 426 | } 427 | 428 | ul > li { 429 | position: relative; 430 | } 431 | 432 | ol > li { 433 | position: relative; 434 | } 435 | 436 | li { 437 | list-style: none outside none; 438 | } 439 | 440 | dt { 441 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 442 | font-weight: 300; 443 | padding-top: 0.5em; 444 | font-size: 0.9em; 445 | } 446 | 447 | /* Tables */ 448 | tbody { 449 | display: table-row-group; 450 | } 451 | 452 | tfoot { 453 | display: table-footer-group; 454 | } 455 | 456 | table { 457 | margin-bottom: 2em; 458 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 459 | padding: 0; 460 | border-collapse: collapse; 461 | width: 90%; 462 | margin: 0 auto 2em auto; 463 | } 464 | 465 | table th, table td { 466 | padding: 10px 10px 9px; 467 | line-height: 18px; 468 | text-align: left; 469 | font-size: 1em; 470 | line-height: 1.4; 471 | } 472 | 473 | table th { 474 | padding-top: 9px; 475 | vertical-align: middle; 476 | font-weight: 700; 477 | } 478 | 479 | table td { 480 | vertical-align: top; 481 | border-top: 1px solid #d6d6d6; 482 | font-weight: 300; 483 | } 484 | 485 | tbody tr:nth-child(odd) { 486 | /* background-color: $color-text-lightest; */ 487 | } 488 | 489 | table ul, table ol { 490 | margin-top: 0; 491 | margin-left: 1em; 492 | font-size: 100%; 493 | } 494 | 495 | /* Captions */ 496 | caption, figcaption { 497 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 498 | font-size: 1em; 499 | text-align: left; 500 | background: #f2f2f2; 501 | padding: 4px 8px; 502 | margin: 4px 0; 503 | } 504 | 505 | figure > figcaption { 506 | margin-top: 0.25em; 507 | } 508 | 509 | /* Print */ 510 | @media print { 511 | html { 512 | font-size: 130%; 513 | } 514 | 515 | body { 516 | padding-left: 0; 517 | padding-right: 0; 518 | max-width: 100%; 519 | } 520 | 521 | ul > li:before { 522 | height: 0.325em; 523 | width: 0.325em; 524 | } 525 | } 526 | 527 | /*# sourceMappingURL=ath-clean.css.map */ 528 | -------------------------------------------------------------------------------- /manuscript/output/html-support/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /manuscript/output/html-support/kePrint-0.0.1/kePrint.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | if (typeof $('[data-toggle="tooltip"]').tooltip === 'function') { 3 | $('[data-toggle="tooltip"]').tooltip(); 4 | } 5 | if ($('[data-toggle="popover"]').popover === 'function') { 6 | $('[data-toggle="popover"]').popover(); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /manuscript/output/html-support/lightable-0.0.1/lightable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * lightable v0.0.1 3 | * Copyright 2020 Hao Zhu 4 | * Licensed under MIT (https://github.com/haozhu233/kableExtra/blob/master/LICENSE) 5 | */ 6 | 7 | .lightable-minimal { 8 | border-collapse: separate; 9 | border-spacing: 16px 1px; 10 | width: 100%; 11 | margin-bottom: 10px; 12 | } 13 | 14 | .lightable-minimal td { 15 | margin-left: 5px; 16 | margin-right: 5px; 17 | } 18 | 19 | .lightable-minimal th { 20 | margin-left: 5px; 21 | margin-right: 5px; 22 | } 23 | 24 | .lightable-minimal thead tr:last-child th { 25 | border-bottom: 2px solid #00000050; 26 | empty-cells: hide; 27 | 28 | } 29 | 30 | .lightable-minimal tbody tr:first-child td { 31 | padding-top: 0.5em; 32 | } 33 | 34 | .lightable-minimal.lightable-hover tbody tr:hover { 35 | background-color: #f5f5f5; 36 | } 37 | 38 | .lightable-minimal.lightable-striped tbody tr:nth-child(even) { 39 | background-color: #f5f5f5; 40 | } 41 | 42 | .lightable-classic { 43 | border-top: 0.16em solid #111111; 44 | border-bottom: 0.16em solid #111111; 45 | width: 100%; 46 | margin-bottom: 10px; 47 | margin: 10px 5px; 48 | } 49 | 50 | .lightable-classic tfoot tr td { 51 | border: 0; 52 | } 53 | 54 | .lightable-classic tfoot tr:first-child td { 55 | border-top: 0.14em solid #111111; 56 | } 57 | 58 | .lightable-classic caption { 59 | color: #222222; 60 | } 61 | 62 | .lightable-classic td { 63 | padding-left: 5px; 64 | padding-right: 5px; 65 | color: #222222; 66 | } 67 | 68 | .lightable-classic th { 69 | padding-left: 5px; 70 | padding-right: 5px; 71 | font-weight: normal; 72 | color: #222222; 73 | } 74 | 75 | .lightable-classic thead tr:last-child th { 76 | border-bottom: 0.10em solid #111111; 77 | } 78 | 79 | .lightable-classic.lightable-hover tbody tr:hover { 80 | background-color: #F9EEC1; 81 | } 82 | 83 | .lightable-classic.lightable-striped tbody tr:nth-child(even) { 84 | background-color: #f5f5f5; 85 | } 86 | 87 | .lightable-classic-2 { 88 | border-top: 3px double #111111; 89 | border-bottom: 3px double #111111; 90 | width: 100%; 91 | margin-bottom: 10px; 92 | } 93 | 94 | .lightable-classic-2 tfoot tr td { 95 | border: 0; 96 | } 97 | 98 | .lightable-classic-2 tfoot tr:first-child td { 99 | border-top: 3px double #111111; 100 | } 101 | 102 | .lightable-classic-2 caption { 103 | color: #222222; 104 | } 105 | 106 | .lightable-classic-2 td { 107 | padding-left: 5px; 108 | padding-right: 5px; 109 | color: #222222; 110 | } 111 | 112 | .lightable-classic-2 th { 113 | padding-left: 5px; 114 | padding-right: 5px; 115 | font-weight: normal; 116 | color: #222222; 117 | } 118 | 119 | .lightable-classic-2 tbody tr:last-child td { 120 | border-bottom: 3px double #111111; 121 | } 122 | 123 | .lightable-classic-2 thead tr:last-child th { 124 | border-bottom: 1px solid #111111; 125 | } 126 | 127 | .lightable-classic-2.lightable-hover tbody tr:hover { 128 | background-color: #F9EEC1; 129 | } 130 | 131 | .lightable-classic-2.lightable-striped tbody tr:nth-child(even) { 132 | background-color: #f5f5f5; 133 | } 134 | 135 | .lightable-material { 136 | min-width: 100%; 137 | white-space: nowrap; 138 | table-layout: fixed; 139 | font-family: Roboto, sans-serif; 140 | border: 1px solid #EEE; 141 | border-collapse: collapse; 142 | margin-bottom: 10px; 143 | } 144 | 145 | .lightable-material tfoot tr td { 146 | border: 0; 147 | } 148 | 149 | .lightable-material tfoot tr:first-child td { 150 | border-top: 1px solid #EEE; 151 | } 152 | 153 | .lightable-material th { 154 | height: 56px; 155 | padding-left: 16px; 156 | padding-right: 16px; 157 | } 158 | 159 | .lightable-material td { 160 | height: 52px; 161 | padding-left: 16px; 162 | padding-right: 16px; 163 | border-top: 1px solid #eeeeee; 164 | } 165 | 166 | .lightable-material.lightable-hover tbody tr:hover { 167 | background-color: #f5f5f5; 168 | } 169 | 170 | .lightable-material.lightable-striped tbody tr:nth-child(even) { 171 | background-color: #f5f5f5; 172 | } 173 | 174 | .lightable-material.lightable-striped tbody td { 175 | border: 0; 176 | } 177 | 178 | .lightable-material.lightable-striped thead tr:last-child th { 179 | border-bottom: 1px solid #ddd; 180 | } 181 | 182 | .lightable-material-dark { 183 | min-width: 100%; 184 | white-space: nowrap; 185 | table-layout: fixed; 186 | font-family: Roboto, sans-serif; 187 | border: 1px solid #FFFFFF12; 188 | border-collapse: collapse; 189 | margin-bottom: 10px; 190 | background-color: #363640; 191 | } 192 | 193 | .lightable-material-dark tfoot tr td { 194 | border: 0; 195 | } 196 | 197 | .lightable-material-dark tfoot tr:first-child td { 198 | border-top: 1px solid #FFFFFF12; 199 | } 200 | 201 | .lightable-material-dark th { 202 | height: 56px; 203 | padding-left: 16px; 204 | padding-right: 16px; 205 | color: #FFFFFF60; 206 | } 207 | 208 | .lightable-material-dark td { 209 | height: 52px; 210 | padding-left: 16px; 211 | padding-right: 16px; 212 | color: #FFFFFF; 213 | border-top: 1px solid #FFFFFF12; 214 | } 215 | 216 | .lightable-material-dark.lightable-hover tbody tr:hover { 217 | background-color: #FFFFFF12; 218 | } 219 | 220 | .lightable-material-dark.lightable-striped tbody tr:nth-child(even) { 221 | background-color: #FFFFFF12; 222 | } 223 | 224 | .lightable-material-dark.lightable-striped tbody td { 225 | border: 0; 226 | } 227 | 228 | .lightable-material-dark.lightable-striped thead tr:last-child th { 229 | border-bottom: 1px solid #FFFFFF12; 230 | } 231 | 232 | .lightable-paper { 233 | width: 100%; 234 | margin-bottom: 10px; 235 | color: #444; 236 | } 237 | 238 | .lightable-paper tfoot tr td { 239 | border: 0; 240 | } 241 | 242 | .lightable-paper tfoot tr:first-child td { 243 | border-top: 1px solid #00000020; 244 | } 245 | 246 | .lightable-paper thead tr:last-child th { 247 | color: #666; 248 | vertical-align: bottom; 249 | border-bottom: 1px solid #00000020; 250 | line-height: 1.15em; 251 | padding: 10px 5px; 252 | } 253 | 254 | .lightable-paper td { 255 | vertical-align: middle; 256 | border-bottom: 1px solid #00000010; 257 | line-height: 1.15em; 258 | padding: 7px 5px; 259 | } 260 | 261 | .lightable-paper.lightable-hover tbody tr:hover { 262 | background-color: #F9EEC1; 263 | } 264 | 265 | .lightable-paper.lightable-striped tbody tr:nth-child(even) { 266 | background-color: #00000008; 267 | } 268 | 269 | .lightable-paper.lightable-striped tbody td { 270 | border: 0; 271 | } 272 | 273 | -------------------------------------------------------------------------------- /manuscript/pandoc/bin/anonymize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Replace text with different text for anonymity. 4 | # 5 | # You must specify the replacement dictionary in a CSV file with columns named 6 | # "original" and "replacement": 7 | # 8 | # original,replacement 9 | # old text,new text 10 | # 11 | # usage: anonymize.py [-h] replacements [input_file] [output] 12 | # 13 | # Recommended usage: Send the Markdown output to stdout (default) and pipe 14 | # into pandoc for instant preprocessing: 15 | # 16 | # anonymize.py replacements.csv document.md | pandoc -f markdown -t html -o document.html 17 | 18 | # Load libraries 19 | import argparse 20 | import sys 21 | import re 22 | import csv 23 | 24 | # Get command line arguments 25 | parser = argparse.ArgumentParser(description='Replace text with different text for anonymity.') 26 | parser.add_argument('replacements', type=argparse.FileType('r'), 27 | help='CSV file of replacements (with columns named "original" and "replacement")') 28 | parser.add_argument('input_file', type=argparse.FileType('r'), 29 | nargs='?', default=sys.stdin, 30 | help='file to anonymize') 31 | parser.add_argument('output', type=argparse.FileType('w'), 32 | nargs='?', default=sys.stdout, 33 | help='the name of the output file (defaults to stdout)') 34 | args = parser.parse_args() 35 | 36 | 37 | # Load replacements CSV as a dictionary 38 | with args.replacements as file: 39 | reader = csv.DictReader(file, skipinitialspace=True) 40 | replacements = {row['original']: row['replacement'] for row in reader} 41 | 42 | 43 | # Replace keys in the dictionary with values 44 | def anonymize(text, repl): 45 | # Sort keys by length, in reverse 46 | for item in sorted(repl.keys(), key=len, reverse=True): 47 | # Replace stuff 48 | text = re.sub(item, repl[item], text) 49 | 50 | return(text) 51 | 52 | 53 | # All done! 54 | with args.output as f: 55 | f.write(anonymize(args.input_file.read(), replacements)) 56 | -------------------------------------------------------------------------------- /manuscript/pandoc/bin/replacements.csv: -------------------------------------------------------------------------------- 1 | original, replacement 2 | Suparna Chaudhry,Author 1 3 | Lewis & Clark College,Institution 1 4 | schaudhry@lclark.edu,author_1@example.com 5 | http://www.suparnachaudhry.com/,http://www.example.com 6 | Department of International Affairs,Department 1 7 | "Portland, OR 97219",Address 1 8 | 757-594-7461,IRB phone 1 9 | IRB@cnu.edu,IRB e-mail 1 10 | 1436622-1,IRB code 1 11 | Marc Dotson,Author 2 12 | Brigham Young University,Institution 2 13 | marc_dotson@byu.edu,author_2@example.com 14 | https://www.andrewheiss.com/,http://www.example.com 15 | Marriott School of Business,Department 2 16 | "Provo, UT 84602",Address 2 17 | 801-422-1461,IRB phone 2 18 | irb@byu.edu,IRB e-mail 2 19 | E19135,IRB code 2 20 | Andrew Heiss,Author 3 21 | Georgia State University,Institution 3 22 | aheiss@gsu.edu,author_3@example.com 23 | https://www.andrewheiss.com/,http://www.example.com 24 | Andrew Young School of Policy Studies,Department 3 25 | "Atlanta, GA 30303",Address 3 26 | H19644,IRB code 3 27 | https://osf.io/hsbyd/,https://osf.io/ANON-PREREG/ 28 | https://osf.io/sm5ew/,https://osf.io/ANON-CODE-DATA/ 29 | -------------------------------------------------------------------------------- /manuscript/pandoc/csl/american-political-science-association.csl: -------------------------------------------------------------------------------- 1 | 2 | 237 | -------------------------------------------------------------------------------- /manuscript/pandoc/csl/apsa-no-bib.csl: -------------------------------------------------------------------------------- 1 | 2 | 174 | -------------------------------------------------------------------------------- /manuscript/pandoc/csl/the-open-university-harvard.csl: -------------------------------------------------------------------------------- 1 | 2 | 265 | -------------------------------------------------------------------------------- /manuscript/pandoc/css/ath-clean.css: -------------------------------------------------------------------------------- 1 | /* 2 | Title: ATH Clean 3 | Author: Andrew Heiss @andrewheiss 4 | Description: Nice clean theme for Pandoc, based in part on "Pesto" 5 | (https://github.com/ttscoff/MarkedCustomStyles/blob/master/Pesto.scss) by 6 | Andrew Patton (@acusti ) 7 | Non-standard fonts used: Work Sans, Gentium Basic 8 | --- 9 | */ 10 | @import url("https://fonts.googleapis.com/css?family=Work+Sans:300,400,700"); 11 | @import url("https://fonts.googleapis.com/css?family=Gentium+Basic"); 12 | *, *:before, *:after { 13 | -moz-box-sizing: border-box; 14 | -webkit-box-sizing: border-box; 15 | box-sizing: border-box; 16 | } 17 | 18 | html, button, input, select, textarea { 19 | font-family: sans-serif; 20 | } 21 | 22 | html, body, button, input, select, textarea { 23 | color: #0a0a0a; 24 | font-family: "Gentium Basic", "Palatino", serif; 25 | } 26 | 27 | body { 28 | margin: 0 auto; 29 | background-color: white; 30 | } 31 | 32 | body, textarea { 33 | line-height: 1.5; 34 | } 35 | 36 | body:after { 37 | clear: both; 38 | content: ""; 39 | display: table; 40 | } 41 | 42 | body { 43 | padding: 1rem 1.25rem; 44 | margin-left: auto; 45 | margin-right: auto; 46 | max-width: 1050px; 47 | display: block; 48 | } 49 | @media (min-width: base) { 50 | body { 51 | padding-left: 1rem; 52 | padding-right: 1rem; 53 | } 54 | } 55 | @media (min-width: 466px) { 56 | body { 57 | padding-left: 1.75rem; 58 | padding-right: 1.75rem; 59 | } 60 | } 61 | @media (min-width: 612px) { 62 | body { 63 | padding-left: 3rem; 64 | padding-right: 3rem; 65 | } 66 | } 67 | @media (min-width: 874.8px) { 68 | body { 69 | padding-left: 4rem; 70 | padding-right: 4rem; 71 | } 72 | } 73 | @media (min-width: 1014.96px) { 74 | body { 75 | padding-left: 5rem; 76 | padding-right: 5rem; 77 | } 78 | } 79 | 80 | /* Headings */ 81 | h1, h2, h3, h4, h5, h6 { 82 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 83 | } 84 | 85 | h1 { 86 | font-size: 2.8em; 87 | font-weight: 300; 88 | line-height: 1.2; 89 | margin: 1.75em 0 0.333em; 90 | } 91 | 92 | h1 + h2 { 93 | margin-top: 0; 94 | } 95 | 96 | h2 { 97 | font-size: 1.9em; 98 | font-weight: 300; 99 | line-height: 1.2; 100 | margin: 1.5em 0 0.333em; 101 | } 102 | 103 | h2 + h3 { 104 | margin-top: 0; 105 | } 106 | 107 | h3 { 108 | font-size: 1.5em; 109 | font-weight: 300; 110 | line-height: 1.2; 111 | margin: 1.3em 0 0; 112 | } 113 | 114 | h4 { 115 | font-size: 1.2em; 116 | font-weight: 300; 117 | margin: 1.3em 0 0; 118 | } 119 | 120 | h5 { 121 | font-size: 1em; 122 | font-weight: 300; 123 | margin: 1.3em 0 0; 124 | } 125 | 126 | h6 { 127 | font-size: 0.8em; 128 | font-weight: 300; 129 | margin: 1.3em 0 0; 130 | } 131 | 132 | /* Links */ 133 | a { 134 | color: #c7402d; 135 | text-decoration: none; 136 | } 137 | 138 | a:hover { 139 | color: #eaaca3; 140 | } 141 | 142 | /* Monospaced stuff */ 143 | code, pre, kbd, samp, tt { 144 | font-family: "Consolas", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; 145 | background-color: #f2f2f2; 146 | font-size: 80%; 147 | padding: 0; 148 | } 149 | 150 | pre { 151 | font-size: 1.3em; 152 | margin: 1em 0; 153 | line-height: 1.1; 154 | background-color: #f2f2f2; 155 | overflow-x: auto; 156 | padding: 1.3rem; 157 | position: relative; 158 | white-space: pre; 159 | word-wrap: normal; 160 | } 161 | 162 | code, tt { 163 | margin: 0 2px; 164 | padding: 0 7px; 165 | white-space: nowrap; 166 | border: 1px solid #e3e3e3; 167 | background-color: #f2f2f2; 168 | color: #0a0a0a; 169 | } 170 | 171 | pre > code { 172 | margin: 0; 173 | padding: 0; 174 | white-space: pre; 175 | border: none; 176 | background: transparent; 177 | } 178 | 179 | /* General typography */ 180 | p { 181 | font-size: 1.3em; 182 | margin: 1em 0; 183 | } 184 | 185 | b, strong { 186 | font-weight: bold; 187 | font-weight: 700; 188 | } 189 | 190 | blockquote { 191 | margin: 2em 4em; 192 | } 193 | 194 | small { 195 | display: block; 196 | font-size: 0.8rem; 197 | line-height: 1.2; 198 | } 199 | 200 | .footnote-ref, sup { 201 | font-size: 0.9rem; 202 | vertical-align: super; 203 | line-height: 0; 204 | } 205 | 206 | .footnotes { 207 | font-size: 80%; 208 | } 209 | 210 | .footnote-back { 211 | padding-left: 0.5em; 212 | } 213 | 214 | sub { 215 | font-size: 0.9rem; 216 | vertical-align: sub; 217 | } 218 | 219 | hr { 220 | -moz-border-bottom-colors: none; 221 | -moz-border-left-colors: none; 222 | -moz-border-right-colors: none; 223 | -moz-border-top-colors: none; 224 | border-color: -moz-use-text-color -moz-use-text-color #0a0a0a; 225 | border-image: none; 226 | border-style: none none solid; 227 | border-width: medium medium 1px; 228 | margin: 3em 6em; 229 | } 230 | 231 | /* Extra document parts */ 232 | .article-meta { 233 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 234 | font-weight: 300; 235 | } 236 | 237 | .title { 238 | font-size: 3.3em; 239 | } 240 | 241 | .subtitle { 242 | font-size: 1.9em; 243 | margin-top: 0; 244 | } 245 | 246 | .date { 247 | font-size: 1em; 248 | } 249 | 250 | .published { 251 | font-size: 1em; 252 | } 253 | 254 | .code-repo { 255 | font-size: 0.8em; 256 | } 257 | 258 | .authors { 259 | margin: 2em 0; 260 | } 261 | 262 | .author { 263 | font-size: 1.5em; 264 | margin-bottom: 0; 265 | } 266 | 267 | .affilation { 268 | font-size: 1em; 269 | margin-top: 0; 270 | } 271 | 272 | .abstract { 273 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 274 | font-weight: 300; 275 | font-size: 1em; 276 | margin: 0 3em 0; 277 | padding: 5px; 278 | } 279 | 280 | .keywords { 281 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 282 | font-weight: 300; 283 | font-size: 1em; 284 | margin: 1.5em 3em 0; 285 | padding: 5px; 286 | } 287 | 288 | .acknowledgments { 289 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 290 | font-weight: 300; 291 | font-size: 1em; 292 | margin: 2em 3em; 293 | padding: 5px; 294 | background: #f2f2f2; 295 | } 296 | 297 | .keywords-title, .acknowledgments-title { 298 | font-weight: 700; 299 | font-style: italic; 300 | } 301 | 302 | .epigraph-wrapper { 303 | overflow: hidden; 304 | } 305 | 306 | .epigraph { 307 | width: 50%; 308 | float: right; 309 | color: #8a8a8a; 310 | font-size: 0.9em; 311 | } 312 | 313 | .epigraph-text { 314 | padding-top: 0.8em; 315 | font-style: italic; 316 | } 317 | 318 | .epigraph-source { 319 | text-align: right; 320 | } 321 | 322 | p.epigraph-text { 323 | margin-bottom: 0; 324 | } 325 | 326 | p.epigraph-source { 327 | margin-top: 0; 328 | } 329 | 330 | .references .csl-entry { 331 | padding-left: 3rem; 332 | text-indent: -3rem; 333 | font-size: 1.1em; 334 | line-height: 1.3; 335 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 336 | font-weight: 300; 337 | } 338 | 339 | /* Images */ 340 | /* figure { 341 | display: inline-block; 342 | position: relative; 343 | margin: 1em 0 2em; 344 | text-align: center; 345 | } 346 | 347 | img { 348 | margin: 0 auto; 349 | border: 0 none; 350 | display: block; 351 | width: auto; 352 | max-width: 100%; 353 | } */ 354 | figure { 355 | display: table; 356 | text-align: center; 357 | margin: 0 auto; 358 | } 359 | 360 | figure img { 361 | display: block; 362 | max-width: 100%; 363 | } 364 | 365 | figcaption { 366 | display: table-caption; 367 | caption-side: bottom; 368 | } 369 | 370 | p img { 371 | display: inline; 372 | } 373 | 374 | /* Lists */ 375 | ol > li:before { 376 | color: #0a0a0a; 377 | content: counter(ol, decimal) "."; 378 | counter-increment: ol; 379 | margin-right: 0.333em; 380 | position: absolute; 381 | right: 100%; 382 | } 383 | 384 | ul > li:before { 385 | background-color: #0a0a0a; 386 | border-radius: 50%; 387 | content: ""; 388 | height: 0.3em; 389 | width: 0.3em; 390 | margin-right: 0.5em; 391 | margin-top: 0.6em; 392 | position: absolute; 393 | right: 100%; 394 | } 395 | 396 | ol, ul, dl { 397 | margin-left: 3.1em; 398 | padding: 0; 399 | font-size: 1.3em; 400 | } 401 | 402 | ol ol, ul ul, dl dl, 403 | dl ol, dl ul { 404 | margin-left: 2em; 405 | font-size: 100%; 406 | } 407 | 408 | dl ol, dl ul { 409 | margin-bottom: 0.75em; 410 | } 411 | 412 | ol p, ul p, dl p { 413 | font-size: 100%; 414 | } 415 | 416 | dl table { 417 | font-size: 80%; 418 | } 419 | 420 | ol { 421 | counter-reset: ol; 422 | } 423 | 424 | li + li, dd + dt { 425 | margin-top: 0em; 426 | } 427 | 428 | ul > li { 429 | position: relative; 430 | } 431 | 432 | ol > li { 433 | position: relative; 434 | } 435 | 436 | li { 437 | list-style: none outside none; 438 | } 439 | 440 | dt { 441 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 442 | font-weight: 300; 443 | padding-top: 0.5em; 444 | font-size: 0.9em; 445 | } 446 | 447 | /* Tables */ 448 | tbody { 449 | display: table-row-group; 450 | } 451 | 452 | tfoot { 453 | display: table-footer-group; 454 | } 455 | 456 | table { 457 | margin-bottom: 2em; 458 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 459 | padding: 0; 460 | border-collapse: collapse; 461 | width: 90%; 462 | margin: 0 auto 2em auto; 463 | } 464 | 465 | table th, table td { 466 | padding: 10px 10px 9px; 467 | line-height: 18px; 468 | text-align: left; 469 | font-size: 1em; 470 | line-height: 1.4; 471 | } 472 | 473 | table th { 474 | padding-top: 9px; 475 | vertical-align: middle; 476 | font-weight: 700; 477 | } 478 | 479 | table td { 480 | vertical-align: top; 481 | border-top: 1px solid #d6d6d6; 482 | font-weight: 300; 483 | } 484 | 485 | tbody tr:nth-child(odd) { 486 | /* background-color: $color-text-lightest; */ 487 | } 488 | 489 | table ul, table ol { 490 | margin-top: 0; 491 | margin-left: 1em; 492 | font-size: 100%; 493 | } 494 | 495 | /* Captions */ 496 | caption, figcaption { 497 | font-family: "Work Sans", "Roboto Condensed", sans-serif; 498 | font-size: 1em; 499 | text-align: left; 500 | background: #f2f2f2; 501 | padding: 4px 8px; 502 | margin: 4px 0; 503 | } 504 | 505 | figure > figcaption { 506 | margin-top: 0.25em; 507 | } 508 | 509 | /* Print */ 510 | @media print { 511 | html { 512 | font-size: 130%; 513 | } 514 | 515 | body { 516 | padding-left: 0; 517 | padding-right: 0; 518 | max-width: 100%; 519 | } 520 | 521 | ul > li:before { 522 | height: 0.325em; 523 | width: 0.325em; 524 | } 525 | } 526 | 527 | /*# sourceMappingURL=ath-clean.css.map */ 528 | -------------------------------------------------------------------------------- /manuscript/pandoc/templates/ath-manuscript.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/manuscript/pandoc/templates/ath-manuscript.docx -------------------------------------------------------------------------------- /manuscript/pandoc/templates/html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $for(author-meta)$ 7 | 8 | $endfor$ 9 | $if(date-meta)$ 10 | 11 | $endif$ 12 | $if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ 13 | 14 | 17 | $if(quotes)$ 18 | 19 | $endif$ 20 | 21 | $if(highlighting-css)$ 22 | 25 | $endif$ 26 | $for(css)$ 27 | 28 | $endfor$ 29 | $if(math)$ 30 | $math$ 31 | $endif$ 32 | $for(header-includes)$ 33 | $header-includes$ 34 | $endfor$ 35 | 36 | 37 | $for(include-before)$ 38 | $include-before$ 39 | $endfor$ 40 | $if(title)$ 41 | 69 | $endif$ 70 | $if(toc)$ 71 | 74 | $endif$ 75 | 76 | $if(abstract)$ 77 |
$abstract$
78 | $endif$ 79 | 80 | $if(keywords)$ 81 |
Keywords—$keywords$
82 | $endif$ 83 | 84 | $if(blinded)$ 85 | 86 | $else$ 87 | $if(thanks)$ 88 |
Acknowledgments: $thanks$
89 | $endif$ 90 | $endif$ 91 | 92 | $if(epigraph)$ 93 |
94 |
95 | $for(epigraph)$ 96 | $if(epigraph.source)$ 97 |

$epigraph.text$

98 |

—$epigraph.source$

99 | $else$ 100 |

$epigraph.text$

101 | $endif$ 102 | $endfor$ 103 |
104 |
105 | $endif$ 106 | 107 | $if(keywords)$ 108 | 109 | $endif$ 110 | 111 |
112 | $body$ 113 |
114 | 115 | $for(include-after)$ 116 | $include-after$ 117 | $endfor$ 118 | 119 | 120 | -------------------------------------------------------------------------------- /manuscript/pandoc/templates/odt-manuscript.odt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | $automatic-styles$ 12 | 13 | $for(header-includes)$ 14 | $header-includes$ 15 | $endfor$ 16 | 17 | 18 | 19 | $if(title)$ 20 | $title$ 21 | $endif$ 22 | 23 | $if(blinded)$ 24 | 25 | $else$ 26 | $for(author)$ 27 | $author.name$ 28 | $author.affiliation$ 29 | $author.email$ 30 | $endfor$ 31 | $endif$ 32 | 33 | $if(date)$ 34 | $date$ 35 | $endif$ 36 | 37 | $if(abstract)$ 38 | Abstract: $abstract$ 39 | $endif$ 40 | 41 | $if(keywords)$ 42 | Keywords: $keywords$ 43 | $endif$ 44 | 45 |   46 | 47 | $if(epigraph)$ 48 | $for(epigraph)$ 49 | $if(epigraph.source)$ 50 | $epigraph.text$ 51 | —$epigraph.source$ 52 | 53 | $else$ 54 | $epigraph.text$ 55 | 56 | $endif$ 57 | $endfor$ 58 | $endif$ 59 | 60 | $for(include-before)$ 61 | $include-before$ 62 | $endfor$ 63 | $body$ 64 | $for(include-after)$ 65 | $include-after$ 66 | $endfor$ 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /manuscript/pandoc/templates/odt.odt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | $automatic-styles$ 12 | 13 | $for(header-includes)$ 14 | $header-includes$ 15 | $endfor$ 16 | 17 | 18 | $if(memo)$ 19 | To:$to$ 20 | From:$for(author)$$author.name$$if(author.email)$ ($author.email$)$endif$$sep$, $endfor$ 21 | Date:$date$ 22 | Subject:$title$ 23 | 24 | $else$ 25 | 26 | $if(published)$ 27 | $published$ 28 | $endif$ 29 | 30 | $if(blinded)$ 31 | $if(title)$ 32 | $title$ 33 | $endif$ 34 | $else$ 35 | $if(title)$ 36 | $title$$if(thanks)$*$thanks$$endif$ 37 | $endif$ 38 | $endif$ 39 | 40 | 41 | $if(blinded)$ 42 | 43 | $else$ 44 | $for(author)$ 45 | $author.name$ 46 | $author.affiliation$ 47 | $author.email$ 48 | $endfor$ 49 | $endif$ 50 | 51 | $if(date)$ 52 | $date$ 53 | $endif$ 54 | 55 | $if(abstract)$ 56 | Abstract: $abstract$ 57 | $endif$ 58 | 59 | $if(epigraph)$ 60 | $for(epigraph)$ 61 | $if(epigraph.source)$ 62 | $epigraph.text$ 63 | —$epigraph.source$ 64 | $else$ 65 | $epigraph.text$ 66 | $endif$ 67 | $endfor$ 68 | $endif$ 69 | 70 | $endif$ 71 | 72 | $for(include-before)$ 73 | $include-before$ 74 | $endfor$ 75 | $body$ 76 | $for(include-after)$ 77 | $include-after$ 78 | $endfor$ 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /manuscript/pandoc/templates/reference-manuscript.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/manuscript/pandoc/templates/reference-manuscript.odt -------------------------------------------------------------------------------- /manuscript/pandoc/templates/reference.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/who-cares-about-crackdown/26639e33739c4dd47f4e6741eebccfb3cb2b0eed/manuscript/pandoc/templates/reference.odt -------------------------------------------------------------------------------- /manuscript/pandoc/templates/xelatex-manuscript.tex: -------------------------------------------------------------------------------- 1 | %!TEX program = xelatex 2 | % Adapted in part from Nicholas Reith's Journal Article Manuscript Template 3 | % https://www.overleaf.com/latex/templates/journal-article-manuscript-template/yhxfrgxqdthx 4 | \documentclass[letterpaper,12pt]{article} 5 | 6 | % --------------- 7 | % GENERAL SETUP 8 | % --------------- 9 | \usepackage[american]{babel} 10 | \usepackage[babel]{csquotes} 11 | \usepackage{enumitem} 12 | \usepackage{etoolbox} 13 | \setlength{\parindent}{0.5in} 14 | 15 | 16 | % ------- 17 | % FONTS 18 | % ------- 19 | % Math stuff 20 | \usepackage{amsmath, amssymb, amsfonts, amsthm} 21 | \usepackage{unicode-math} % For custom math fonts 22 | 23 | % Custom fonts 24 | \usepackage{fontspec} 25 | \usepackage{xunicode} 26 | \defaultfontfeatures{Mapping=tex-text,Ligatures=TeX,Scale=MatchLowercase} 27 | \setmainfont{Linux Libertine O} 28 | \setsansfont{Source Sans Pro} 29 | \setmonofont[Mapping=tex-ansi, Scale=MatchLowercase]{InconsolataGo} 30 | \setmathfont{Libertinus Math} 31 | 32 | 33 | % --------------- 34 | % TITLE SECTION 35 | % --------------- 36 | % Abstract 37 | \usepackage{abstract} 38 | \renewcommand{\abstractnamefont}{\normalfont\normalsize\bfseries} 39 | \renewcommand{\abstracttextfont}{\normalsize} 40 | \setlength{\absleftindent}{\parindent} 41 | \setlength{\absrightindent}{\parindent} 42 | 43 | % Title 44 | \usepackage{titlesec} % Allows customization of titles 45 | 46 | % Authors 47 | \usepackage{authblk} % For multiple authors 48 | 49 | % Keywords 50 | \providecommand{\keywords}[1]{\textbf{\textit{Keywords---}}#1} 51 | 52 | 53 | % ------------------- 54 | % PAGE LAYOUT SUTFF 55 | % ------------------- 56 | % For landscape PDF pages 57 | \usepackage{pdflscape} 58 | 59 | % For better TOCs 60 | \usepackage{tocloft} 61 | 62 | % Page margins 63 | \usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry} 64 | 65 | % Ensure that figures are floated where or after they're defined 66 | \usepackage{flafter} 67 | 68 | % Running header stuff 69 | \usepackage{fancyhdr} 70 | \setlength{\headheight}{0.25in} 71 | \renewcommand{\headrulewidth}{0pt} % Remove lines 72 | \renewcommand{\footrulewidth}{0pt} 73 | 74 | % SHORT TITLE Page # 75 | \fancypagestyle{normal}{ 76 | \fancyhf{} 77 | \lhead{\uppercase{$if(short-title)$ $short-title$ $else$ $title$ $endif$}} 78 | \rhead{\thepage} 79 | } 80 | 81 | % Running head: SHORT TITLE Page # 82 | \fancypagestyle{title}{ 83 | \fancyhf{} 84 | \lhead{Running head: \uppercase{$if(short-title)$ $short-title$ $else$ $title$ $endif$}} 85 | \rhead{} 86 | } 87 | 88 | % Use regular heading style 89 | \pagestyle{normal} 90 | 91 | 92 | % ------------------ 93 | % TYPOGRAPHY STUFF 94 | % ------------------ 95 | % Pandoc tightlists 96 | \providecommand{\tightlist}{% 97 | \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 98 | 99 | % Fix widows and orphans 100 | \usepackage[all,defaultlines=2]{nowidow} 101 | 102 | % Don't typeset URLs in a monospaced font 103 | \usepackage{url} 104 | \urlstyle{same} 105 | % Add - to url's default breaks 106 | \def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]% 107 | \do\)\do\,\do\?\do\&\do\'\do+\do\=\do\#\do-} 108 | 109 | % Wrap definition list terms 110 | % https://tex.stackexchange.com/a/9763/11851 111 | \setlist[description]{style=unboxed} 112 | 113 | % Format section headings 114 | \titleformat*{\section}{\center\large\bfseries} 115 | \titleformat*{\subsection}{\large\bfseries} 116 | \titleformat*{\subsubsection}{\normalsize\bfseries} 117 | 118 | % Disable section numbering 119 | \setcounter{secnumdepth}{0} 120 | 121 | % Fancier verbatims 122 | \usepackage{fancyvrb} 123 | 124 | % Line spacing 125 | \usepackage{setspace} 126 | 127 | % Single spacing in code chunks 128 | \AtBeginEnvironment{verbatim}{\singlespacing} 129 | 130 | % Hyperlink stuff 131 | \usepackage[xetex, colorlinks=true, urlcolor=DarkSlateBlue, 132 | citecolor=DarkSlateBlue, filecolor=DarkSlateBlue, plainpages=false, 133 | hyperfootnotes=false, % For compatibility with footmisc 134 | pdfpagelabels, bookmarksnumbered]{hyperref} 135 | 136 | % Color names for hyperlinks 137 | \usepackage[svgnames]{xcolor} 138 | 139 | % Epigraphs 140 | $if(epigraph)$ 141 | \usepackage{epigraph} 142 | \renewcommand{\epigraphsize}{\footnotesize} 143 | \setlength{\epigraphrule}{0pt} 144 | $endif$ 145 | 146 | % Syntax highlighting stuff 147 | $if(highlighting-macros)$ 148 | $highlighting-macros$ 149 | $endif$ 150 | 151 | 152 | % -------- 153 | % MACROS 154 | % -------- 155 | \newcommand{\blandscape}{\begin{landscape}} 156 | \newcommand{\elandscape}{\end{landscape}} 157 | \newcommand{\stgroup}{\begingroup} 158 | \newcommand{\fingroup}{\endgroup} 159 | 160 | \newcommand{\memSingle}{} 161 | \newcommand{\memSingleSmall}{} 162 | 163 | 164 | % -------- 165 | % TABLES 166 | % -------- 167 | \usepackage{booktabs} 168 | \usepackage{longtable} 169 | \usepackage{pbox} % For multi-line table cells 170 | 171 | % Things that kableExtra needs 172 | \usepackage{array} 173 | \usepackage{multirow} 174 | \usepackage{wrapfig} 175 | \usepackage{float} 176 | \usepackage{colortbl} 177 | \usepackage{tabu} 178 | \usepackage{threeparttable} 179 | \usepackage{threeparttablex} 180 | \usepackage[normalem]{ulem} 181 | \usepackage{makecell} 182 | 183 | % Make table text slightly smaller, but not captions 184 | \usepackage[font=normalsize]{caption} 185 | \AtBeginEnvironment{longtable}{\small} 186 | \AtBeginEnvironment{tabular}{\small} 187 | 188 | % Remove left margin in lists inside longtables 189 | % https://tex.stackexchange.com/a/378190/11851 190 | \AtBeginEnvironment{longtable}{\setlist[itemize]{nosep, wide=0pt, leftmargin=*, before=\vspace*{-\baselineskip}, after=\vspace*{-\baselineskip}}} 191 | 192 | 193 | % ---------- 194 | % GRAPHICS 195 | % ---------- 196 | \usepackage{graphicx} 197 | \makeatletter 198 | \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} 199 | \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} 200 | \makeatother 201 | % Scale images if necessary, so that they will not overflow the page 202 | % margins by default, and it is still possible to overwrite the defaults 203 | % using explicit options in \includegraphics[width, height, ...]{} 204 | \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} 205 | 206 | 207 | % ------------ 208 | % REFERENCES 209 | % ------------ 210 | % NB: Using "strict" messes with footnotes and removes the rule! 211 | $if(biblatex)$ 212 | 213 | $if(bibstyle-chicago-notes)$ 214 | \usepackage[notes, backend=biber, 215 | autolang=hyphen, bibencoding=inputenc, 216 | isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup 217 | $endif$ 218 | $if(bibstyle-chicago-authordate)$ 219 | \usepackage[authordate, backend=biber, noibid, 220 | autolang=hyphen, bibencoding=inputenc, 221 | isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup 222 | $endif$ 223 | $if(bibstyle-apa)$ 224 | \usepackage[style=apa, backend=biber]{biblatex} 225 | \DeclareLanguageMapping{american}{american-apa} 226 | $endif$ 227 | 228 | % No space between bib entries 229 | \setlength\bibitemsep{0pt} 230 | 231 | %% Fix biblatex's odd preference for using In: by default. 232 | \renewbibmacro{in:}{% 233 | \ifentrytype{article}{}{% 234 | \printtext{\bibstring{}\intitlepunct}}} 235 | 236 | %% bibnamedash: with Minion Pro the three-emdash lines in the 237 | %% bibliogrpaphy end up separated from one another, which is very 238 | %% annoying. Replace them with a line of appropriate size and weight. 239 | \renewcommand{\bibnamedash}{\rule[3.5pt]{3em}{0.5pt}} 240 | 241 | \addbibresource{$bibliography$} 242 | \setlength\bibhang{\parindent} 243 | $endif$ 244 | 245 | 246 | % ----------- 247 | % FOOTNOTES 248 | % ----------- 249 | % NB: footmisc has to come after setspace and biblatex because of conflicts 250 | \usepackage[bottom, flushmargin]{footmisc} 251 | \renewcommand*{\footnotelayout}{\footnotesize} 252 | 253 | \addtolength{\skip\footins}{12pt} % vertical space between rule and main text 254 | \setlength{\footnotesep}{16pt} % vertical space between footnotes 255 | 256 | 257 | % ----------------------- 258 | % ENDFLOAT AND ENDNOTES 259 | % ----------------------- 260 | $if(endfloat)$ 261 | \usepackage[nolists]{endfloat} 262 | \DeclareDelayedFloatFlavour*{longtable}{table} 263 | $endif$ 264 | 265 | $if(endnotes)$ 266 | \usepackage{endnotes} 267 | \renewcommand{\enotesize}{\normalsize} 268 | \let\footnote=\endnote 269 | $endif$ 270 | 271 | 272 | % ------------------------------------------------------------------------------ 273 | % ------------------------------------------------------------------------------ 274 | % ------------------------------------------------------------------------------ 275 | 276 | % ---------------- 277 | % ACTUAL DOCUMENT 278 | % ---------------- 279 | 280 | \begin{document} 281 | 282 | 283 | % ------------ 284 | % TITLE PAGE 285 | % ------------ 286 | $if(title-page)$ 287 | 288 | \begin{titlepage} 289 | \thispagestyle{title} 290 | \center 291 | 292 | \vspace*{0.5in} 293 | {\large\bfseries $title$} 294 | 295 | \vspace{\baselineskip} 296 | 297 | $for(author)$ 298 | $author.name$ \\ 299 | $author.affiliation$ \\ 300 | $if(author.twitter)$@$author.twitter$ \\$endif$ 301 | 302 | $sep$ \vspace{\baselineskip} 303 | $endfor$ 304 | 305 | \vspace{0.25in} 306 | 307 | $if(word-count)$ 308 | {\center Word count: $word-count$} 309 | $endif$ 310 | 311 | \vspace{0.5in} 312 | 313 | $if(author-note)$ 314 | {\center Author note} 315 | 316 | \begin{flushleft} 317 | $author-note$ 318 | \end{flushleft} 319 | $endif$ 320 | 321 | $if(correspondence)$ 322 | {\center Correspondence} 323 | 324 | \begin{flushleft} 325 | $correspondence$ 326 | \end{flushleft} 327 | $endif$ 328 | 329 | $if(additional-info)$ 330 | {\center Additional information} 331 | 332 | \begin{flushleft} 333 | $additional-info$ 334 | \end{flushleft} 335 | $endif$ 336 | 337 | $if(thanks)$ 338 | {\center Acknowledgments} 339 | 340 | \begin{flushleft} 341 | $thanks$ 342 | \end{flushleft} 343 | $endif$ 344 | 345 | \vfill % Fill the rest of the page with whitespace 346 | 347 | \end{titlepage} 348 | 349 | \doublespacing 350 | 351 | \begin{abstract} 352 | \noindent $abstract$ 353 | \end{abstract} 354 | 355 | \vspace{\baselineskip} 356 | 357 | $if(keywords)$\indent \keywords{$keywords$}$endif$ 358 | 359 | \newpage 360 | 361 | $endif$ 362 | 363 | 364 | % ------------------------ 365 | % ACTUAL ACTUAL DOCUMENT 366 | % ------------------------ 367 | 368 | \begin{center} 369 | {\large\bfseries $title$} 370 | \end{center} 371 | 372 | $if(toc)$ 373 | { 374 | \hypersetup{linkcolor=black} 375 | \setcounter{tocdepth}{$toc-depth$} 376 | \tableofcontents 377 | $if(toc-figures)$ 378 | \listoffigures 379 | $endif$ 380 | $if(toc-tables)$ 381 | \listoftables 382 | $endif$ 383 | } 384 | $endif$ 385 | 386 | $if(epigraph)$ 387 | $for(epigraph)$ 388 | $if(epigraph.source)$ 389 | \epigraph{$epigraph.text$}{---$epigraph.source$} 390 | $else$ 391 | \epigraph{$epigraph.text$} 392 | $endif$ 393 | $endfor$ 394 | $endif$ 395 | 396 | \doublespacing 397 | 398 | $body$ 399 | 400 | \clearpage 401 | \singlespacing 402 | \printbibliography[heading=bibliography$if(reference-section-title)$, title=$reference-section-title$$endif$] 403 | 404 | $if(endnotes)$ 405 | \clearpage 406 | \begingroup 407 | \parindent 0pt 408 | \parskip 1em 409 | \theendnotes 410 | \endgroup 411 | $endif$ 412 | 413 | \end{document} 414 | -------------------------------------------------------------------------------- /manuscript/pandoc/templates/xelatex.tex: -------------------------------------------------------------------------------- 1 | %!TEX program = xelatex 2 | \documentclass[$if(fontsize)$$fontsize$,$else$11pt,$endif$article,oneside]{memoir} 3 | 4 | % Disable all warnings issued by biblatex starting with "Since you are using the 'memoir' class..." 5 | \usepackage{silence} 6 | \WarningFilter{biblatex}{Since you are using the} 7 | % Not all fonts have fancy OpenType features like proportional and oldstyle 8 | % figures, so this suppresses fontspec's warnings when using those kinds of fonts 9 | \PassOptionsToPackage{quiet}{fontspec} 10 | 11 | 12 | % --------------- 13 | % GENERAL SETUP 14 | % --------------- 15 | \usepackage[american]{babel} 16 | \usepackage[babel]{csquotes} 17 | \usepackage{enumitem} 18 | \usepackage{etoolbox} 19 | 20 | \setlength{\parindent}{1.5em} 21 | 22 | 23 | % ------- 24 | % FONTS 25 | % ------- 26 | % Math stuff 27 | \usepackage{amsmath, amssymb, amsfonts, amsthm} 28 | \usepackage{unicode-math} % For custom math fonts 29 | 30 | % Custom fonts 31 | \usepackage{fontspec} 32 | \usepackage{xunicode} 33 | \defaultfontfeatures{Mapping=tex-text,Ligatures=TeX,Scale=MatchLowercase} 34 | $if(mainfont)$ 35 | \setmainfont[Numbers={Proportional,OldStyle}]{$mainfont$} 36 | $else$ 37 | \setmainfont[Numbers={Proportional,OldStyle}]{Linux Libertine O} 38 | $endif$ 39 | $if(sansfont)$ 40 | \setsansfont{$sansfont$} 41 | $else$ 42 | \setsansfont{Source Sans Pro} 43 | $endif$ 44 | $if(monofont)$ 45 | \setmonofont[Mapping=tex-ansi, Scale=MatchLowercase]{$monofont$} 46 | $else$ 47 | \setmonofont[Mapping=tex-ansi, Scale=MatchLowercase]{InconsolataGo} 48 | $endif$ 49 | $if(mathfont)$ 50 | \setmathfont{$mathfont$} 51 | $else$ 52 | \setmathfont{Libertinus Math} 53 | $endif$ 54 | 55 | 56 | % --------------- 57 | % TITLE SECTION 58 | % --------------- 59 | % Keywords 60 | \providecommand{\keywords}[1]{\small{\sffamily{\textbf{\textit{Keywords---}}#1 \vskip 3em}}} 61 | 62 | % Redefine \and and \andnext to remove tabular environment. 63 | % Needed below for custom article-styles when multiple authors are present. 64 | \renewcommand{\and}{\, } 65 | \renewcommand*{\andnext}{% 66 | \\\medskip } 67 | 68 | % Command for a note at the top of the first page describing the publication 69 | % status of the paper. 70 | \newcommand{\published}[1]{% 71 | \gdef\puB{#1}} 72 | \newcommand{\puB}{} 73 | \renewcommand{\maketitlehooka}{% 74 | \par\noindent\footnotesize\sffamily \puB} 75 | 76 | 77 | % -------------------------------- 78 | % MEMOIR CHAPTER AND PAGE STYLES 79 | % -------------------------------- 80 | % Main style 81 | \makechapterstyle{hikma-article}{ 82 | % Heading 1 83 | \setsecheadstyle{\Large\sffamily\bfseries} 84 | \setbeforesecskip{-4.5ex} % Space before; if negative, next paragraph will not be indented 85 | \setaftersecskip{1ex} % Space after 86 | 87 | % Heading 2 88 | \setsubsecheadstyle{\large\sffamily} 89 | \setbeforesubsecskip{-2.5ex} 90 | \setaftersubsecskip{0.7ex} 91 | 92 | % Heading 3 93 | \setaftersubsubsecskip{-1em} % Inline heading 94 | \setsubsubsecheadstyle{\normalsize\sffamily\bfseries} 95 | \setbeforesubsubsecskip{1.5ex} 96 | 97 | % Captions 98 | \captiontitlefont{\small\sffamily} 99 | \captionnamefont{\small\sffamily} 100 | \subcaptionsize{\small} 101 | \subcaptionlabelfont{\sffamily} 102 | \subcaptionfont{\sffamily} 103 | 104 | % TOC stuff 105 | \settocdepth{subsubsection} 106 | \maxsecnumdepth{subsubsection} 107 | \setsecnumdepth{chapter} 108 | 109 | % Change formatting in title block 110 | \pretitle{\par\vskip 3em \flushleft\LARGE\sffamily\bfseries} 111 | \posttitle{\par\vskip 0.75em} 112 | \preauthor{\flushleft\sffamily} 113 | \postauthor{} 114 | \predate{\normalsize} 115 | \postdate{} 116 | 117 | % Abstract stuff 118 | \renewcommand{\abstractname}{\vspace{-\baselineskip}} % Remove abstract title 119 | \renewcommand{\abstracttextfont}{\small\sffamily} 120 | 121 | \epigraphfontsize{\normalfont\footnotesize} 122 | \setlength\epigraphwidth{186pt} % 15p6 (31p0 / 2) 123 | \setlength\epigraphrule{0pt} 124 | 125 | % Footnotes 126 | \setfootins{3em}{3em} 127 | } 128 | 129 | % Numbered article style 130 | \makechapterstyle{hikma-article-numbered} { 131 | \chapterstyle{hikma-article} % Copy previous style 132 | \counterwithout{section}{chapter} % Make sections start at 1, not 0 133 | \settocdepth{subsubsection} 134 | \maxsecnumdepth{subsubsection} 135 | \setsecnumdepth{subsubsection} 136 | } 137 | 138 | % General page style 139 | \makepagestyle{ath} 140 | \makeatletter 141 | \newcommand{\@athmarks}{% 142 | \let\@mkboth\markboth 143 | \def\chaptermark##1{% 144 | \markboth{% 145 | \ifnum \c@secnumdepth >\m@ne 146 | \if@mainmatter 147 | \thechapter. \ % 148 | \fi 149 | \fi 150 | ##1}{}} 151 | \def\sectionmark##1{% 152 | \markright{##1}} 153 | } 154 | \makepsmarks{ath}{\@athmarks} 155 | \makepsmarks{ath}{} 156 | % For the first page 157 | \makeevenfoot{plain}{}{\sffamily\footnotesize\thepage}{} 158 | \makeoddfoot{plain}{}{\sffamily\footnotesize\thepage}{} 159 | % For regular pages 160 | \makeevenhead{ath}{}{}{\sffamily\footnotesize\thepage} 161 | \makeoddhead{ath}{}{}{\sffamily\footnotesize\thepage} 162 | \makeatother 163 | 164 | 165 | % ------------------- 166 | % PAGE LAYOUT SUTFF 167 | % ------------------- 168 | % For landscape PDF pages 169 | \usepackage{pdflscape} 170 | 171 | % For better TOCs 172 | \usepackage{tocloft} 173 | 174 | % Treat the TOC title as a section instead of a chapter 175 | \makeatletter 176 | \renewcommand\@tocmaketitle{% 177 | \section*{\contentsname} 178 | \tocmark% 179 | \@afterheading} 180 | \makeatother 181 | 182 | % Shift indentation back 183 | % See table showing tocloft's default indents and numwidths 184 | % https://tex.stackexchange.com/a/50472/11851 185 | \cftsetindents{section}{0em}{1.5em} 186 | \cftsetindents{subsection}{1.5em}{2.3em} 187 | \cftsetindents{subsubsection}{3.8em}{3.2em} 188 | 189 | % Use sans fonts for all parts of the TOC 190 | \renewcommand{\cftsectionfont}{\normalfont\sffamily} 191 | \renewcommand{\cftsectionpagefont}{\normalfont\sffamily} 192 | \renewcommand{\cftsubsectionfont}{\normalfont\sffamily} 193 | \renewcommand{\cftsubsectionpagefont}{\normalfont\sffamily} 194 | \renewcommand{\cftsubsubsectionfont}{\normalfont\sffamily} 195 | \renewcommand{\cftsubsubsectionpagefont}{\normalfont\sffamily} 196 | 197 | % Page margins 198 | % {left}{right}{ratio} - one has to be * 199 | % 10p0 left/right, 11p0 top/bottom 200 | % Text block is 31p0 wide, 44p0 tall 201 | \setlrmarginsandblock{10pc}{10pc}{*} % 10p0 202 | \setulmarginsandblock{11pc}{11pc}{*} % 11p0 203 | \checkandfixthelayout 204 | 205 | 206 | % ------------------ 207 | % TYPOGRAPHY STUFF 208 | % ------------------ 209 | % Pandoc tightlists 210 | \providecommand{\tightlist}{% 211 | \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 212 | 213 | % Fix widows and orphans 214 | \usepackage[all,defaultlines=2]{nowidow} 215 | 216 | % Add - as an acceptable hyphenation break in URLs 217 | \usepackage{url} 218 | \def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]% 219 | \do\)\do\,\do\?\do\&\do\'\do+\do\=\do\#\do-} 220 | 221 | % Ordinarily I'd like to make URLs not monospaced up here with other typographic 222 | % settings, but NOO because if you use apacite, it overwrites whatever 223 | % \urlstyle{} you use, so the actual \urlstyle{same} appears down below in 224 | % the REFERENCES section 225 | 226 | % Use "1. Note" in the footnotes 227 | \footmarkstyle{#1.\,} 228 | 229 | % Tweak \thanks{} stuff 230 | \thanksheadextra{\small}{} % Marker in title section 231 | \thanksmarkstyle{\footnotesize #1\,} % Actual note down in footnotes 232 | \let\oldthanks\thanks 233 | \renewcommand{\thanks}[1]{\oldthanks{\sffamily \footnotesize #1}} 234 | 235 | % Wrap definition list terms 236 | % https://tex.stackexchange.com/a/9763/11851 237 | \setlist[description]{style=unboxed} 238 | 239 | % Fancier verbatims 240 | \usepackage{fancyvrb} 241 | 242 | % Hyperlink stuff 243 | \usepackage[xetex, colorlinks=true, urlcolor=DarkSlateBlue, 244 | citecolor=DarkSlateBlue, filecolor=DarkSlateBlue, plainpages=false, 245 | pdfpagelabels, bookmarksnumbered]{hyperref} 246 | 247 | % Color names for hyperlinks 248 | \usepackage[svgnames]{xcolor} 249 | 250 | % Syntax highlighting stuff 251 | $if(highlighting-macros)$ 252 | $highlighting-macros$ 253 | $endif$ 254 | 255 | 256 | % -------- 257 | % MACROS 258 | % -------- 259 | \newcommand{\blandscape}{\begin{landscape}} 260 | \newcommand{\elandscape}{\end{landscape}} 261 | \newcommand{\stgroup}{\begingroup} 262 | \newcommand{\fingroup}{\endgroup} 263 | 264 | \DisemulatePackage{setspace} 265 | \usepackage{setspace} 266 | 267 | % \newcommand{\memSingle}{\setSingleSpace{1.15}\SingleSpacing} 268 | % \newcommand{\memSingleSmall}{\setSingleSpace{0.9}\SingleSpacing} 269 | 270 | % -------- 271 | % TABLES 272 | % -------- 273 | \usepackage{booktabs} 274 | \usepackage{longtable} 275 | \usepackage{pbox} % For multi-line table cells 276 | 277 | % Things that kableExtra needs 278 | \usepackage{array} 279 | \usepackage{multirow} 280 | \usepackage{wrapfig} 281 | \usepackage{float} 282 | \usepackage{colortbl} 283 | \usepackage{tabu} 284 | \usepackage{threeparttable} 285 | \usepackage{threeparttablex} 286 | \usepackage[normalem]{ulem} 287 | \usepackage{makecell} 288 | \usepackage{xcolor} 289 | 290 | % Make tables sans serif 291 | \setfloatadjustment{table}{\footnotesize\sffamily} 292 | % memoir's setfloatadjustment doesn't work on longtables, but this does 293 | \AtBeginEnvironment{longtable}{\footnotesize\sffamily} 294 | 295 | % Remove left margin in lists inside longtables 296 | % https://tex.stackexchange.com/a/378190/11851 297 | \AtBeginEnvironment{longtable}{\setlist[itemize]{nosep, wide=0pt, leftmargin=*, before=\vspace*{-\baselineskip}, after=\vspace*{-\baselineskip}}} 298 | 299 | 300 | % ---------- 301 | % GRAPHICS 302 | % ---------- 303 | \usepackage{graphicx} 304 | \makeatletter 305 | \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} 306 | \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} 307 | \makeatother 308 | % Scale images if necessary, so that they will not overflow the page 309 | % margins by default, and it is still possible to overwrite the defaults 310 | % using explicit options in \includegraphics[width, height, ...]{} 311 | \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} 312 | 313 | 314 | % -------------- 315 | % I18N SUPPORT 316 | % -------------- 317 | % This has to come before loading biblatex 318 | \usepackage{polyglossia} 319 | \setdefaultlanguage{english} 320 | \setotherlanguage{arabic} 321 | \newfontfamily\arabicfont[Script = Arabic]{Amiri} 322 | 323 | 324 | % ------------ 325 | % REFERENCES 326 | % ------------ 327 | % NB: Using "strict" messes with footnotes and removes the rule! 328 | $if(biblatex)$ 329 | 330 | $if(bibstyle-chicago-notes)$ 331 | \usepackage[notes, backend=biber, 332 | autolang=hyphen, bibencoding=inputenc, 333 | isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup 334 | $endif$ 335 | $if(bibstyle-chicago-authordate)$ 336 | \usepackage[authordate, backend=biber, noibid, 337 | autolang=hyphen, bibencoding=inputenc, 338 | isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup 339 | $endif$ 340 | $if(bibstyle-apa)$ 341 | \usepackage[style=apa, backend=biber]{biblatex} 342 | \DeclareLanguageMapping{american}{american-apa} 343 | $endif$ 344 | 345 | % No space between bib entries + use smaller font 346 | \setlength\bibitemsep{0pt} 347 | \renewcommand*{\bibfont}{\footnotesize} 348 | 349 | %% Fix biblatex's odd preference for using In: by default. 350 | \renewbibmacro{in:}{% 351 | \ifentrytype{article}{}{% 352 | \printtext{\bibstring{}\intitlepunct}}} 353 | 354 | %% bibnamedash: with Minion Pro the three-emdash lines in the 355 | %% bibliogrpaphy end up separated from one another, which is very 356 | %% annoying. Replace them with a line of appropriate size and weight. 357 | \renewcommand{\bibnamedash}{\rule[3.5pt]{3em}{0.5pt}} 358 | 359 | \addbibresource{$bibliography$} 360 | \setlength\bibhang{\parindent} 361 | $endif$ 362 | 363 | % Don't typeset URLs in a monospaced font 364 | % This has to come after apacite because apacite sets its own URL style 365 | \urlstyle{same} 366 | 367 | 368 | % ---------- 369 | % METADATA 370 | % ---------- 371 | % Add PDF metadata 372 | \hypersetup{pdfinfo={ 373 | Title={$title$}, 374 | Author={$for(author)$$author.name$$sep$, $endfor$}, 375 | Creator={R Markdown, pandoc, and TeX}, 376 | Keywords={$if(keywords)$$keywords$$endif$} 377 | % Subject={}, 378 | }} 379 | 380 | % Add content from pandoc metadata 381 | $if(title)$ 382 | \title{\bigskip \bigskip $title$$if(thanks)$\thanks{$thanks$}$endif$} 383 | $endif$ 384 | 385 | \author{ 386 | $for(author)$ 387 | \large $author.name$ \newline 388 | \footnotesize $author.affiliation$ \newline 389 | \footnotesize \url{$author.email$}\vspace*{1.1em}\newline 390 | $sep$ \and 391 | $endfor$ 392 | } 393 | 394 | \date{} 395 | 396 | 397 | % --------------------- 398 | % RESPONSE MEMO STUFF 399 | % --------------------- 400 | $if(response)$ 401 | \newcommand{\responseheader}{ 402 | % \vspace*{1.2in} 403 | \noindent\textsf{\textbf{\Large $title$}} 404 | \vspace*{0.4in} 405 | } 406 | 407 | \definecolor{orange}{HTML}{D55E00} 408 | \definecolor{blue}{HTML}{0072B2} 409 | 410 | \newenvironment{reviewer}{\color{orange}\sffamily}{} 411 | \newcommand{\breviewer}{\begin{reviewer}} 412 | \newcommand{\ereviewer}{\end{reviewer}} 413 | 414 | \newenvironment{excerpt}{\color{blue}}{} 415 | \newcommand{\bexcerpt}{\begin{excerpt}} 416 | \newcommand{\eexcerpt}{\end{excerpt}} 417 | 418 | \setulmarginsandblock{1in}{1in}{*} 419 | \setlrmarginsandblock{1in}{1in}{*} 420 | \checkandfixthelayout 421 | $endif$ 422 | 423 | 424 | % ------------------------------------------------------------------------------ 425 | % ------------------------------------------------------------------------------ 426 | % ------------------------------------------------------------------------------ 427 | 428 | % ---------------- 429 | % ACTUAL DOCUMENT 430 | % ---------------- 431 | 432 | \begin{document} 433 | 434 | $if(chapterstyle)$ 435 | \chapterstyle{$chapterstyle$} 436 | $else$ 437 | \chapterstyle{hikma-article} 438 | $endif$ 439 | $if(pagestyle)$ 440 | \pagestyle{$pagestyle$} 441 | $else$ 442 | \pagestyle{ath} 443 | $endif$ 444 | 445 | $if(response)$ 446 | % If this is a peer review response, use the simple heading 447 | \responseheader 448 | $else$ 449 | % Otherwise, use the normal article title + abstract + epigraph 450 | $if(published)$ 451 | $if(code-repo)$ 452 | \published{\textbf{$date$} \qquad $published$ \\ {\tiny $code-repo$}} 453 | $else$ 454 | \published{\textbf{$date$} \qquad {\tiny $published$}} 455 | $endif$ 456 | $else$ 457 | $if(code-repo)$ 458 | \published{\textbf{$date$} \\ {\tiny $code-repo$}} 459 | $else$ 460 | \published{\textbf{$date$}} 461 | $endif$ 462 | $endif$ 463 | 464 | $if(title)$ 465 | \maketitle 466 | $endif$ 467 | 468 | $if(toc)$ 469 | { 470 | \hypersetup{linkcolor=black} 471 | \setcounter{tocdepth}{$toc-depth$} 472 | \tableofcontents* 473 | } 474 | $endif$ 475 | 476 | $if(abstract)$ 477 | \begin{abstract} 478 | \noindent $abstract$ 479 | \bigskip 480 | \end{abstract} 481 | $else$ 482 | \vskip 5em 483 | $endif$ 484 | 485 | $if(keywords)$ 486 | \keywords{$keywords$} 487 | $endif$ 488 | 489 | $if(epigraph)$ 490 | $for(epigraph)$ 491 | $if(epigraph.source)$ 492 | \epigraph{$epigraph.text$}{---$epigraph.source$} 493 | $else$ 494 | \epigraph{$epigraph.text$} 495 | $endif$ 496 | $endfor$ 497 | $endif$ 498 | 499 | $endif$ 500 | 501 | $body$ 502 | 503 | $if(biblatex)$ 504 | \printbibliography[heading=subbibliography$if(reference-section-title)$, title=$reference-section-title$$endif$] 505 | $endif$ 506 | $for(include-after)$ 507 | $include-after$ 508 | $endfor$ 509 | 510 | \end{document} 511 | -------------------------------------------------------------------------------- /renv/.gitignore: -------------------------------------------------------------------------------- 1 | library/ 2 | local/ 3 | lock/ 4 | python/ 5 | staging/ 6 | -------------------------------------------------------------------------------- /renv/settings.dcf: -------------------------------------------------------------------------------- 1 | external.libraries: 2 | ignored.packages: 3 | package.dependency.fields: Imports, Depends, LinkingTo 4 | r.version: 5 | snapshot.type: implicit 6 | use.cache: TRUE 7 | vcs.ignore.library: TRUE 8 | -------------------------------------------------------------------------------- /whocares.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: XeLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | --------------------------------------------------------------------------------