View source: R/max_transitions_pmf.R
max_transitions_pmf | R Documentation |
Computes the p.m.f. of the maximum possible number of state transitions (Delta_m) in a two-state Markov chain conditioning on X_0 = 0 or X_0 = 1.
max_transitions_pmf(x, n, alpha, beta, X0 = c("0", "1"), log = FALSE)
x |
maximum number of state transitions in |
n |
number of Markov chain iterations. |
alpha |
a transition probability (between 0 and 1). |
beta |
a transition probability (between 0 and 1). |
X0 |
initial state. Either |
log |
logical if TRUE, probabilities p are given as log(p). |
(log) p, where p = Pr(Delta_m = x)
occupation_time_pmf
, recurrence_time_pmf
M <- 100
deltas.0 <- get_maxK(Sx = 0:(M-1), M = M, X0 = "0")[1:M]
deltas.1 <- get_maxK(Sx = 1:M, M = M, X0 = "1")[1:M]
probs.X0 <- max_transitions_pmf(x = deltas.0, n = M,
alpha = .02, beta = .2, X0 = "0")
probs.X1 <- max_transitions_pmf(x = deltas.1, n = M,
alpha = .02, beta = .2, X0 = "1")
sum(probs.X0); sum(probs.X1) # should both be 1
plot(deltas.0, probs.X0, type = "h", lwd = 3,
ylab = "Probability", xlab = expression(Delta[m]), main = "Maximum transitions")
points(deltas.1, probs.X1, type = "h", lwd = 3, col = 2)
legend(x = "topright", col = 1:2, legend = c(expression(X[0]==0),
expression(X[0]==1)), bty = 'n', pch = 15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.