Description Usage Arguments Author(s) Examples
Function that calculates approximate confidence intervals to the population attributable fraction
1 2 3 4 5 6 7 | pif.confidence.approximate(Xmean, Xvar, thetahat, thetavar, rr,
cft = function(Xmean) { matrix(0, ncol = ncol(as.matrix(Xmean)), nrow =
nrow(as.matrix(Xmean))) }, check_thetas = TRUE, check_cft = TRUE,
check_xvar = TRUE, check_rr = TRUE, check_integrals = TRUE,
check_exposure = TRUE, deriv.method.args = list(),
deriv.method = c("Richardson", "complex"), nsim = 1000, confidence = 95,
is_paf = FALSE)
|
Xmean |
Mean value of exposure levels. |
Xvar |
Variance of exposure levels. |
thetahat |
Estimator (vector or matrix) of |
thetavar |
Estimator of variance of |
rr |
Function for Relative Risk which uses parameter
**Optional** |
cft |
Function |
check_thetas |
Checks that theta parameters are correctly inputed |
check_cft |
Check if counterfactual function |
check_xvar |
Check if it is covariance matrix. |
check_rr |
Check that Relative Risk function |
check_integrals |
Check that counterfactual and relative risk's expected values are well defined for this scenario. |
check_exposure |
Check that exposure |
deriv.method.args |
|
deriv.method |
|
nsim |
Number of simulations for estimation of variance |
confidence |
Concidence level (0 to 100) default = |
is_paf |
Force evaluation of paf |
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-GarcĂa-FormentĂ daliaf172@gmail.com
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 | ## Not run:
#Example 1: Exponential Relative risk
#--------------------------------------------
set.seed(46987)
rr <- function(X,theta){exp(X*theta)}
cft <- function(X){0.5*X}
X <- runif(1000)
Xmean <- data.frame(mean(X))
Xvar <- var(X)
theta <- 0.2
thetavar <- 0.015
pif.confidence.approximate(Xmean, Xvar, theta, thetavar, rr)
pif.confidence.approximate(Xmean, Xvar, theta, thetavar, rr, cft)
#Example 2: Multivariate example
#--------------------------------------------
X1 <- rnorm(1000,3,.5)
X2 <- rnorm(1000,4,1)
X <- as.matrix(cbind(X1,X2))
Xmean <- data.frame(t(colMeans(X)))
Xvar <- cov(X)
theta <- 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(Xmean, Xvar, theta, thetavar, rr,
cft = function(X){cbind(0.5*X[,1],0.4*X[,2])})
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.