pif.confidence.approximate.loglinear: Confidence Intervals for the Potential Impact Fraction when...

Description Usage Arguments Author(s) Examples

View source: R/pif_confidence_approximate_loglinear.R

Description

Confidence intervals for the Population Attributable Fraction for the approximate method where only mean and variance from a previous study is available.For relative risk inyective functions, the pif is inyective, and intervals can be calculated for log(pif), and then transformed to pif CI.

Usage

1
2
3
4
5
pif.confidence.approximate.loglinear(Xmean, Xvar, thetahat, thetavar, rr,
  cft = NA, deriv.method.args = list(), deriv.method = c("Richardson",
  "complex"), check_exposure = TRUE, check_rr = TRUE,
  check_integrals = TRUE, nsim = 1000, confidence = 95,
  check_thetas = TRUE, is_paf = FALSE)

Arguments

Xmean

Mean value of exposure levels from a cross-sectional.

Xvar

Variance of the exposure levels.

thetahat

Estimator (vector or matrix) of theta for the Relative Risk function rr

thetavar

Estimator of variance of thetahat

rr

Function for Relative Risk which uses parameter theta. The order of the parameters shound be rr(X, theta).

**Optional**

cft

Differentiable function cft(X) for counterfactual. Leave empty for the Population Attributable Fraction paf where counterfactual is 0 exposure.

deriv.method.args

method.args for hessian.

deriv.method

method for hessian. Don't change this unless you know what you are doing.

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.

nsim

Number of simulations for estimation of variance

confidence

Concidence level (0 to 100) default = 95 %

check_thetas

Checks that theta parameters are correctly inputed

is_paf

Boolean forcing evaluation of paf

Author(s)

Rodrigo Zepeda-Tello [email protected]

Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> [email protected]

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
#Example 1: Exponential Relative Risk
#--------------------------------------------
set.seed(46987)
rr      <- function(X,theta){exp(X*theta)}
cft     <- function(X){0.4*X}
Xmean   <- data.frame(3)
Xvar    <- 1
theta   <- 0.4
thetavar <- 0.001
pif.confidence.approximate.loglinear(Xmean, Xvar, theta, thetavar, rr, cft,
nsim = 1000)

#Example 2: Multivariate Relative Risk
#--------------------------------------------
X1       <- rnorm(100,3,.5)
X2       <- rnorm(100,4,1)
X        <- data.frame(cbind(X1,X2))
Xmean    <- t(as.matrix(colMeans(X)))
Xvar     <- cov(X)
thetahat <- c(0.12, 0.17)
thetavar  <- matrix(c(0.001, 0.00001, 0.00001, 0.004), byrow = TRUE, nrow = 2)
rr       <- function(X, theta){exp(theta[1]*X[,1] + theta[2]*X[,2])}
pif.confidence.approximate.loglinear(Xmean, Xvar, thetahat, thetavar, 
rr, cft = function(X){0.8*X}, nsim = 100)

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