Skip to contents

Returns the bootstrap simulations for pif and paf

Usage

get_bootstrap_simulations(object)

Arguments

object

A pif_class object

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_bootstrap_simulations(pifsim)
#>           potential_impact_fraction average_relative_risk
#> result.1                0.018602291             2.1635133
#> result.2                0.012191399             3.9309001
#> result.3                0.013969539             2.8501448
#> result.4                0.025763340          1079.4053898
#> result.5                0.011599829            11.1565398
#> result.6                0.006881619             0.2263781
#> result.7                0.009452571             2.6595716
#> result.8                0.025531238           166.0541858
#> result.9                0.007304812           577.7690080
#> result.10               0.012049900           161.2211139
#>           average_counterfactual   counterfactual   relative_risk
#> result.1               2.1232670 Counterfactual_1 Relative_Risk_1
#> result.2               3.8829769 Counterfactual_1 Relative_Risk_1
#> result.3               2.8103295 Counterfactual_1 Relative_Risk_1
#> result.4            1051.5963012 Counterfactual_1 Relative_Risk_1
#> result.5              11.0271259 Counterfactual_1 Relative_Risk_1
#> result.6               0.2248202 Counterfactual_1 Relative_Risk_1
#> result.7               2.6344318 Counterfactual_1 Relative_Risk_1
#> result.8             161.8146169 Counterfactual_1 Relative_Risk_1
#> result.9             573.5485140 Counterfactual_1 Relative_Risk_1
#> result.10            159.2784155 Counterfactual_1 Relative_Risk_1