Learn R Programming

adespatial (version 0.3-24)

ortho.AIC: Compute AIC for models with orthonormal explanatory variables

Description

This function is now deprecated. Please try the new mem.select function.

Usage

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

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

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

Author

Stéphane Dray stephane.dray@univ-lyon1.fr

Details

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.

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).

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

Run this code

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

Run the code above in your browser using DataLab