Skip to content
Prev 2284 / 7420 Next

Help with distribution fitting and AIC in R

On Sat, Aug 6, 2011 at 4:06 AM, Lene Jung <ljkjar at hotmail.com> wrote:
Lene,

You need to return the fitted object 'est', the error message tells
you that data.frame object class does not come with a logLik method,
unlike a fitdistr class returned by the function fitdistr(). You can
then use AIC, which assumes there is a logLik method with
log-likelihood and number of parameters defined. Alternatively, you
can return c(est$estimate, AIC(est)) that gives you a data frame with
AIC in 3rd column.

Careful reading of the help page for fitdistr would tell you the
structure of the return object.
There is no wrpcauchy.ml function in MASS, but in CircStats. It
returns only the estimates, and no logLik method is defined. From the
code or from the references, it should be possible to figure out PDF
for the wrapped Cauchy distribution, and from that it is easy to
calculate AIC.

Again, this is obvious from the help page.

Cheers,

Peter