Skip to content

Instantly share code, notes, and snippets.

@bquast
Created May 24, 2016 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bquast/b2d002ea2d15094f74b1518507d9c1ec to your computer and use it in GitHub Desktop.
Save bquast/b2d002ea2d15094f74b1518507d9c1ec to your computer and use it in GitHub Desktop.
els <- function(formula, data, ...){
first_stage <- lm(formula,data=data, ...)
lm(update(formula, fitted(first_stage)~.), data, ...)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment