Description Usage Arguments Value Note Author(s) References See Also Examples
Function that calculates the Population Attributable Fraction
paf
with linear Relative Risk function rr
given by
rr(X, theta) = theta[1] + theta[2]*X[,1] + theta[3]*X[,2] + ... + theta[n+1]*X[,n].
1 2 3 4 5 | paf.linear(X, thetahat, method = "empirical",
weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))), Xvar = var(X),
deriv.method.args = list(), deriv.method = c("Richardson", "complex"),
adjust = 1, n = 512, ktype = "gaussian", bw = "SJ",
check_exposure = TRUE, check_rr = TRUE, check_integrals = TRUE)
|
X |
Random sample ( |
thetahat |
Asymptotically consistent or Fisher consistent estimator ( **Optional** |
method |
Either |
weights |
Normalized survey |
Xvar |
Variance of exposure levels (for |
deriv.method.args |
|
deriv.method |
|
adjust |
Adjust bandwith parameter (for |
n |
Number of equally spaced points at which the density (for
|
ktype |
|
bw |
Smoothing bandwith parameter (for
|
check_exposure |
|
check_rr |
|
check_integrals |
|
paf Estimate of Population Attributable Fraction with linear relative risk.
The "approximate"
method should be the last choice. In practice
"empirical"
should be preferred as convergence is faster than
"kernel"
for most functions. In addition, the scope of
"kernel"
is limited as it does not work with multivariate exposure
data X
.
paf.linear
is a wrapper for paf
with linear
relative risk.
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-GarcĂa-FormentĂ daliaf172@gmail.com
Vander Hoorn, S., Ezzati, M., Rodgers, A., Lopez, A. D., & Murray, C. J. (2004). Estimating attributable burden of disease from exposure and hazard data. Comparative quantification of health risks: global and regional burden of disease attributable to selected major risk factors. Geneva: World Health Organization, 2129-40.
See paf
for Population Attributable Fraction (with
arbitrary relative risk), and pif
for Potential Impact Fraction
estimation.
See paf.exponential
for PAF with ready-to-use exponential
relative risk function.
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 | #Example 1: Univariate relative risk
#----------------------------------------
set.seed(18427)
X <- data.frame(Exposure = rnorm(100,3,.5))
thetahat <- c(1, 0.12) #Linear risk given by 1 + 0.12*X
paf.linear(X, thetahat)
#This is the same as doing:
paf(X, thetahat, rr = function(X, theta){X*theta[2] + theta[1]})
#Same example with kernel method
paf.linear(X, thetahat, method = "kernel")
#Same example with approximate method
Xmean <- data.frame(mean(X[,"Exposure"]))
Xvar <- var(X)
paf.linear(Xmean, thetahat, method = "approximate", Xvar = Xvar)
#Example 2: Multivariate relative risk
#----------------------------------------
X <- data.frame(Exposure = rnorm(100,2,.7), Covariate = rnorm(100,4,1))
theta <- c(1, 0.3,0.1)
paf.linear(X, theta) #Linear risk given by 1 + 0.3*X1 + 0.1*X2
#Example 3: Polynomial relative risk
#----------------------------------------
X <- runif(100)
X2 <- X^2
X3 <- X^3
matX <- data.frame(X,X2,X3)
theta <- c(1, 0.3,0.1, 0.4)
paf.linear(matX,theta) #Polynomial risk: 1 + 0.3*X + 0.1*X^2 + 0.4*X^3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.