getModelTable: Generate a table from a set of hOUwie models describing their...

View source: R/hOUwie.R

getModelTableR Documentation

Generate a table from a set of hOUwie models describing their relative fit to data.

Description

This function takes as input a list of hOUwie models and outputs their relative fit to a dataset.

Usage

getModelTable(model.list, 
              type = "BIC")

Arguments

model.list

A list of model results from several fits of the hOUwie model. All elements of the list must be of class "houwie".

type

One of AIC, BIC, or AICc for use during evaluation of relative model fit. AICc or BIC is the best option for datasets with a few number of species.

Details

Models are named based either on the names of the list or the order in which they are provided. If names are given, the rownames will reflect the input. If no names are given, model are assigned names M1 to Mn for the 1 to n models.

Value

model_table

A data.frame containing the number of parameters (np), total joint log likelihood (lnLik), marginal discrete log likelihood (DiscLik), marginal continuous log likelihood (ContLik), Akaike Information Criterion (AIC), difference in AIC (dAIC), and AIC weight (AICwt).

Author(s)

James D. Boyko

References

Akaike H. 1998. Information Theory and an Extension of the Maximum Likelihood Principle. :15.

Burnham K.P., Anderson D.R. 2002. Model selection and multimodel inference: a practical information-theoretic approach. New York: Springer.

Examples


## Not run: 
# fit several possible models (we're using fixed parameters here)
p <- c(0.01664314, 0.39631218, 0.18684476, 2.25121568, 0.82495093) # MLE
Model_X <- hOUwie(tree, trait, rate.cat = 1, discrete_model = "ER", 
                  continuous_model = "OUM", nSim = 25, p = p)
p <- c(0.01664314, 0.39631218, 0.18684476, 0.25, 2.25121568, 0.82495093) # not MLE
Model_Y <- hOUwie(tree, trait, rate.cat = 1, discrete_model = "ER", 
                  continuous_model = "OUMV", nSim = 25, p = p)
p <- c(0.01664314, 0.39631218, 0.09631218, 0.18684476, 2.25121568, 0.82495093) # not MLE
Model_Z <- hOUwie(tree, trait, rate.cat = 1, discrete_model = "ER", 
                  continuous_model = "OUMA", nSim = 25, p = p)

# put the model results into a list
model_list <- list(Model_X = Model_X, Model_Y = Model_Y, Model_Z = Model_Z)

# get a model table describing the relative fits to the data
getModelTable(model_list)

## End(Not run)


thej022214/OUwie documentation built on April 13, 2025, 9:36 a.m.