Skip to content

Instantly share code, notes, and snippets.

@aammd
Last active December 16, 2016 12:22
Show Gist options
  • Save aammd/591e382edc470fca650eb051fd3ecaba to your computer and use it in GitHub Desktop.
Save aammd/591e382edc470fca650eb051fd3ecaba to your computer and use it in GitHub Desktop.
microbenchmark::microbenchmark({lm(ys~xs, data = testdf)$residuals},
{fastLm(ys~xs, data = testdf)$residuals},
{homemade_residuals(indeps, deps)}, times = 500)
identical(homemade_residuals(indeps, deps), homemade_residuals2(indeps, deps))
# all.equal()
testdf <- data_frame(xs = runif(200, 0, 15),
ys = xs * 5 + 15 + rnorm(200, sd = 3))
profvis::profvis({homemade_residuals(testdf)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment