pif.plot: Plot of Potential Impact Fraction under different values of... In pifpaf: Potential Impact Fraction and Population Attributable Fraction for Cross-Sectional Data

Description

Function that plots the pif under different values of a univariate parameter theta of the relative risk function rr which depends on the exposure X and a parameter theta (rr(X, theta))

Usage

 1 2 3 4 5 6 7 8 9 10 pif.plot(X, thetalow, thetaup, rr, cft = NA, method = "empirical", confidence_method = "bootstrap", confidence = 95, nsim = 100, weights = rep(1/nrow(as.matrix(X)), nrow(as.matrix(X))), mpoints = 100, adjust = 1, n = 512, Xvar = var(X), deriv.method.args = list(), deriv.method = "Richardson", ktype = "gaussian", bw = "SJ", colors = c("deepskyblue", "gray25"), xlab = "Theta", ylab = "PIF", title = "Potential Impact Fraction (PIF) under different values of theta", check_exposure = TRUE, check_rr = TRUE, check_integrals = TRUE, check_cft = TRUE, check_thetas = TRUE, check_xvar = TRUE, is_paf = FALSE)

Arguments

 X Random sample (data.frame) which includes exposure and covariates or sample mean if "approximate" method is selected. thetalow Minimum of theta (parameter of relative risk rr) for plot. thetaup Maximum of theta (parameter of relative risk rr) for plot. 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 the 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. confidence_method Either bootstrap (default), linear, loglinear. See paf details for additional information. confidence Confidence level % (default 95). nsim Number of simulations to generate confidence intervals. weights Normalized survey weights for the sample X. mpoints Number of points in plot. 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). Xvar Variance of exposure levels (for "approximate" method). deriv.method.args method.args for hessian (for "approximate" method). deriv.method method for hessian. Don't change this unless you know what you are doing (for "approximate" method). 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". colors vector Colours of plot. xlab string Label of x-axis in plot. ylab string Label of y-axis in plot. title string Title of plot. 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. check_cft boolean Check that counterfactual function cft reduces exposure. check_thetas boolean Check that theta associated parameters are correctly inputed for the model. check_xvar boolean Check Xvar is covariance matrix. 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.

Value

pif.plot ggplot object with plot of Potential Impact Fraction as function of theta.

Author(s)

Rodrigo Zepeda-Tello rzepeda17@gmail.com