calcAIC: Extract AIC from a Fitted Model

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Computes the Akaike Information Criterion for a fitted parametric model.

Usage

1
calcAIC(fit, subset=TRUE, scale = 0, enp, loss.fun = square)

Arguments

fit

fitted model; see details below

scale

optional numeric specifying the scale parameter of the model; see scale in step.

subset

A "logical" or "numeric" vector indicating the subset of points used to compute the fitted model.

enp

equivalent number of parameters in the fitted model. If missing, the enp component from fit will be used.

loss.fun

the loss function used to calculate deviance; default uses the squared deviations from the fitted values; one could also use, for example, absolute deviations (abs).

Details

The argument fit can be an object of class marrayFit, in which case the residuals component from the marrayFit object will be extracted to calculate the deviance; the user can also pass in a numeric vector, in which case it will be interpreted as the residuals and the user needs to specify the argument enp.

The criterion used is

AIC = -2*log{L} + k * enp,

where L is the likelihood and enp the equivalent number of parameters of fit. For linear models (as in marrayFit), -2log{L} is computed from the deviance.

k = 2 corresponds to the traditional AIC and is the penalty for the number of parameters.

Value

A numeric vector of length 4, giving

Dev

the deviance of the fit.

enp

the equivalent number of parameters of the fit.

penalty

the penalty for number of parameters.

Criterion

the Akaike Information Criterion for fit.

Author(s)

Yuanyuan Xiao, yxiao@itsa.ucsf.edu,
Jean Yee Hwa Yang, jean@biostat.ucsf.edu

See Also

AIC, deviance, calcBIC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## load in swirl data
data(swirl)

## fit a model
fit <- fitWithin(fun="medfit")
## res is an object of class marrayFit
res <- fit(swirl[,1])

## calculate AIC
calcAIC(res)
## or could pass in the residual vector, but then argument "enp" needs to be specified
calcAIC(res$residual, enp=1) 

Example output

Loading required package: marray
Loading required package: limma
      Dev       enp   penalty Criterion 
 -10147.9       1.0       2.0  -10145.9 
      Dev       enp   penalty Criterion 
 -10147.9       1.0       2.0  -10145.9 

stepNorm documentation built on Nov. 8, 2020, 6:19 p.m.