model_info: Get model and data from model fitted object

View source: R/internal.R

model_infoR Documentation

Get model and data from model fitted object

Description

Generic function for pulling apart model fitted objects and obtaining phylogeny, data, model type and parameters

Usage

model_info(fit, ...)

Arguments

fit

a model fitted object (see make_unit_tree for details)

...

additional arguments to be passed to model_info

Details

These functions are primarily used internally within the function make_unit_tree. A different model_info.xx function is built for every implemented class of model fitted object and is tailored to the specifics of the form of model output. The return value will differ depending on the model used. For example, if a single phylogeny is supplied which has been used to fit a single rate model, model_info will return a object of class fitC, consisting of the original tree to be rescaled, the original comparative dataset, the model class (e.g. "BM", "OU", etc.) and the model-specific parameters.

The returned object needs to be of a class for which a make_model_phylo function exists. make_model_phylo will take the object output by model_info and return a 'unit.tree' object.

Value

a classed object compatibile with a make_model_phylo function.

See Also

make_unit_tree, make_model_phylo

Examples

## finch data
data(finch)
phy <- finch$phy
data <- finch$data[,"wingL"]

## Not run: 
require(geiger)
## fit Brownian motion model
## using geiger's fitContinuous function
fit.bm <- fitContinuous(phy=phy, dat=data, model="BM",
                                 control=list(niter=10), ncores=1)

## get model info using internal arbutus function
info.bm <- model_info(fit.bm)

## now using diversitree function
require(diversitree)
bmlik <- make.bm(phy, data)
fit.bm.dt <- find.mle(bmlik, x.init=1)

info.bm.dt <- model_info(fit.bm.dt, lik=bmlik)

## End(Not run)


mwpennell/arbutus documentation built on Oct. 6, 2022, 10 a.m.