Description Usage Arguments Author(s) Examples
View source: R/paf_confidence_one_to_one.R
Function that calculates approximate confidence intervals of the
Population Attributable Fraction paf
considering a one to one
Relative Risk rr
with unidimensional theta
parameter values
1 2 3 4 5 6 | paf.confidence.one2one(X, thetahat, rr, thetalow, thetaup,
weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))), confidence = 95,
confidence_theta = 99, check_thetas = TRUE, deriv.method.args = list(),
deriv.method = c("Richardson", "complex"), method = c("empirical",
"approximate"), Xvar = var(X), check_exposure = TRUE, check_rr = TRUE,
check_integrals = TRUE)
|
X |
Random sample ( |
thetahat |
Estimative of |
rr |
Function for Relative Risk which uses parameter
**Optional** |
thetalow |
Lower bound of the confidence interval. |
thetaup |
Upper bound of the confidence interval. |
weights |
Survey |
confidence |
Confidence level % (default: |
confidence_theta |
Confidence level % of |
check_thetas |
Check that thetas are correctly specified |
deriv.method.args |
|
deriv.method |
|
method |
Either |
Xvar |
Variance of exposure levels (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 |
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> 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 31 32 33 34 35 | #Example 1: Exponential Relative Risk
#--------------------------------------------
set.seed(18427)
X <- data.frame(rnorm(1000, 3,.7))
thetahat <- 0.4
thetalow <- 0.1
thetaup <- 0.7
paf.confidence.one2one(X, thetahat, function(X, theta){exp(theta*X)},
thetalow, thetaup)
#Approximate method:
Xmean <- data.frame(mean(X[,1]))
Xvar <- var(X[,1])
paf.confidence.one2one(Xmean, thetahat, function(X, theta){exp(theta*X)},
thetalow, thetaup, Xvar = Xvar, method = "approximate")
#Example 2: Multivariate example
#--------------------------------------------
set.seed(18427)
X1 <- rnorm(1000,3,.7)
X2 <- rnorm(1000,3,.7)
X <- data.frame(X1,X2)
thetahat <- c(0.12, 0.03)
thetalow <- c(0.05, 0.01)
thetaup <- c(0.25, 0.06)
rr <- function(X, theta){exp(theta[1]*X[,1] + theta[2]*X[,2])}
paf.confidence.one2one(X, thetahat, rr, thetalow, thetaup)
#Approximate method:
Xmean <- data.frame(t(colMeans(X)))
Xvar <- var(X)
paf.confidence.one2one(Xmean, thetahat,
function(X, theta){exp(theta[1]*X[,1] + theta[2]*X[,2])},
thetalow, thetaup,
Xvar = Xvar, method = "approximate")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.