Description Usage Arguments Author(s) Examples
View source: R/pif_confidence_loglinear.R
Confidence intervals for the Potencial Impact Fraction for relative risk inyective functions, the pif is inyective, and intervals can be calculated for log(pif), and then transformed to pif CI.
1 2 3 4  | 
X | 
 Random sample (can be vector or matrix) which includes exposure and covariates.  | 
thetahat | 
 Estimative of   | 
thetavar | 
 Estimator of variance of thetahat  | 
rr | 
 Function for Relative Risk which uses parameter 
 **Optional**  | 
cft | 
 Function   | 
weights | 
 Survey   | 
nsim | 
 Number of simulations for estimation of variance.  | 
confidence | 
 Confidence level % (default 95)  | 
check_thetas | 
 Check that theta parameters are correctly inputed  | 
check_exposure | 
 Check that exposure   | 
check_cft | 
 Check if counterfactual function   | 
is_paf | 
 Force evaluation of paf  | 
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  | #Example 1: Exponential Relative risk
#--------------------------------------------
set.seed(18427)
X        <- as.data.frame(rnorm(100,5,1))
thetahat <- 0.4
thetavar <- 0.1
cft      <- function(X){sqrt(X)}
pif.confidence.loglinear(X, thetahat, thetavar, rr = function(X, theta){exp(theta*X)}, cft)
#Same example with linear counterfactual
a    <- 0.5
cft  <- function(X){a*X}
pif.confidence.loglinear(X, thetahat, thetavar, function(X, theta){exp(theta*X)})
#' #Example 2: Multivariate Relative Risk
#--------------------------------------------
set.seed(18427)
X1        <- rnorm(100, 4,0.01)
X2        <- runif(100,0.4,2)
X         <- as.data.frame(cbind(X1,X2))
thetahat  <- c(0.12, 0.03)
thetavar  <- matrix(c(0.01, 0, 0, 0.04), byrow = TRUE, nrow = 2)
rr        <- function(X, theta){
           .X <- as.matrix(X, ncol = 2)
           exp(theta[1]*.X[,1] + theta[2]*.X[,2])
           }
pif.confidence.loglinear(X, thetahat, thetavar, rr) 
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.