
Change the link
change_link.Rd
Change the link function for the potential impact fraction or population attributable fraction to a different link.
Arguments
- x
A
pif_class
object- link
Link function such that the
pif
confidence intervals stays within the expected bounds.- link_inv
The inverse of
link
. For example iflink
islogit
this should beinv_logit
.- link_deriv
Derivative of the
link
function. The function tries to build it automatically fromlink
usingDeriv::Deriv()
.
Examples
#A potential impact fraction
pif1 <- pif(p = 0.2, p_cft = 0.1, beta = 1.2, var_p = 0.01,
var_beta = 0.2)
pif1
#>
#> ── Potential Impact Fraction: [deltapif-0118194874409683] ──
#>
#> PIF = 15.848% [95% CI: -19.419% to 40.699%]
#> standard_deviation(pif %) = 15.028
#Now change the pif to logit to control the negatives
pif1_logit <- change_link(pif1, link = "logit")
pif1_logit
#>
#> ── Potential Impact Fraction: [deltapif-0118194874409683] ──
#>
#> PIF = 15.848% [95% CI: 2.027% to 63.158%]
#> standard_deviation(pif %) = 15.028