Description Usage Arguments Value Note Author(s) See Also Examples
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.
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)
|
X |
Random sample ( |
thetahat |
Estimator ( |
rr |
Function for Relative Risk which uses parameter **Optional** |
cft |
Function |
weights |
Normalized survey |
adjust |
Adjust bandwith parameter from density from
|
n |
Number of equally spaced points at which the density is to be
estimated (see |
ktype |
|
bw |
Smoothing bandwith parameter from density from
|
check_exposure |
Check that exposure |
check_rr |
Check that Relative Risk function |
check_integrals |
Check that counterfactual and relative risk's expected values are well defined for this scenario. |
is_paf |
Boolean forcing evaluation of |
pif Estimate of Potential Impact Fraction
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
.
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> daliaf172@gmail.com
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.