Skip to content

Instantly share code, notes, and snippets.

@jennybc
Created September 11, 2013 07:09
Show Gist options
  • Save jennybc/6520226 to your computer and use it in GitHub Desktop.
Save jennybc/6520226 to your computer and use it in GitHub Desktop.
Toy example used in STAT 545A
a <- 2
b <- 7
sigSq <- 0.5
n <- 400
set.seed(1234)
x <- runif(n)
y <- a + b * x + rnorm(n, sd = sqrt(sigSq))
(avgX <- mean(x))
plot(x, y)
abline(a, b, col = "blue", lwd = 2)
sessionInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment