[R] Calculation of AIC BIC from mle

From: Rainer M KRug <RMK_at_krugs.de>
Date: Mon 05 Jun 2006 - 18:22:02 EST

R 2.3.0, all packages up to date
Linux, SuSE 10.0


I want to calculate AIC or BIC from several results from mle calculation.

I found the AIC function, but it does not seem to work with objects of class mle -
If I execute the following:
ml1 <- mle(...)

I get the following error messale:
Error in logLik(object) : no applicable method for "logLik"

Therefore I am using the following to calculate the AIC:

#AICmle calculate AIC from mle object
AICmle <- function( m, k=2)

	lL <- logLik(m)
	edf <- attr(lL, "df")
	LL <- lL[1]
	- 2 * LL + k * edf

  1. Why is AIC not working with objects of class mle - am I doing something wrong, is it a bug or by design?
  2. Just for confirmation - is my calculation of AIC correct?



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jun 05 20:54:17 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 05 Jun 2006 - 22:10:29 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.