Description Usage Arguments Author(s) Examples
View source: R/pif_confidence_linear.R
Function that calculates approximate confidence intervals to the potential impact fraction.
1 2 3 4 5 |
X |
Random sample ( |
thetahat |
Estimator ( |
rr |
|
thetavar |
Estimator of variance of **Optional** |
cft |
Function |
weights |
Survey |
confidence |
Confidence level % (default |
nsim |
Number of simulations for estimation of variance |
check_thetas |
Check that theta parameters are correctly inputed |
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 |
is_paf |
Boolean forcing evaluation of |
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 | ## Not run:
#Example with risk given by HR (PAF)
set.seed(18427)
X <- as.data.frame(rnorm(100,3,.5))
thetahat <- 0.12
thetavar <- 0.1
pif.confidence.linear(X, thetahat, function(X, theta){exp(theta*X)},
thetavar, nsim = 100)
#Example with linear counterfactual
cft <- function(X){0.3*X}
pif.confidence.linear(X, thetahat, function(X, theta){exp(theta*X)},
thetavar, cft, nsim = 100)
#Example with theta and X multivariate
set.seed(18427)
X1 <- rnorm(100, 3,.5)
X2 <- rnorm(100,3,.5)
X <- as.data.frame(as.matrix(cbind(X1,X2)))
thetahat <- c(0.1, 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}
pif.confidence.linear(X, thetahat, rr, thetavar, cft)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.