stRCPP {ibmcraftr} | R Documentation |
Make state transitions using Rcpp.
Description
Take in the matrix of the states of synthetic population (created by syn_pop
function)
and calculate the transitions from one state to other state(s) using the transition probabilities [not rate(s)].
The major difference from the R alone version was that instead of having the transition rate(s),
transition probabilities are used. These probabilities will thus be calculated with another function.
Usage
stRCPP(origin, new.states, params, s.matrix)
Arguments
origin |
A number which represents the column index |
new.states |
A numeric vector or a number which represents the column index |
params |
A numeric vector of similar length to |
s.matrix |
A state matrix created from |
Value
A transition matrix of the same dimension as s.matrix
. -1 indicates that the individual has left
the corresponding state. +1 indicates that the individual has become the corresponding state.
Examples
pop <- syn_pop(c(19,1,0,0))
stRCPP(1,2,.1,pop)