Created
September 10, 2010 11:52
-
-
Save marutter/573505 to your computer and use it in GitHub Desktop.
This file contains 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
(b1 <- sum((x-mean(x))*(y-mean(y)))/sum((x-mean(x))^2)) | |
(b0 <- mean(y)-b1*mean(x)) | |
yhat <- b0+b1*x | |
e <- y-yhat | |
SSE <- sum(e^2) | |
MSE <- SSE/(length(y)-2) | |
plot(faithful$waiting,faithful$eruptions,main="Old Faithful",xlab="Wait time (minutes)", | |
ylab="Eruption duration (minutes)") | |
plot(iris$Sepal.Width,iris$Sepal.Length,main="Can we predict length from width?", | |
xlab="Sepal width",ylab="Sepal length") | |
plot(iris$Sepal.Width,iris$Sepal.Length,main="Can we predict length from width?", | |
xlab="Sepal width",ylab="Sepal length",pch=as.numeric(iris$Species)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment