Description Usage Arguments Value Author(s) See Also Examples
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)
)
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)
|
X |
Random sample ( |
thetalow |
Minimum of |
thetaup |
Maximum of |
rr |
**Optional** |
cft |
Function |
method |
Either |
confidence_method |
Either |
confidence |
Confidence level % (default |
nsim |
Number of simulations to generate confidence intervals. |
weights |
Normalized survey |
mpoints |
Number of points in plot. |
adjust |
Adjust bandwith parameter (for |
n |
Number of equally spaced points at which the density (for
|
Xvar |
Variance of exposure levels (for |
deriv.method.args |
|
deriv.method |
|
ktype |
|
bw |
Smoothing bandwith parameter (for
|
colors |
|
xlab |
|
ylab |
|
title |
|
check_exposure |
|
check_rr |
|
check_integrals |
|
check_cft |
|
check_thetas |
|
check_xvar |
|
is_paf |
Boolean forcing evaluation of |
pif.plot ggplot
object with plot of
Potential Impact Fraction as function of theta
.
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> daliaf172@gmail.com
See pif
for Potential Impact Fraction estimation with
confidence intervals pif.confidence
.
See paf.plot
for same plot with
Population Attributable Fraction paf
.
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 | #Example 1: Exponential Relative Risk empirical method
#-----------------------------------------------------
## Not run:
set.seed(18427)
X <- data.frame(Exposure = rbeta(25, 4.2, 10))
pif.plot(X, thetalow = 0, thetaup = 10, rr = function(X, theta){exp(theta*X)})
#Same example with kernel method
pif.plot(X, thetalow = 0, thetaup = 10, rr = function(X, theta){exp(theta*X)},
method = "kernel", title = "Kernel method example")
#Same example for approximate method. Notice that approximate method has
#more uncertainty
Xmean <- data.frame(mean(X[,"Exposure"]))
Xvar <- var(X)
pif.plot(Xmean, thetalow = 0, thetaup = 10, rr = function(X, theta){exp(theta*X)},
method = "approximate", Xvar = Xvar, title = "Approximate method example")
#Example with counterfactual
pif.plot(X, thetalow = -10, thetaup = -5, rr = function(X, theta){exp(theta*X)},
cft = function(X){sqrt(X)})
#Example for approximate method with square root counterfactual
#Notice how the approximate represents information loss and thus the interval
#loses precision.
pif.plot(Xmean, thetalow = -10, thetaup = -5, rr = function(X, theta){exp(theta*X)},
cft = function(X){sqrt(X)}, method = "approximate", Xvar = Xvar)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.