This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load packages | |
| library(tidyverse) | |
| library(marginaleffects) | |
| library(rstanarm); options(mc.cores = parallel::detectCores()) | |
| # load data | |
| data <- read_rds("https://www.dropbox.com/s/9grn8kkb5yzwagx/data.rds?raw=1") %>% | |
| filter(passed_mvc1) %>% | |
| glimpse() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load packages | |
| library(tidyverse) | |
| library(ggrepel) | |
| library(gganimate) | |
| # set ggplot options | |
| theme_set(theme_bw(base_family = "Gill Sans")) | |
| update_geom_defaults("label", list(family = theme_get()$text$family)) | |
| update_geom_defaults("text", list(family = theme_get()$text$family)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load packages | |
| library(tidyverse) | |
| library(marginaleffects) | |
| library(patchwork) | |
| # clear workspace | |
| rm(list = ls()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load packages | |
| library(tidyverse) | |
| library(marginaleffects) | |
| devtools::install_github("carlislerainey/crdata") | |
| # load data | |
| cg <- crdata::cg2006 | |
| # fit model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create explanatory variables | |
| n <- 500000 | |
| x1 <- runif(n) | |
| x2 <- rnorm(n) | |
| x3 <- rbinom(n, size = 1, prob = 0.5) | |
| # negative binomial part | |
| mu <- exp(-1 + 1*x1 - 0.5*x2 + 0.5*x3) | |
| phi <- 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # clear workspace | |
| rm(list = ls()) | |
| # Ainsley and Elke's portion | |
| # PART 1: Add Study Metadata | |
| # ----------------------------- | |
| author_year <- "Noh, Grewal, and Kilavuz (2023)" | |
| doi_url <- "http://dx.doi.org/10.1017/s000305542300059x" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # parameters | |
| n_samples <- 1000 # number of samples | |
| sample_size <- 10 # size of each sample | |
| # container | |
| means <- numeric(n_samples) | |
| medians <- numeric(n_samples) | |
| # simulation | |
| for (i in 1:n_samples) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm(list = ls()) | |
| library(tidyverse) | |
| library(patchwork) | |
| ## ------------------------------- | |
| ## don't change things in this box | |
| # these are known quantities from Ahler and Sood |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # load the required libraries | |
| library(tidyverse) | |
| read_and_clean <- function(path) { | |
| read_csv(path) %>% | |
| # throw out all dois without "experiment" in the abstract or title | |
| filter(str_detect(abstract, "(?i)Experiment") | | |
| str_detect(title, "(?i)Experiment") ) %>% | |
| # flag all dois with "survey experiment" in the abstract | |
| mutate(svy_expt_flag = str_detect(abstract, "(?i)survey experiment")) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| make_call <- function(eissn) { | |
| crossref_api_call <- rcrossref::cr_journals(issn = eissn, | |
| works = TRUE, | |
| limit = 1000, | |
| cursor = "*", | |
| cursor_max = 1000000, |