Get bootstrap simulations exclusively from pif
and paf
get_pif_simulations.Rd
Returns the bootstrap simulations for pif
and paf
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,
)
get_pif_simulations(pifsim)
#> potential_impact_fraction counterfactual relative_risk
#> result.1 0.003669701 Counterfactual_1 Relative_Risk_1
#> result.2 0.032820408 Counterfactual_1 Relative_Risk_1
#> result.3 0.004224853 Counterfactual_1 Relative_Risk_1
#> result.4 0.029365131 Counterfactual_1 Relative_Risk_1
#> result.5 0.034605423 Counterfactual_1 Relative_Risk_1
#> result.6 0.025889297 Counterfactual_1 Relative_Risk_1
#> result.7 0.023133935 Counterfactual_1 Relative_Risk_1
#> result.8 0.021832001 Counterfactual_1 Relative_Risk_1
#> result.9 0.009654618 Counterfactual_1 Relative_Risk_1
#> result.10 0.014331641 Counterfactual_1 Relative_Risk_1