Created
February 24, 2017 19:55
-
-
Save Laurae2/38176eed780e2833a9ecd8d701e4b916 to your computer and use it in GitHub Desktop.
Akaike Information Criterion and Bayesian Information Criterion
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
lm_model <- lm(preds ~ ., data = data) | |
my_AIC <- AIC(lm_model) | |
my_AIC <- nrow(data) * (log(2 * pi) + 1 + log((sum(lm_model$residuals ^ 2) / nrow(data)))) + ((length(lm_model$coefficients) + 1) * 2) | |
my_BIC <- AIC(lm_model, k = log(nrow(data))) | |
my_BIC <- nrow(data) * (log(2 * pi) + 1 + log((sum(lm_model$residuals ^ 2) / nrow(data)))) + ((length(lm_model$coefficients) + 1) * log(nrow(data))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment