Learn R Programming

hzar (version 0.2-5)

hzar.AIC.default: Calculate the AIC score.

Description

Calculate the AIC or the corrected AIC (AICc) for the given likelihood, number of parameters and number of observations.

Extracts the parameters as needed when passed the correct hzar object.

Usage

hzar.AIC.default(maxLL, param.count) hzar.AICc.default(maxLL, param.count, nObs) hzar.AIC.hzar.cline(cline) hzar.AICc.hzar.cline(cline,nObs) hzar.AIC.hzar.dataGroup(dataGroup) hzar.AICc.hzar.dataGroup(dataGroup)

Arguments

maxLL
The maximum log likelihood value.
param.count
The number of free parameters, also known as the number of degrees of freedom.
nObs
The number of samples observed.
cline
A hzar.cline object.
dataGroup
A hzar.dataGroup object.

Value

The AIC or AICc score calculated.

Details

The formula for AIC used is 2 * (param.count - maxLL).

The formula for AICc used is: AIC + 2 * param.count * (param.count + 1) / (nObs - param.count - 1)

See Also

AIC hzar.AIC.hzar.obsDataGroup

Examples

Run this code

print(hzar.AIC.default(-8,3))
print(hzar.AICc.default(-8,3,30))

data(manakinMolecular);
mknAdaA <-
  hzar.doMolecularData1DPops(manakinMolecular$distance,
                             manakinMolecular$ada.A,
                             manakinMolecular$ada.nSamples);
hzar.plot.obsData(mknAdaA);
mknAdaAmodel <-
  hzar.makeCline1DFreq(mknAdaA, scaling="fixed",tails="none");
mknAdaAmodel <-
  hzar.model.addBoxReq(mknAdaAmodel,-30,600);
mknAdaAmodelFitR <-
   hzar.first.fitRequest.old.ML(model=mknAdaAmodel ,
                                mknAdaA,
                                verbose=FALSE);
print(hzar.AIC.hzar.dataGroup(hzar.fit2DataGroup(mknAdaAmodelFitR)))

mknAdaAcline <- hzar.gen.cline(list(center=300,width=10),
                               mknAdaAmodelFitR);

print(hzar.AIC.hzar.cline(mknAdaAcline));

Run the code above in your browser using DataLab