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

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

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

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

Author

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

Examples


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)
#> Warning: This function is now deprecated. Please try the new 'mem.select' function.
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
#> [1] 0.8524913
res$R2[minAIC] # the same
#> [1] 0.8524913
min(res$AICc) # corrected AIC
#> [1] -73.28474
extractAIC(lm1) # classical AIC
#> [1]   4.00000 -74.17363
min(res$AICc)-2*(nvar*(nvar+1))/(nrow(x)-nvar-1) # the same
#> [1] -74.17363

lm2 <- lm(y~1)

res$AICc0 # corrected AIC for the null model
#> [1] 15.60313
extractAIC(lm2) # classical AIC
#> [1]  1.0000 15.5198
res$AICc0-2*(1*(1+1))/(nrow(x)-1-1) # the same
#> [1] 15.5198