# ortho.AIC: Compute AIC for models with orthonormal explanatory variables In adespatial: Multivariate Multiscale Spatial Analysis

## Description

This function compute corrected AIC for models with orthonormal and centered explanatory variables such as MEM spatial eigenfunctions. Variables are sorted by their contribution to R2.

## Usage

 `1` ```ortho.AIC(Y, X, ord.var = FALSE) ```

## Arguments

 `Y` A matrix with response variables (univariate or multivariate response) `X` A set of orthonormal and centered vectors `ord.var` A logical value indicating if the order of variables and cumulative R2 must be returned

## Details

It ensures that a model with k variables is the best one that can be obtained. By default, response variables are centered (model with intercept).

## Value

A vector with corrected AIC if `ord.var=FALSE`. A list if `ord.var=TRUE` with:

 `AICc ` Values of corrected AIC. `AICc0 ` Values of corrected AIC for the null model (only intercept). `ord ` Order of variables to be enter in the model ```R2 ``` Cumulative R2

## Author(s)

St<c3><a9>phane Dray [email protected]

## References

Godinez-Dominguez E. and Freire J. (2003) Information-theoretic approach for selection of spatial and temporal models of community organization. Marine Ecology - Progress Series. 253, 17–24

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```y <- matrix(rnorm(50),50,1) x <- svd(scale(y \%*\% c(0.1,0.5,2,0,0.7)+matrix(rnorm(250),50,5)))\$u res <- ortho.AIC(y,x,ord.var=TRUE) minAIC <- which.min(res\$AICc) nvar <- length(1:minAIC)+1 # number of orthogonal vectors + 1 for intercept lm1 <- lm(y~x[,res\$ord[1:minAIC]]) summary(lm1)\$r.squared # R2 res\$R2[minAIC] # the same min(res\$AICc) # corrected AIC extractAIC(lm1) # classical AIC min(res\$AICc)-2*(nvar*(nvar+1))/(nrow(x)-nvar-1) # the same lm2 <- lm(y~1) res\$AICc0 # corrected AIC for the null model extractAIC(lm2) # classical AIC res\$AICc0-2*(1*(1+1))/(nrow(x)-1-1) # the same ```

adespatial documentation built on Jan. 20, 2018, 9:22 a.m.