This file contains 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(modelsummary) | |
# get latest version of {crdata} package, if updated | |
remotes::install_github("carlislerainey/crdata") | |
# load (and slightly wrangle) data from Barrilleaux and Rainey (2014) | |
br <- crdata::br2014 %>% | |
# recode from centered GOP gov. indicator to 0/1 Dem. gov. indicator | |
# (explanatory variables are centered about mean) |
This file contains 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) | |
# update {crdata} if necessary | |
remotes::install_github("carlislerainey/crdata") | |
# load data | |
weis <- crdata::weisiger2014 | |
# rescale weisiger2014 explanatory variables using arm::rescale() |
This file contains 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) | |
# create data frame of the potential outcomes | |
po <- tribble( | |
~Name, ~Y1, ~Y0, | |
"Alex Smith", 7, 5, | |
"Jamie Doe", 2, 3, | |
"Pat Johnson", 7, 7, |
This file contains 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) | |
# create data frame of the potential outcomes | |
po <- tribble( | |
~Name, ~Y1, ~Y0, | |
"Alex Smith", 7, 5, | |
"Jamie Doe", 2, 3, | |
"Pat Johnson", 7, 7, |
This file contains 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) | |
# create data frame of the potential outcomes | |
po <- tribble( | |
~Name, ~Y1, ~Y0, | |
"Alex Smith", 7, 5, | |
"Jamie Doe", 2, 3, | |
"Pat Johnson", 7, 7, |
This file contains 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(rstan) | |
library(bayesplot) | |
# make a stan model | |
fancy_stan_model <- " | |
generated quantities { | |
int<lower=0, upper=1> y_sim = bernoulli_rng(0.5); | |
} | |
" |
This file contains 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 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 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 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 |
NewerOlder