Created
September 12, 2013 18:24
-
-
Save daattali/6541810 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
n <- 50 | |
a <- 2 | |
b <- -3 | |
sigSq <- 0.5 | |
x <- runif(n) | |
norm <- rnorm(n, sd = sqrt(sigSq)) | |
y <- a + b * x + norm | |
plot(x,y) | |
abline(a, b, col = "blue") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a clear R script. It will be better if you separate code chunks of different meanings with blank lines and comments. For example, add a blank line before x <- runif(n) and a blank line before plot(x,y).