argnames: Argument Names for Vector-Argument Functions

View source: R/constrain.R

argnamesR Documentation

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 class 'constrained'
argnames(x, ...)
## S3 replacement method for class '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.

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.

Author(s)

Richard G. FitzJohn

Examples

## 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)


diversitree documentation built on Oct. 2, 2024, 9:13 a.m.