I am trying to calculate AICc (corrected AIC) of a model manually and by using MuMIn package. Is AICc(model) in MuMIn package the same as the following aicc?
model <- lm(Y~., df) #df consists of input vectors and Y.
n <- nrow(model$model)
k <- length(model$coefficients)+1
aicc <- -2*stats::logLik(model)[1]+2*k+2*k*(k+1)/(n-k-1)
I tried to do this comparison because my code can be run by R 3.6.3, which is not be supported by MuMIn package anymore. It is difficult make my code compatible with MuMIn (R>4.2.0).
Seems that way:
Slightly more generally you could use
n <- nobs(model); k <- length(coef(model))+1
; most model types have these accessor methods.