View source: R/distribution_functions.R
| ddwell | R Documentation |
Computes the dwell-time distribution of a periodically inhomogeneous Markov chain for a given transition probability matrix.
ddwell(x, Gamma, time = NULL, state = NULL)
x |
vector of (non-negative) dwell times to compute the dwell-time distribution for |
Gamma |
array of |
time |
integer vector of time points in |
state |
integer vector of state indices for which to compute the dwell-time distribution. If |
For Markov chains whose transition probabilities vary only periodically, which is achieved for example by
expressing the transition probability matrix as a periodic function of the time of day using tpm_p or cosinor, the probability distribution of time spent in a state can be computed analytically.
This function computes said distribution, either for a specific time point (conditioning on transitioning into the state at that time point) or for the overall distribution (conditioning on transitioning into the state at any time point).
either time-varying dwell-time distribution(s) if time is specified, or overall dwell-time distribution if time is NULL.
If more than one state is specified, a named list over states is returned.
Koslik, J. O., Feldmann, C. C., Mews, S., Michels, R., & Langrock, R. (2023). Inference on the state process of periodically inhomogeneous hidden Markov models for animal behavior. arXiv preprint arXiv:2312.14583.
# setting parameters for trigonometric link
beta = matrix(c(-1, 2, -1, -2, 1, -1), nrow = 2, byrow = TRUE)
Gamma = tpm_p(beta = beta, degree = 1)
# at specific times and for specific state
ddwell(1:20, Gamma, time = 1:4, state = 1)
# results in 4x20 matrix
# or overall distribution for all states
ddwell(1:20, Gamma)
# results in list of length 2, each element is a vector of length 20
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.