pif.sensitivity: Potential Impact Fraction Sensitivity Analysis plot In pifpaf: Potential Impact Fraction and Population Attributable Fraction for Cross-Sectional Data

Description

Function that plots a sensitivity analysis for the Potential Impact Fraction pif by checking how estimates vary when reducing the exposure's sample X.

Usage

 1 2 3 4 5 6 7 8 9 10 pif.sensitivity(X, thetahat, rr, cft = NA, method = "empirical", weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))), nsim = 50, mremove = min(nrow(as.matrix(X))/2, 100), adjust = 1, n = 512, ktype = "gaussian", bw = "SJ", ylab = "PIF", xlab = "Number of randomly deleted observations for X", legendtitle = "Sensitivity Analysis", title = "Potential Impact Fraction (PIF) Sensitivity Analysis", colors = c("red", "deepskyblue", "gray75", "gray25"), check_exposure = TRUE, check_rr = TRUE, check_integrals = TRUE, is_paf = FALSE)

Arguments

 X Random sample (data.frame) which includes exposure and covariates or sample mean if "approximate" method is selected. thetahat Asymptotically consistent or Fisher consistent estimator (vector) of theta for the Relative Risk function. rr function for Relative Risk which uses parameter theta. The order of the parameters should be rr(X, theta). **Optional** cft function cft(X) for counterfactual. Leave empty for the Population Attributable Fraction paf where counterfactual is that of a theoretical minimum risk exposure X0 such that rr(X0,theta) = 1. method Either "empirical" (default), "kernel" or "approximate". For details on estimation methods see pif. weights Normalized survey weights for the sample X. nsim Integer with number of samples to include (for each removal) in order to conduct sensitivity analysis. See details for additional information. mremove Limit number of measurements of X to remove when resampling. See details for additional information. adjust Adjust bandwith parameter (for "kernel" method) from density. n Number of equally spaced points at which the density (for "kernel" method) is to be estimated (see density). ktype kernel type: "gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine" (for "kernel" method). Additional information on kernels in density. bw Smoothing bandwith parameter (for "kernel" method) from density. Default "SJ". ylab string label for the Y-axis of the plot. xlab string label for the X-axis of the plot. legendtitle string title for the legend of plot. title string title of plot. colors string vector with colours for plots. check_exposure boolean Check that exposure X is positive and numeric. check_rr boolean Check that Relative Risk function rr equals 1 when evaluated at 0. check_integrals boolean Check that counterfactual cft and relative risk's rr expected values are well defined for this scenario. is_paf Boolean forcing evaluation of paf. This forces the pif function ignore the inputed counterfactual and set it to the theoretical minimum risk value of 1.

Details

pif.sensitivity conducts a sensitivity analysis of the pif estimate by removing mremove elements nsim times and re-estimating pif with the reduced sample.

Value

plotpif ggplot object plotting a sensitivity analysis of pif.

Author(s)

Rodrigo Zepeda-Tello rzepeda17@gmail.com