library(tidyverse)
library(broom)
library(scales)
model <- lm(hwy ~ displ + cyl, data = mpg)
model_results <- tidy(model, conf.int = TRUE)
# Slow boring way of pulling out exact numbers
library(tidyverse)
library(patchwork)
# Plotting a list of three variables stored as character strings
things_to_plot <- c("displ", "cty", "hwy")
# Basic function for plotting
# Notice the .data[[blah]] syntax here. That's the magical part that makes this
library(tidyverse)
library(broom)
library(gapminder)
gapminder_nested <- gapminder %>%
filter(continent != "Oceania") %>%
group_by(continent, year) %>%
nest()
library(tidyverse)
library(marginaleffects)
set.seed(123)
n_obs <- 1000
simulated_data <- data.frame(
id = 1:n_obs
library(tidyverse)
library(brms)
library(modelsummary)
model1 <- brm(
bf(hwy ~ displ + cyl,
decomp = "QR"),
data = mpg,
family = gaussian,
library(tidyverse)
library(ggdist)
library(patchwork)
# Single distributions ----------------------------------------------------
# Regular ggplot way
p1 <- ggplot() +
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
library(tidyverse) | |
library(gapminder) | |
library(fixest) | |
library(lme4) | |
# -------------------------------- | |
# Econometrics-style fixed effects | |
# -------------------------------- | |
model_fe <- feols(lifeExp ~ gdpPercap | country, | |
data = gapminder) |
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
library(tidyverse) | |
library(brms) | |
library(tidybayes) | |
library(patchwork) | |
library(scales) | |
library(gapminder) | |
# Add some zeros to gapminder | |
set.seed(1234) | |
gapminder <- gapminder %>% |
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
\begin{aligned} | |
& \mathrlap{\textbf{Hurdled likelihood of aid $i$ across time $t$ within each country $j$}} \\ | |
\text{Foreign aid}_{it_j} &\sim | |
\mathrlap{ | |
\begin{cases} | |
\ \operatorname{Bernoulli}(\pi_{it}) & \text{if Foreign aid}_{it_j} = 0 \\ | |
\ \operatorname{Log\,\mathcal{N}}(\mu_{it_j}, \sigma_y) + \operatorname{Bernoulli}(1 - \pi_{it}) & \text{if Foreign aid}_{it_j} > 0 | |
\end{cases}} \\ | |
\\ | |
& \textbf{Models for parameters} \\ |