
Partial derivatives of PIF
derivatives.RdCalculates the partial derivatives of a potential impact fraction
with respect to the parameters p or beta.
Usage
deriv_pif_p(p, p_cft, rr, mu_obs = NULL, mu_cft = NULL, p_cft_jacobian = NULL)
deriv_pif_beta(p, p_cft, rr, rr_link_deriv_vals, mu_obs = NULL, mu_cft = NULL)Arguments
- p
Prevalence (proportion) of the exposed individuals for each of the
Nexposure levels.- p_cft
Counterfactual prevalence (proportion) of the exposed individuals for each of the
Nexposure levels. Either a numeric vector, for a fixed target that does not depend on the observed prevalence, or a function ofpreturning the counterfactual prevalence, for scenarios defined relative to the current exposure (e.g.function(p) 0.85 * pfor a 15% reduction). In the latter case the uncertainty inpis also propagated through the counterfactual. See the section Fixed and relative counterfactuals.- rr
The relative risk for each of the exposure levels.
- mu_obs
The average value of the relative risk in the observed population.
- mu_cft
The average value of the counterfactual relative risk in the population.
- p_cft_jacobian
(Optional) Jacobian of the counterfactual prevalence
p_cftwith respect topwhen the counterfactual is a function of the observed prevalence (for example a relative reductionp_cft = 0.85 * p). Entry[j, i]is the derivative ofp_cft[j]with respect top[i].NULL(default) assumesp_cftis a fixed target.- rr_link_deriv_vals
The derivative of the relative risk function
gwith respect to the parameterbetaevaluated atbeta.
Formulas
The partial derivative of PIF with respect to p is:
$$
\dfrac{\partial \textrm{PIF}}{\partial p} =
\dfrac{\mu^{\text{cft}}}{\big(\mu^{\text{obs}}\big)^2} \cdot \big( \text{RR}(\beta) - 1\big)
$$
If the counterfactual is a function of the prevalence, \(p_{*} = g(p)\),
the total derivative adds the term
\(- J_g^{\top} \big( \text{RR}(\beta) - 1\big) / \mu^{\text{obs}}\)
where \(J_g\) is the Jacobian of \(g\) evaluated at \(p\).
The partial derivative of PIF with respect to beta is:
$$
\dfrac{\partial \textrm{PIF}}{\partial \beta} =
\Bigg(
\dfrac{
\mu^{\text{cft}} \cdot p - \mu^{\text{obs}} \cdot p_{*}
}{
\Big( \mu^{\text{obs}}\Big)^2
}
\Bigg)\odot \text{RR}^{\prime}(\beta)
$$
with \(\odot\) representing the Hadamard (elementwise) product.