This function is now deprecated. Please try the new mem.select
function.
ortho.AIC(Y, X, ord.var = FALSE)
A vector with corrected AIC if ord.var=FALSE
. A list if
ord.var=TRUE
with:
Values of corrected AIC.
Values of corrected AIC for the null model (only intercept).
Order of variables to be enter in the model
Cumulative R2
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).
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
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.7721192
res$R2[minAIC] # the same
#> [1] 0.7721192
min(res$AICc) # corrected AIC
#> [1] -73.33319
extractAIC(lm1) # classical AIC
#> [1] 4.00000 -74.22208
min(res$AICc)-2*(nvar*(nvar+1))/(nrow(x)-nvar-1) # the same
#> [1] -74.22208
lm2 <- lm(y~1)
res$AICc0 # corrected AIC for the null model
#> [1] -6.192121
extractAIC(lm2) # classical AIC
#> [1] 1.000000 -6.275454
res$AICc0-2*(1*(1+1))/(nrow(x)-1-1) # the same
#> [1] -6.275454