Created
February 14, 2018 19:42
-
-
Save bgall/52ba9cc78ade12ad4f2969efc418df7f to your computer and use it in GitHub Desktop.
Conditioning on the dependent variable changes the L in LATE
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(dplyr) | |
# Create data | |
set.seed(1) | |
x <- rnorm(1000000, mean = 0, sd = 1) | |
y <- x*x | |
full <- data.frame(x, y) | |
# Full data OLS | |
lm(y ~ x, data = full) %>% summary() | |
# Condition sample on tails of observed distribution | |
partial <- full %>% dplyr::filter(y > quantile(y, 0.8) | y < quantile(y, 0.2)) | |
# Partial data OLS | |
lm(y ~ x, data = partial) %>% summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment