Skip to content

Instantly share code, notes, and snippets.

@benwhalley
Created June 7, 2016 09:40
Show Gist options
  • Save benwhalley/6b3a33381c97516144ecbf87cfc74509 to your computer and use it in GitHub Desktop.
Save benwhalley/6b3a33381c97516144ecbf87cfc74509 to your computer and use it in GitHub Desktop.
# https://en.wikipedia.org/wiki/Akaike_information_criterion#How_to_apply_AIC_in_practice
compareAIC <- function(..., models) {
mods = c(list(...), models)
aics <- sapply(mods, FUN = AIC)
round(exp((min(aics) - aics) / 2), 2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment