Skip to content

Instantly share code, notes, and snippets.

@tyleransom
Created October 9, 2020 03:00
Show Gist options
  • Save tyleransom/aa7a9f98c1b723346c1541909f88da7a to your computer and use it in GitHub Desktop.
Save tyleransom/aa7a9f98c1b723346c1541909f88da7a to your computer and use it in GitHub Desktop.
test of lfe development branch by @grant_mcdermott
library(tidyverse)
library(magrittr)
devtools::load_all('~/lfe') # dev branch of lfe from @grant_mcdermott; see https://twitter.com/grant_mcdermott/status/1313900416342474752?s=20
df <- read_csv("https://raw.githubusercontent.com/OU-PhD-Econometrics/fall-2020/master/ProblemSets/PS4-mixture/nlsw88t.csv")
df %<>% mutate(occ_code = as.factor(occ_code))
felm(elnwage5 ~ occ_code | year + idcode, data=df)
# stata equivalent:
# insheet using "https://raw.githubusercontent.com/OU-PhD-Econometrics/fall-2020/master/ProblemSets/PS4-mixture/nlsw88t.csv", comma case
# areg elnwage5 i.occ_code i.year, absorb(idcode)
# would like to try * functionality
# but the data is idcode-by-year
# so there's no remaining variation to absorb
# felm(elnwage5 ~ occ_code | year * idcode, data=df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment