Model adherence as a markov chain model, based on the probability of staying adherent and of becoming adherent once non-adherent. Assumes all patients start adherent.
adherence_markov(n = 100, p11 = 0.9, p01 = 0.7)
Returns a vector of length n
containing values 0 (non-adherent) or 1 (adherent).
Numeric vector of length n
number of occasions
probability of staying adherent
probability of going from non-adherent to adherent state