Skip to contents

Method for obtaining the summary 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).

Usage

# S3 method for pif_class
summary(
  object,
  parm = NULL,
  level = 0.95,
  method = c("wald", "percentile"),
  ...
)

Arguments

object

A pif_class object

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

(double) Confidence level for the uncertainty interval. Defaults to 0.95.

method

(string) either 'wald' (recommended) or 'percentile' for uncertainty intervals based upon the bootstrap's percentile or the Wald-type approximation (see confidence interval section)

...

Additional methods to pass to coef.pif_class()

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,
)
summary(pifsim)
#> $Type
#> [1] "Potential Impact Fraction (PIF)"
#> 
#> $Number_of_bootstrap_simulations
#> [1] 10
#> 
#> $Point_estimates
#>     counterfactual   relative_risk potential_impact_fraction
#> 1 Counterfactual_1 Relative_Risk_1                0.01412828
#>   average_relative_risk average_counterfactual
#> 1              2798.433               2744.897
#> 
#> $Confidence_intervals
#>     counterfactual   relative_risk potential_impact_fraction
#> 1 Counterfactual_1 Relative_Risk_1              -0.006969595
#> 2 Counterfactual_1 Relative_Risk_1               0.035226148
#>   average_relative_risk average_counterfactual        type
#> 1             -16873.55              -16550.27  Lower 2.5%
#> 2              22470.41               22040.06 Upper 97.5%
#>