R/extractDIC.R

Defines functions extractDIC.merMod extractDIC

Documented in extractDIC extractDIC.merMod

extractDIC <- function(fit,...){
  UseMethod("extractDIC")
}


extractDIC.merMod <- function(fit,...){
        #REML <- [email protected]["REML"]
#        llik <- logLik(fit, REML)
#        dev <- [email protected]["ML"]
#        n <- [email protected]["n"]
#        Dhat <- -2 * (llik)
#        pD <- dev - Dhat
#        DIC <- dev + pD[[1]]
#        names(DIC) <- "DIC"
#        return(DIC)      
        is_REML <- isREML(fit)
        llik <- logLik(fit, REML=is_REML)
        dev <- deviance(refitML(fit))
        n <-  getME(fit, "devcomp")$dims["n"]
        Dhat <- -2 * (llik)
        pD <- dev - Dhat
        DIC <- dev + pD[[1]]
        names(DIC) <- "DIC"
        return(DIC)
}




#
#extractAIC.mer <- function(fit,...){
##     REML <- [email protected]["REML"]
##    llik <- logLik(fit, REML)
##    AIC <- AIC(llik)
##    names(AIC) <- "AIC"
##    return(AIC)
#    L <- logLik(refitML(fit))
#    edf <- attr(L,"df")
#    out <- c(edf,-2*L + k*edf)
#    return(out)
#} 

Try the arm package in your browser

Any scripts or data that you put into this service are public.

arm documentation built on April 17, 2018, 3:01 a.m.