View source: R/hazard-auxiliary.R
movement_prob2rate | R Documentation |
Given a stochastic matrix, return the rate matrix (infinitesimal generator) that would generate it when exponentiated over the interval of unit time.
movement_prob2rate(tau)
tau |
a row normalized stochastic matrix |
Warning: if the matrix provided has diagonal-only rows (i.e., the location is independent), the rate matrix will return 0 in that row, as there is no movement rate that can generate that scenario.
a list with two elements: gamma
negative diagonal of the rate
matrix, mat
matrix of row normalized off-diagonal elements
# generate random matrix for example # This represents a 3-node landscape, with random movement between nodes moveMat <- matrix(data = runif(n = 9), nrow = 3, ncol = 3) moveMat <- moveMat/rowSums(moveMat) moveRate <- movement_prob2rate(tau = moveMat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.