Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Rate and transition probability conversion function

c(h,Delta) = p

Maps an event rate and a time interval to the probability that the event occurs within that interval, and back again. Rates are converted rather than probabilities divided, because a probability is tied to the length of the interval over which it was observed. The converted probability then enters a transition matrix used in the cohort update s_(t+1) = s_t P described on the Markov Model page.

  • Transition probability from a constant rate

    p = 1 - exp(-h * Delta)

    Converts a constant event rate into the probability that the event occurs within an interval of length Delta, among people at risk at the start of the interval. The function exp is the exponential function.

  • Constant rate from a transition probability

    h = -log(1 - p) / Delta

    Recovers the constant rate implied by a probability observed over an interval of length Delta. The function log is the natural logarithm. The rate can then be rescaled to any cycle length or combined with a hazard ratio.

  • Transition probability rescaled to a new cycle length

    p_new = 1 - (1 - p_old)^(Delta_new / Delta_old)

    Converts a probability observed over one interval into the probability for a model cycle of a different length, under a constant hazard. It combines the two conversions above without computing the rate explicitly.

  • Destination probabilities under constant competing hazards

    p_1 = h_1 / (h_1 + h_2) * (1 - exp(-(h_1 + h_2) * Delta)); p_2 = h_2 / (h_1 + h_2) * (1 - exp(-(h_1 + h_2) * Delta)); p_stay = exp(-(h_1 + h_2) * Delta)

    Splits the probability of leaving a state within an interval between two absorbing destinations with constant cause-specific hazards h_1 and h_2. The total exit probability depends on the summed hazard, and each destination receives its share h_1 or h_2 of that sum.