paf.linear: Population Attributable Fraction with Linear Relative Risk...

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/paf_linear.R

Description

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].

Usage

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)

Arguments

X

Random sample (data.frame) which includes exposure and covariates or sample mean if "approximate" method is selected.

thetahat

Asymptotically consistent or Fisher consistent estimator (vector) of theta for the Relative Risk function rr.

**Optional**

method

Either "empirical" (default), "kernel" or "approximate". For details on estimation methods see pif.

weights

Normalized survey weights for the sample X.

Xvar

Variance of exposure levels (for "approximate" method).

deriv.method.args

method.args for hessian (for "approximate" method).

deriv.method

method for hessian. Don't change this unless you know what you are doing (for "approximate" method).

adjust

Adjust bandwith parameter (for "kernel" method) from density.

n

Number of equally spaced points at which the density (for "kernel" method) is to be estimated (see density).

ktype

kernel type: "gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine" (for "kernel" method). Additional information on kernels in density.

bw

Smoothing bandwith parameter (for "kernel" method) from density. Default "SJ".

check_exposure

boolean Check that exposure X is positive and numeric.

check_rr

boolean Check that Relative Risk function rr equals 1 when evaluated at 0.

check_integrals

boolean Check that counterfactual cft and relative risk's rr expected values are well defined for this scenario.

Value

paf Estimate of Population Attributable Fraction with linear relative risk.

Note

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.

Author(s)

Rodrigo Zepeda-Tello rzepeda17@gmail.com

Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> daliaf172@gmail.com

References

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 Also

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.

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
#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

pifpaf documentation built on May 1, 2019, 9:11 p.m.