
Change the link
change_link.RdChange the link function for the potential impact fraction or population attributable fraction to a different link.
Arguments
- x
A
pif_classobject- link
Link function such that the
pifconfidence intervals stays within the expected bounds.- link_inv
(Optional). If
linkis a function then yhe inverse oflink. For example iflinkislogitthis should beinv_logit.- link_deriv
Derivative of the
linkfunction. The function tries to build it automatically fromlinkusingDeriv::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