Learn R Programming

heemod (version 1.0.2)

create_matrix_from_tabular: Create a Transition Matrix From Tabular Input

Description

Transforms tabular input defining a transition matrix into an heemod object.

Usage

create_matrix_from_tabular(trans_probs, state_names, df_env = globalenv())

Value

A transition matrix.

Arguments

trans_probs

Result for one model of parse_multi_spec().

state_names

The names of the states used in the transition matrix.

df_env

An environment containing external data.

Details

The data frame trans_probs should have columns from, to, and prob, where prob is the probability of a transition from the from state to the to state. Prob can be defined in terms of parameters, just as when using define_transition at the keyboard. Probabilities of 0 need not be specified - they will be automatically inserted.

All state names must be used in the from column of the transition matrix (otherwise you can just get rid of the state). Absorbing states should have a transition from and to themselves with probability 1.