m_transition_matrix: Extract transition rates from a multistate HiSSE model...

Description Usage Arguments Value Examples

View source: R/utilhisse.R

Description

A helper function that formats hisse::MuHiSSE's output into a matrix so transition rates between states can be easier to visualize.

Usage

1
m_transition_matrix(model_fit, hidden_states = TRUE, states)

Arguments

model_fit

A muhisse fit object

hidden_states

Logical whether the model contains hidden states

states

A vector of state labels to replace hisse's 0/1 notation (see examples)

Value

The estimated transition rates formatted in a matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# The translation should follow the order of states in model_fit$solution.
# In this example, hisse's 00, 01, 10, and 11 states correspond to
# marine-plankton, marine-benthos, freshwater-plankton, and freshwater-benthos

States <- c("mp", "mb", "fp", "fb")

# muhisse model
data("diatoms")
m_transition_matrix(
 model_fit = diatoms$muhisse,
 hidden_states = TRUE,
 states = States)

# CID8 model
# we have 8 hidden states, so the transition matrix is cumbersome
m_transition_matrix(
 model_fit = diatoms$cid8,
 hidden_states = TRUE,
 states = States)

# musse model, no hidden states
m_transition_matrix(
 model_fit = diatoms$musse,
 hidden_states = FALSE,
 states = c("mp", "mb", "fp", "fb"))

teofiln/utilhisse documentation built on Sept. 3, 2020, 2:55 p.m.