Changed likelihood and AIC in secr 2.4.0

announcements (new versions, changes, bugs, installation problems...) related to program DENSITY and the R package secr

Changed likelihood and AIC in secr 2.4.0

Postby murray.efford » Tue Jan 08, 2013 5:35 pm

Thanks to Eric Howe for pointing out this glitch:

For multi-session SECR models, the log likelihood and AIC reported in secr 2.4.0 differs from that in earlier versions. Parameter estimates are unchanged, and dAIC comparing models fitted by the same version is unchanged. The version difference is due to a change in the constant multinomial component of the reported likelihood. Before 2.4.0 the likelihood wrongly omitted components of the multinomial constant for all sessions except the last. For a particular 'old' model you can compute the 'new' AIC with this function
Code: Select all
## compute new AIC values from multi-session model fitted with version 2.3 or earlier
## MGE 2013-01-06
newAIC <- function (oldfit) {
    old <-  as.numeric(substring(ovenbird.model.1$version,1,3)) < 2.4
    if (ms(oldfit$capthist) & old)
        n <- sum(sapply(oldfit$capthist, nrow))
    else
        stop("only for multisession models from secr <= 2.3")
    lmn <- lapply(oldfit$capthist, logmultinom)
    newLL <- logLik(oldfit) + sum(unlist(lmn[-length(lmn)]))
    Npar <- max(unlist(oldfit$parindx))
    if (!is.null(oldfit$details$fixedbeta))
        Npar <- Npar - sum(!is.na(oldfit$details$fixedbeta))
    AICval <- 2 * (-newLL + Npar)
    AICcval <- ifelse((n - Npar - 1) > 0, 2 * (-newLL + Npar) +
                      2 * Npar * (Npar + 1)/(n - Npar - 1), NA)
    cbind(AIC(oldfit), data.frame(newlogLik = newLL, newAIC = AICval,
         newAICc = AICcval))
}


To see what is going on, try the secr function logmultinom with the ovenbird dataset as follows:
Code: Select all
## 2.4.0
unlist(lapply(ovenCH, logmultinom))
    2005     2006     2007     2008     2009
41.64247 48.47118 61.26170 38.64674 30.67186
 ## dropping the last one the difference is   
sum(unlist(lapply(ovenCH, logmultinom))[-5])
 190.0221
## earlier versions
 logLik(ovenbird.model.1)
'log Lik.' -1121.163 (df=3)
## from 2.4.0 onwards
 logLik(ovenbird.model.1)
'log Lik.' -931.1416 (df=3)
## difference
> 1121.164 - 931.1416
[1] 190.0224


The 2.4.0 values are correct and will not change in future versions.
Murray
murray.efford
 
Posts: 566
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Return to software problems/news

Who is online

Users browsing this forum: No registered users and 1 guest

cron