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.8450742
res$R2[minAIC] # the same
#> [1] 0.8450742
min(res$AICc) # corrected AIC
#> [1] -96.3487
extractAIC(lm1) # classical AIC
#> [1]   4.00000 -97.23759
min(res$AICc)-2*(nvar*(nvar+1))/(nrow(x)-nvar-1) # the same
#> [1] -97.23759

lm2 <- lm(y~1)

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