Learn R Programming

hisse (version 1.3)

hisse.null4: Four state trait-independent Hidden State Speciation and Extinction

Description

Sets up and executes a four state trait-independent HiSSE model (Hidden State Speciation and Extinction) on a phylogeny and character set.

Usage

hisse.null4(phy, data, f=c(1,1), turnover.anc=rep(c(1,2,3,4),2), 
eps.anc=rep(c(1,2,3,4),2), trans.type="equal", condition.on.survival=TRUE, 
root.type="madfitz", root.p=NULL,  output.type="turnover", sann=FALSE, 
sann.its=10000, max.tol=.Machine$double.eps^.25)

Arguments

phy
a phylogenetic tree, in ape phylo format and with internal nodes labeled denoting the ancestral selective regimes.
data
a data matrix containing species information (see Details).
f
vector of length 2 with the estimated proportion of extant species in state 0 and 1 that are included in the phylogeny. A value of c(0.25, 0.5) means that 25 percent of species in state 0 and 50 percent of species in state 1 are included in the phylogeny.
turnover.anc
a vector of length 8, indicating the free parameters associated with the net turnover rates. Default setting assumes character independent diversification (see Details).
eps.anc
a vector of length 8, indicating the free parameters associated with the extinction fractions. Default setting assumes character independent diversification (see Details).
trans.type
provides the type of transition rate model. Currently this model allows two types: equal, the default, which assumes all transitions are equal, and three.rate, that assumes three rates (see Details).
condition.on.survival
a logical indicating whether the likelihood should be conditioned on the survival of two lineages and the speciation event subtending them (Nee et al. 1994). The default is TRUE.
root.type
indicates whether root prior assumption should based the procedure described by FitzJohn et al. 2009, madfitz, or assumed equal, equal.
root.p
a vector indicating fixed root state probabilities. The default is NULL.
output.type
indicates whether the rates should be printed onscreen as the optimized variables, turnover, transformed to reflect net diversification, net.div, or transformed to reflect $\lambda$ and $\mu$, raw.
sann
a logical indicating whether a two-step optimization procedure is to be used. The first includes a simulate annealing approach, with the second involving a refinement using subplex. The default is FALSE.
sann.its
a numeric indicating the number of times the simulated annealing algorithm should call the objective function.
max.tol
supplies the relative optimization tolerance to subplex.

Value

  • hisse returns an object of class hisse.fit. This is a list with elements:
  • $loglikthe maximum negative log-likelihood.
  • $AICAkaike information criterion.
  • $AICcAkaike information criterion corrected for sample-size.
  • $solutiona matrix containing the maximum likelihood estimates of the model parameters.
  • $index.paran index matrix of the parameters being estimated.
  • $fuser-supplied sampling frequencies.
  • $condition.on.surivivala logical indicating whether the likelihood was conditioned on the survival of two lineages and the speciation event subtending them.
  • $root.typeindicates the user-specified root prior assumption.
  • $root.pindicates whether the user-specified fixed root probabilities.
  • $phyuser-supplied tree
  • $datauser-supplied dataset
  • $output.typethe user-specified output.type to be printed on the screen.
  • $trans.typethe user-specified transition model.
  • $trans.matthe index matrix that specifies the free parameters in the transition model.
  • $max.tolrelative optimization tolerance.

Details

This function sets up and executes a four-state trait independent HiSSE model. The model closely follows hisse.

Like hisse, users input vectors containing values to indicate how many free parameters are to be estimated for each of the variables in the model. However, the null-four model assumes that turnover.anc and eps.anc are linked between the two observed states. Thus, users are unlikely to alter the inputs much, aside from perhaps fixing turnover.anc or eps.anc to be equal across the four hidden states, where the turnover.anc input vector is set as rep(c(1,1,1,1),2). For a Yule equivalent, the input vector for eps.anc would be rep(c(0,0,0,0),2). For how to setup a null-two model see the example code below.

References

Beaulieu, J.M, and B.C. O'Meara. In revision. Detecting hidden diversification shifts in models of trait-dependent speciation and extinction. Syst. Biol. In revision.

Examples

Run this code
## Not run
# library(diversitree)
# 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)
# sim.dat <- data.frame(names(phy$tip.state), phy$tip.state)

## Fit null-four HiSSE:
# pp.hisse.null <- hisse(phy, sim.dat, turnover.anc=rep(c(1,2,3,4),2), 
# eps.anc=rep(c(1,2,3,4),2), trans.type="equal")

## Fit null-two HiSSE model:
# trans.rates.hisse <- TransMatMaker(hidden.states=TRUE)
# trans.rates.hisse <- ParDrop(trans.rates.hisse, c(3,5,8,10))
# trans.rates.hisse[!is.na(trans.rates.hisse) & !trans.rates.hisse == 0] = 1
# pp.hisse <- hisse(phy, sim.dat, hidden.states=TRUE, turnover.anc=c(1,1,2,2), 
# eps.anc=c(1,1,2,2), trans.rate=trans.rates.hisse)

Run the code above in your browser using DataLab