Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created January 9, 2021 16:23
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 timcdlucas/1715984de5a1380f95f4cb844d52260b to your computer and use it in GitHub Desktop.
Save timcdlucas/1715984de5a1380f95f4cb844d52260b to your computer and use it in GitHub Desktop.
n = 100
x = runif(n)
y = 1 + 2*x + rnorm(n)
yp = predict(lm(y~x))
plot(y=yp, x=y)
abline(lm(yp~y), col="blue")
abline(a=0, b=1, col="red", lty="dashed")
plot(y=y, x=yp)
abline(lm(y~yp), col="blue")
abline(a=0, b=1, col="red", lty="dashed")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment