powered by
Easily compute the mean squared error for continuous predictions
mse(prediction, outcome)
A numeric vector of predictions.
numeric
A numeric vector of outcomes actually observed.
# NOT RUN { x <- rnorm(100) y <- x^2 test_x <- rnorm(100) test_y <- test_x^2 mod <- glm(y ~ x) pred <- predict(mod, newx = as.data.frame(test_x)) error <- mse(prediction = pred, outcome = test_y) # }
Run the code above in your browser using DataLab