Description Usage Arguments Value Author(s) Examples
Estimates a 1 - alpha pivotal confidence interval for the
potential impact fraction pif
using a boostrap approximation.
1 2 3 4 5 6 7 8 | pif.confidence.bootstrap(X, thetahat, thetavar, rr, cft = NA,
weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))),
method = c("empirical", "kernel"), nboost = 10000, adjust = 1,
n = 512, confidence = 95, 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, check_thetas = TRUE,
is_paf = FALSE)
|
X |
Random sample (vector or matrix) which includes exposure and covariates. |
thetahat |
Maximum Likelihood estimator (vector or matrix) of
|
thetavar |
Estimator of variance of |
rr |
Function for Relative Risk which uses parameter
**Optional** |
cft |
Function |
weights |
Normalized survey |
method |
Either |
nboost |
Number of samples in Bootstrap |
adjust |
Adjust bandwith parameter from density (for |
n |
Number of equally spaced points at which the density (for
|
confidence |
Concidence level (0 to 100) default = |
ktype |
|
bw |
Smoothing bandwith parameter from density (for |
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 |
check_thetas |
Checks that theta parameters are correctly inputed |
is_paf |
Boolean forcing evaluation of |
pif Estimate of Potential Impact Fraction
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 29 30 | #Example 1: Exponential Relative Risk
#----------------------------------------
set.seed(18427)
X <- rnorm(100,5,1)
thetahat <- 0.4
thetavar <- 0.1
pif.confidence.bootstrap(X, thetahat, thetavar, function(X, theta){exp(theta*X)},
nboost = 100) #nboost small only for example purposes
#This also works with kernel method
pif.confidence.bootstrap(X, thetahat, thetavar, function(X, theta){exp(theta*X)},
nboost = 100, method = "kernel")
#Example 2: Multivariate example
#----------------------------------------
## Not run:
set.seed(18427)
X1 <- rnorm(100, 1, 0.05)
X2 <- rnorm(100, 1, 0.05)
X <- as.matrix(cbind(X1,X2))
thetahat <- c(2, 0.03)
thetavar <- matrix(c(0.1, 0, 0, 0.05), byrow = TRUE, nrow = 2)
rr <- function(X, theta){
.X <- as.matrix(X, ncol = 2)
exp(theta[1]*.X[,1] + theta[2]*.X[,2])
}
cft <- function(X){0.5*X}#' cft <- function(X){0.95*X}
pif.confidence.bootstrap(X, thetahat, thetavar, rr, cft)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.