Skip to contents

Function that determines whether a collection of potential impact fractions or population attributable fractions are pif or paf

Usage

overall_fraction_type(...)

Arguments

...

pif_class objects (i.e. estimations of pif or paf)

Value

A pif_aggregated object estimating the potential impact fraction for individual-level data from multiple distinct impact fractions.

References

There are no references for Rd macro \insertAllCites on this help page.

See also

Examples

# Use the ensanut dataset
data(ensanut)

# EXAMPLE 1
# Setup the survey design
options(survey.lonely.psu = "adjust")
design <- survey::svydesign(data = ensanut, ids = ~1, weights = ~weight, strata = ~strata)
rr_1 <- function(X, theta) {
  exp(-2 +
    theta[1] * X[, "age"] + theta[2] * X[, "systolic_blood_pressure"] / 100)
}

rr_2 <- function(X, theta) {
  exp(-1 +
    theta[1] * X[, "age"] )
}

rr_3 <- function(X, theta) {
  exp(-3 +
    theta[1] * X[, "age"] )
}

cft <- function(X) {
  X[, "systolic_blood_pressure"] <- X[, "systolic_blood_pressure"] - 5
  return(X)
}

pif_1 <- pif(design,
  theta = log(c(1.25, 1.68)), rr_1, cft,
  additional_theta_arguments = c(0.01, 0.03), n_bootstrap_samples = 10,
)

pif_2 <- pif(design,
  theta = log(c(1.12, 1.45)), rr_2, cft,
  additional_theta_arguments = c(0.02, 0.025), n_bootstrap_samples = 10,
)

pif_3 <- pif(design,
  theta = log(c(2.25, 2.57)), rr_3, cft,
  additional_theta_arguments = c(0.01, 0.025), n_bootstrap_samples = 10,
)

overall_fraction_type(pif_1, pif_2, pif_3)
#> [1] "Potential Impact Fraction (PIF)"