Learn R Programming

phylosim (version 3.0.5)

getEventRate.QMatrix: Get the unscaled rate of an event from a QMatrix object

Description

Get the unscaled rate of an event from a QMatrix object.

This method return the element corresponding to a given event from the scaled rate matrix stored in a QMatrix object. The event can be specified by the inital and target states ("from" and "to" arguments), or by the event name ("from->to"). The event name takes precedence over the "from" and "to" arguments.

This method returns NA if the resacling of the rates was not performed. The scaling is performed by the rescaleQMatrix.GeneralSubstitution method.

Usage

# S3 method for QMatrix
getEventRate(this, name=NA, from=NA, to=NA, ...)

Arguments

this

A QMatrix object.

name

The name of the event.

from

The initial state.

to

Target state.

...

Not used.

Value

A Numeric vector of length one.

See Also

For more information see QMatrix.

Examples

Run this code
# NOT RUN {
       # create a QMatrix object
       # provide an Alphabet object and the rates
       m<-QMatrix(alphabet=BinaryAlphabet(), rate.list=list("0->1"=1,"1->0"=1))
       # get the unscaled rate of "0->1" by name
       getEventRate(m,"0->1")  # retruns NA
       # get the unscaled rate of "0->1" by states
       getEventRate(m,from="0",to="1")	# returns NA
 
# }

Run the code above in your browser using DataLab