Last active
August 29, 2015 14:05
-
-
Save cheuerde/44b3140c4702bb651115 to your computer and use it in GitHub Desktop.
AIC / BIC for Asreml #R
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
'calc' <- function (asreml) | |
{ | |
summ <- summary(asreml) | |
vc <- summ$varcomp | |
DF <- nrow(vc) | |
if ("Fixed" %in% levels(vc$constraint)) | |
DF <- DF - table(vc$constraint)["Fixed"] | |
if ("Constrained" %in% levels(vc$constraint)) | |
DF <- DF - table(vc$constraint)["Constrained"] | |
names(DF) <- "" | |
logREML <- summ$loglik | |
AIC <- -2 * logREML + 2 * DF | |
BIC <- -2 * logREML + DF * log(summ$nedf) | |
data.frame(DF, AIC, BIC, logREML) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment