Extract quantiles of the potential impact fraction or population attributable fraction bootstrap simulations
quantile_bootstrap.Rd
Method for obtaining the variance-covariance matrix of bootstrap simulations
of a pif_class
object (i.e. the point-estimate of the potential impact fraction or
population attributable fraction via the bootstrap).
Arguments
- x
A
pif_class
object- prob
numeric vector of probabilities with values between 0 and 1
- ...
additional arguments to pass to stats::quantile
Examples
#Example 1
data(ensanut)
options(survey.lonely.psu = "adjust")
design <- survey::svydesign(data = ensanut, ids = ~1, weights = ~weight, strata = ~strata)
rr <- function(X, theta) {
exp(-2 +
theta[1] * X[, "age"] + theta[2] * X[, "systolic_blood_pressure"] / 100)
}
cft <- function(X) {
X[, "systolic_blood_pressure"] <- X[, "systolic_blood_pressure"] - 5
return(X)
}
pifsim <- pif(design,
theta = log(c(1.05, 1.38)), rr, cft,
additional_theta_arguments = c(0.01, 0.03), n_bootstrap_samples = 10,
)
quantile_bootstrap(pifsim, c(0.1, 0.3, 0.5))
#> counterfactual relative_risk potential_impact_fraction
#> 1 Counterfactual_1 Relative_Risk_1 0.006058022
#> 2 Counterfactual_1 Relative_Risk_1 0.013733630
#> 3 Counterfactual_1 Relative_Risk_1 0.017201760
#> average_relative_risk average_counterfactual quantile
#> 1 0.002041747 0.001998326 0.1
#> 2 0.277577252 0.270856565 0.3
#> 3 2.214570718 2.183890090 0.5