infoCriteria.asreml: Computes AIC and BIC for models.

View source: R/REMLRTIC.v4.r

infoCriteriaR Documentation

Computes AIC and BIC for models.

Description

Computes Akiake and Bayesian (Schwarz) Information Criteria for models. Either the Restricted Maximum likelihood (REML) or the full likelihood (full) can be used. The full likelihood, evaluated using REML estimates is used when it is desired to compare models that differ in their fixed models.

Usage

## S3 method for class 'asreml'
infoCriteria(object, DF = NULL, 
            bound.exclusions = c("F","B","S","C"), 
            IClikelihood = "REML", fixedDF = NULL, varDF = NULL, ...)
## S3 method for class 'list'
infoCriteria(object, bound.exclusions = c("F","B","S","C"), 
            IClikelihood = "REML", fixedDF = NULL, varDF = NULL, ...)

Arguments

object

An asreml object resulting from the fitting of a model using REML or a list of asreml objects. If the components of the list are named, then those names will be used as the rownames for the returned data.frame.

DF

A numeric giving the number of estimated variance parameters. If NULL then this is determined from the information in object. This argument has been replaced by varDF, but is retained for compatibility with legacy code. It is not available with the list method.

bound.exclusions

A character specifying the bound (constraint) codes that will result in a variance parameter being excluded from the count of estimated variance parameters. If set to NULL then none will be excluded.

IClikelihood

A character specifying whether Restricted Maximum Likelihood (REML) or the full likelihood, evaluated using REML estimates, (full) are to be used in calculating the information criteria for family set to asr_gaussian. For family set to asr_binomial or asr_poisson and with dispersion set to 1, the deviance is extracted from object and used to calculate the AIC and BIC (as suggested by Damian Collins); the setting of IClikelihood is ignored and the log-likelihood set to NA. The information criteria are not valid for other settings of family and dispersion.

fixedDF

A numeric giving the number of estimated fixed parameters. If NULL then this is determined from the information in object. For object a list only a single value that is used for all components of the list has been implemented.

varDF

A numeric giving the number of estimated variance parameters. If NULL then this is determined from the information in object. It replaces the DF argument. For object a list only a single value that is used for all components of the list has been implemented.

...

Provision for passing arguments to functions called internally - not used at present.

Details

The variance degrees of freedom (varDF) are the number of number of variance parameters that have been estimated, excluding those whose estimates have a code for bound specified in bound.exclusions. If varDF is not NULL, the supplied value is used. Otherwise varDF is determined from the information in object, i.e. if object is an asreml object then from it, or if object is a list then from each asreml object in the list. Similarly, the fixed degrees of freedom (fixedDF) are the number of number of fixed parameters that have been estimated, any coefficients that have the value NA being excluded. If fixedDF is not NULL, the supplied value is used. Otherwise fixedDF is determined from the information in object.

If ASReml-R version 4 is being used then the codes specified in bound.exclusions are not restricted to a subset of the default codes, but a warning is issued if a code other than these is specified. For ASReml-R version 3, only a subset of the default codes are allowed: F (Fixed), B (Boundary), C (Constrained) and S (Singular).

The calculation of the information criteria is an adaptation of the code supplied in File S1 of Verbyla (2019). The log-likelihood is calculated as loglik = log(REML) - log(|C|)/2, where C is the inverse coefficient matrix; the term involving C is omitted for REML. The AIC is calculated as - 2 * loglik + 2 * (varDF + fixedDF) and the BIC as - 2 * loglik + (fixedDF + varDF) * log(n - r + fixedDF), where n is the number of observations and r is the rank of the fixed effects design matrix. For REML, fixedDF = 0.

Value

A data.frame containing the numbers of estimated fixed (fixedDF) and variance (varDF) parameters, the number of bound parameters (NBound), AIC, BIC and the value of the log-likelihood (loglik). All elements of the data.frame will be set to NA for the invalid combinations of family and dispersion as noted in the IClikelihood argument. If object is a list and its components are named, then those names will be used to set the rownames of the data.frame.

Author(s)

Chris Brien

References

Verbyla, A. P. (2019). A note on model selection using information criteria for general linear models estimated using REML. Australian & New Zealand Journal of Statistics, 61, 39–50. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/anzs.12254")}.

See Also

REMLRT.asreml, changeTerms.asrtests, changeModelOnIC.asrtests

Examples

## Not run: 
   data(Wheat.dat)
   ## Fit several models to the wheat data and calculate their ICs
   # Fit initial model
   m.max <- asreml(yield ~ Rep + WithinColPairs + Variety, 
                   random = ~ Row + Column + units,
                   residual = ~ ar1(Row):ar1(Column), 
                   data=Wheat.dat)
   infoCriteria(m.max.asr, IClikelihood = "full")

   #Drop term for within Column pairs
   m1 <- asreml(yield ~ Rep + Variety, 
                random = ~ Row + Column + units,
                residual = ~ ar1(Row):ar1(Column), 
                data=Wheat.dat)
  
   #Drop nugget term
   m2 <- asreml(yield ~ Rep + WithinColPairs + Variety, 
                random = ~ Row + Column,
                residual = ~ ar1(Row):ar1(Column), 
                data=Wheat.dat)

   #Drop Row autocorrelation
   m3 <- asreml(yield ~ Rep + WithinColPairs + Variety, 
                   random = ~ Row + Column + units,
                   residual = ~ Row:ar1(Column), 
                   data=Wheat.dat)

   #Drop Col autocorrelation
   m4 <- asreml(yield ~ Rep + WithinColPairs + Variety, 
                random = ~ Row + Column + units,
                residual = ~ ar1(Row):Column, 
                data=Wheat.dat)

   mods.asr <- list(m.max, m1, m2, m3, m4)
   infoCriteria(mods.asr, IClikelihood = "full")


## End(Not run)

asremlPlus documentation built on Oct. 27, 2024, 5:06 p.m.