AIC.spmodel {spmodel} | R Documentation |
Compute AIC and AICc of fitted model objects
Description
Compute AIC and AICc for one or several fitted model objects for which a log-likelihood value can be obtained.
Usage
## S3 method for class 'splm'
AIC(object, ..., k = 2)
## S3 method for class 'spautor'
AIC(object, ..., k = 2)
## S3 method for class 'spglm'
AIC(object, ..., k = 2)
## S3 method for class 'spgautor'
AIC(object, ..., k = 2)
AICc(object, ..., k = 2)
## S3 method for class 'splm'
AICc(object, ..., k = 2)
## S3 method for class 'spautor'
AICc(object, ..., k = 2)
## S3 method for class 'spglm'
AICc(object, ..., k = 2)
## S3 method for class 'spgautor'
AICc(object, ..., k = 2)
Arguments
object |
A fitted model object from |
... |
Optionally more fitted model objects. |
k |
The penalty parameter, taken to be 2. Currently not allowed to differ from 2 (needed for generic consistency). |
Details
When comparing models fit by maximum or restricted maximum
likelihood, the smaller the AIC or AICc, the better the fit. The AICc contains
a correction to AIC for small sample sizes. The theory of
AIC and AICc requires that the log-likelihood has been maximized, and hence,
no AIC or AICc methods exist for models where estmethod
is not
"ml"
or "reml"
. Additionally, AIC and AICc comparisons between "ml"
and "reml"
models are meaningless – comparisons should only be made
within a set of models estimated using "ml"
or a set of models estimated
using "reml"
. AIC and AICc comparisons for "reml"
must
use the same fixed effects. To vary the covariance parameters and
fixed effects simultaneously, use "ml"
.
Hoeting et al. (2006) defines that spatial AIC as
-2loglik + 2(estparams)
and the spatial AICc as
-2loglik + 2n(estparams) / (n - estparams - 1)
, where n
is the sample size
and estparams
is the number of estimated parameters. For "ml"
, estparams
is
the number of estimated covariance parameters plus the number of estimated
fixed effects. For "reml"
, estparams
is the number of estimated covariance
parameters.
Value
If just one object is provided, a numeric value with the corresponding AIC or AICc.
If multiple objects are provided, a data.frame
with rows corresponding
to the objects and columns representing the number of parameters estimated
(df
) and the AIC or AICc.
Examples
spmod <- splm(z ~ water + tarp,
data = caribou,
spcov_type = "exponential", xcoord = x, ycoord = y
)
AIC(spmod)
AICc(spmod)