Skip to content

Commit

Permalink
Fixed R-squared example
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmyleswhite committed Mar 17, 2012
1 parent 460d1d6 commit 40d6a18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 05-Regression/chapter05.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ rmse
#[1] 7.266361

# Sixteenth snippet
mean.rmse <- 1.09209343
model.rmse <- 0.954544
# There was an error in the book for this example.
# R-squared is a ratio of MSE's, not RMSE's.
mean.mse <- 1.09209343
model.mse <- 0.954544

r2 <- 1 - (model.rmse / mean.rmse)
r2 <- 1 - (model.mse / mean.mse)
r2
#[1] 0.1259502

Expand Down

0 comments on commit 40d6a18

Please sign in to comment.