Created
September 9, 2010 15:04
-
-
Save marutter/571983 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 lenght from width?", | |
xlab="Sepal width",ylab="Sepal lentgh") | |
plot(iris$Sepal.Width,iris$Sepal.Length,main="Can we predict lenght from width?", | |
xlab="Sepal width",ylab="Sepal lentgh",pch=as.numeric(iris$Species)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment