Skip to contents

These convenience functions make it easier to compute transition probabilities from incidence rates, OR, RR, or probabilities estimated on a different timeframe.

Usage

rescale_prob(p, to = 1, from = 1)

prob_to_prob(...)

rate_to_prob(r, to = 1, per = 1)

or_to_prob(or, p)

rr_to_prob(rr, p)

Arguments

p

Probability.

to

Compute probability for that timeframe.

from

Timeframe of the original probability.

...

For deprecated functions.

r

Rate.

per

Number of person-time corresponding to the rate.

or

Odds ratio.

rr

Relative risk.

Value

A probability.

Examples

# convert 5-year probability 
# to 1-year probability
rescale_prob(p = .65, from = 5)
#> [1] 0.1893869

# convert 1-year probability 
# to 1-month probability
rescale_prob(p = .5, to = 1/12)
#> [1] 0.05612569

# convert rate per 1000 PY
# to 5-year probability
rate_to_prob(r = 162, per = 1000, to = 5)
#> [1] 0.5551419

# convert OR to probability
or_to_prob(or = 1.9, p = .51)
#> [1] 0.6641535

# convert RR to probability
rr_to_prob(rr = 1.9, p = .51)
#> [1] 0.969