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
# Context: https://bsky.app/profile/thetahat.bsky.social/post/3lchztjxufc2t | |
library(fixest) | |
library(modelsummary) | |
library(tinytable) | |
mods = feols( | |
rating ~ complaints + privileges + learning + csw0(raises + critical), | |
data = attitude | |
) |
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
# Context: https://bsky.app/profile/kjhealy.bsky.social/post/3kywqjin76i2r | |
library(rvest) | |
library(tinyplot) | |
tpar(grid = TRUE, las = 1, pch = 16) | |
# read the wiki page | |
wp = read_html("https://en.wikipedia.org/wiki/List_of_world_records_in_athletics") | |
# select the table of interest |
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
# preliminaries ----- | |
# packages you'll need (install these if you don't have them) | |
# install.packages(c("arrow", "duckdb", "dplyr", "tidyr")) | |
# write a dummy parquet dataset (i.e., multiple parquet files) to disk | |
dir.create("airquality") | |
arrow::write_dataset( | |
airquality, | |
path = "airquality", |
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
# Context: https://mastodon.social/@gmcd/109895547902826763 | |
library(ggh4x) | |
theme_set( | |
theme_bw() + | |
theme( | |
axis.line = element_line(linewidth = 0.4), | |
axis.ticks = element_line(linewidth = 0.4), | |
panel.grid.minor = element_blank(), |
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
set.seed(1234) | |
# Create the base dataset as a cross-join of 1,000 firms over 30 periods | |
baker = expand.grid(n = 1:30, id = 1:1000) | |
# Add additional columns | |
baker = | |
baker |> | |
within({ | |
year = n + 1980 - 1 |
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
## Context: https://twitter.com/grant_mcdermott/status/1493400952878952448 | |
options(collapse_mask = "all") # NB: see `help('collapse-options')` | |
library(dplyr) | |
library(data.table) | |
library(collapse) # Needs to come after library(dplyr) for collapse_mask to work | |
flights = fread('https://raw.githubusercontent.com/Rdatatable/data.table/master/vignettes/flights14.csv') |
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
--- | |
title: "Intermediate Microeconomics (EC 311)" | |
subtitle: "Syllabus" | |
author: "Grant McDermott" | |
date: "Department of Economics, University of Oregon" | |
format: | |
pdf: | |
pdf-engine: pdflatex | |
documentclass: article | |
toc: false |
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
# Context: https://twitter.com/grant_mcdermott/status/1487528757418102787 | |
library(data.table) | |
library(fixest) | |
bboot = | |
function(object, reps = 100L, cluster = NULL, ...) { | |
fixest_obj = inherits(object, c('fixest', 'fixest_multi')) | |
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
## Examples, borrowing from the intro vignette | |
library(fixest) | |
library(ggplot2) | |
## Source the function | |
source('https://gist.githubusercontent.com/grantmcdermott/db8501b0281813792bf78393fef98481/raw/ggiplot.R') | |
## Vanilla TWFE | |
est_did = feols(y ~ x1 + i(period, treat, 5) | id + period, base_did) |
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
# Libraries --------------------------------------------------------------- | |
library(tidysynth) | |
library(haven) | |
# Data -------------------------------------------------------------------- | |
texas = read_dta('https://raw.github.com/scunning1975/mixtape/master/texas.dta') |
NewerOlder