Skip to content

Instantly share code, notes, and snippets.

@hanowell
Last active June 15, 2023 15:09
Show Gist options
  • Save hanowell/cc9709f2fc3d222f4872f31ad5f91392 to your computer and use it in GitHub Desktop.
Save hanowell/cc9709f2fc3d222f4872f31ad5f91392 to your computer and use it in GitHub Desktop.
library(jtools)
library(plm)
i <- rep(1:100, each = 100)
v <- rep(rnorm(100), each = 100)
a <- rnorm(10000)
t <- a + v + rnorm(10000)
y <- a + v + t + rnorm(10000)
u <- t + y + rnorm(10000)
df <- data.frame(i, y, t, a, v, u)
ols <- lm(y ~ t + a, data = df)
re <- plm(y ~ t + a, data = df, model = "random", index = "i")
fe <- plm(y ~ t + a, data = df, model = "within", index = "i")
export_summs(ols, re, fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment