pif.kernel: Kernel-based estimate of Potential Impact Fraction In pifpaf: Potential Impact Fraction and Population Attributable Fraction for Cross-Sectional Data

Description

Function for estimating the Potential Impact Fraction `pif` from a cross-sectional sample of the exposure `X` with a known Relative Risk function `rr` with parameters `theta` using kernels.

Usage

 ```1 2 3 4 5 6``` ```pif.kernel(X, thetahat, rr, cft = NA, weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))), adjust = 1, n = 512, ktype = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), bw = c("SJ", "nrd0", "nrd", "ucv", "bcv"), check_exposure = TRUE, check_rr = TRUE, check_integrals = TRUE, is_paf = FALSE) ```

Arguments

 `X` Random sample (`data.frame`) which includes exposure and covariates. or sample mean if approximate method is selected. `thetahat` Estimator (`vector`) of `theta` for the Relative Risk function. `rr` Function for Relative Risk which uses parameter `theta`. The order of the parameters shound be `rr(X, theta)`. **Optional** `cft` Function `cft(X)` for counterfactual. Leave empty for the Population Attributable Fraction `paf` where counterfactual is 0 exposure. `weights` Normalized survey `weights` for the sample `X`. `adjust` Adjust bandwith parameter from density from `density`. `n` Number of equally spaced points at which the density is to be estimated (see `density`). `ktype` `kernel` type: `"gaussian"`, `"epanechnikov"`, `"rectangular"`, `"triangular"`, `"biweight"`, `"cosine"`, `"optcosine"`. Additional information on kernels in `density` `bw` Smoothing bandwith parameter from density from `density`. Default `"SJ"` `check_exposure` Check that exposure `X` is positive and numeric. `check_rr` Check that Relative Risk function `rr` equals `1` when evaluated at `0`. `check_integrals` Check that counterfactual and relative risk's expected values are well defined for this scenario. `is_paf` Boolean forcing evaluation of `paf`.

Value

pif Estimate of Potential Impact Fraction

Note

In practice `pif.empirical` should be prefered as convergence is faster than `pif.kernel` for most functions. In addition, the scope of `pif.kernel` is limited as it does not work with multivariate exposure data `X`.

Author(s)

Rodrigo Zepeda-Tello [email protected]

`pif` which is a wrapper for all pif methods (`pif.empirical`, `pif.approximate`, `pif.kernel`).

For estimation of the Population Attributable Fraction see `paf`.

For more information on kernels see `density`

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37``` ```#Example 1: Relative risk given by exponential #-------------------------------------------- set.seed(18427) X <- data.frame(rnorm(100,3,.5)) thetahat <- 0.12 rr <- function(X, theta){exp(theta*X)} pif.kernel(X, thetahat, rr, cft = function(X){ 0.5*X }) #Choose a different kernel pif.kernel(X, thetahat, rr, cft = function(X){ 0.5*X }, ktype = "gaussian") #Specify kernel options pif.kernel(X, thetahat, rr, cft = function(X){ 0.5*X }, ktype = "gaussian", bw = "nrd", adjust = 0.5, n = 1100) #Without counterfactual estimates PAF pif.kernel(X, thetahat, rr) #Example 2: Linear relative risk #-------------------------------------------- pif.kernel(X, thetahat, rr = function(X, theta){theta*X + 1}, cft = function(X){ 0.5*X }) #Example 3: More complex counterfactual #-------------------------------------------- set.seed(18427) X <- data.frame(rnorm(100,4,1)) thetahat <- c(0.12, 0.03) rr <- function(X, theta){1 + theta[1]*X + theta[2]*X^2} #Creating a counterfactual. As rr requires a bivariate input, cft should #return a two-column matrix cft <- function(X){ X[which(X > 4)] <- 1 return(X) } pif.kernel(X, thetahat, rr, cft) ```

pifpaf documentation built on Sept. 29, 2017, 1:03 a.m.