Learn R Programming

diversitree (version 0.10-1)

argnames: Argument Names for Vector-Argument Functions

Description

Functions to get and set “argument names” for functions that take vectorised arguments. For example, the likelihood function returned by make.bisse takes a vector of six these functions can be used to get the canonical names for these six parameters, and also to set them to something more memorable. These names are used by the constrain function to specify submodels.

Usage

argnames(x, ...)
argnames(x) <- value
# S3 method for constrained
argnames(x, ...)
# S3 method for constrained
argnames(x) <- value

Arguments

x

A function taking a vector of parameters as its first argument.

value

Vector of names to set the argument names to.

...

Ignored arguments to future methods.

Author

Richard G. FitzJohn

Details

Methods exist for all models: bisse, geosse, bd, yule, mk2, and mkn. These are particulary useful for mkn as the number of parameters for the Q matrix can be very large.

Examples

Run this code
## Same example likelihood function as for \link{make.bisse}:
pars <- c(0.1, 0.2, 0.03, 0.03, 0.01, 0.01)
set.seed(4)
phy <- tree.bisse(pars, max.t=30, x0=0)
f <- make.bisse(phy, phy$tip.state)

argnames(f) # Canonical argument names (set by default)
## Names that might be more informative for a tall/short state
argnames(f) <- c("l.tall", "l.short", "m.tall", "m.short",
                 "q.tall.short", "q.short.tall")
argnames(f)

Run the code above in your browser using DataLab