Last data update: 2014.03.03

R: Akaike weights
aicwR Documentation

Akaike weights

Description

This function return the Akaike weights for a set of fitted models.

Usage

aicw(x,...)

Arguments

x

A list with the fitted objects or a list/vector of AIC

...

Options to be passed through; e.g. aicc=TRUE when a list of fitted objects is provided.

Details

This function compute the Akaike weights for a set of model AIC or AICc. Akaike weights can be used for model comparison and model averaging.

Value

models

List of models

AIC

Akaike Information Criterion

diff

AIC difference with the best fit model

wi

Absolute weight

aicweights

Akaike weights (relative weights)

Author(s)

Julien Clavel

References

Burnham K.P., Anderson D.R. 2002. Model selection and multi-model inference: a practical information-theoric approach. New York: Springer-Verlag.

See Also

AIC mvMORPH

Examples

set.seed(1)
# Generating a random tree
tree<-pbtree(n=50)

#simulate the traits
sigma <- matrix(c(0.01,0.005,0.003,0.005,0.01,0.003,0.003,0.003,0.01),3)
theta<-c(0,0,0)
data<-mvSIM(tree, model="BM1", nsim=1, param=list(sigma=sigma, theta=theta))

## Fitting the models
# BM1 - General structure
fit1 <- mvBM(tree, data, model="BM1", method="pic")

# BM1 - No covariations
fit2 <- mvBM(tree, data, model="BM1", method="pic", param=list(constraint="diagonal"))

# BM1 - Equal variances/rates
fit3 <- mvBM(tree, data, model="BM1", method="pic", param=list(constraint="equal"))

results <- list(fit1,fit2,fit3)

# or
# results <- c(AIC(fit1), AIC(fit2), AIC(fit3))

# Akaike weights
aicw(results)

# AICc weights
aicw(results, aicc=TRUE)

# we can compare the MSE...
# mean((fit1$sigma-sigma)^2)
# mean((fit3$sigma-sigma)^2)

Results