Model the drug adherence using either a binomial probability distribution or a markov chain model based on the probability of staying adherent and of becoming adherent once non-adherent.
new_adherence(
n = 100,
type = c("markov", "binomial"),
p_markov_remain_ad = 0.75,
p_markov_become_ad = 0.75,
p_binom = 0.7
)
Returns a vector of length n
containing values 0 (non-adherent) or 1 (adherent).
Numeric vector of length n
number of occasions to simulate
type of adherence simulation, either "markov" or "binomial"
markov probability of staying adherent
markov probability of going from non-adherent to adherent state
binomial probability of being adherent