Skip to contents

Method for checking whether the object is a potential impact fraction

Usage

is_pif(x)

Arguments

x

An object

Value

Boolean whether an object is a potential impact fraction or not.

Note

The population attributable fraction is a type of potential impact fraction so the is_pif method will return TRUE even when estimating 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,
)
is_pif(pifsim)
#> [1] TRUE