Learn R Programming

phylosim (version 3.0.5)

setRate.QMatrix: Set an unscaled rate in a QMatrix object

Description

Set an unscaled rate in a QMatrix object.

This method sets the element corresponding to a given event in the unscaled rate matrix. 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.

Usage

# S3 method for QMatrix
setRate(this, name=NA, value, from=NA, to=NA, scale=TRUE, diag=TRUE, guess.equ=TRUE, ...)

Arguments

this

A QMatrix object.

name

The name of the event.

value

The new value of the rate.

from

The initial state.

to

Target state.

scale

Call rate rescaling.

diag

Calculate diagonal elements.

guess.equ

Guess equilibrium distribution.

...

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("1->0"=1,"0->1"=1))
       # set the unscaled rate by event name
       setRate(m,"0->1",2)
       # get the unscaled rate of "0->1" by name
       getRate(m,"0->1")     
       # set the unscaled rate by states
       setRate(m,"0->1",0.5)
       # set the unscaled rate of "0->1" by states
       setRate(m,"0->1",0.5)
       # get the unscaled rate of "0->1" by states
       getRate(m,from="0",to="1")
 
# }

Run the code above in your browser using DataLab