Description Usage Arguments Value Author(s) See Also Examples
Function that plots the paf
under different values
of a univariate parameter theta
of the Relative Risk function rr
which depends on the exposure X
and a theta
parameter
(rr(X, theta)
)
1 2 3 4 5 6 7 8 | paf.plot(X, thetalow, thetaup, rr, 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 = "PAF",
title = "Population Attributable Fraction (PAF) under different values of theta",
check_exposure = TRUE, check_rr = TRUE, check_integrals = TRUE)
|
X |
Random sample ( |
thetalow |
Minimum of |
thetaup |
Maximum of |
rr |
**Optional** |
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 |
|
paf.plot ggplot
object with plot of
Population Attributable Fraction as function of theta
.
Rodrigo Zepeda-Tello rzepeda17@gmail.com
Dalia Camacho-GarcĂa-FormentĂ daliaf172@gmail.com
See paf
for Population Attributable Fraction estimation
with confidence intervals paf.confidence
.
See pif.plot
for same plot with Potential Impact Fraction
pif
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
#Example 1: Exponential Relative Risk empirical method
#-----------------------------------------------------
set.seed(18427)
X <- data.frame(Exposure = rbeta(25, 4.2, 10))
paf.plot(X, thetalow = 0, thetaup = 2, function(X, theta){exp(theta*X)})
#Same example with kernel method
paf.plot(X, 0, 2, function(X, theta){exp(theta*X)}, method = "kernel",
title = "Kernel method example")
#Same example for approximate method
Xmean <- data.frame(mean(X[,"Exposure"]))
Xvar <- var(X)
paf.plot(Xmean, 0, 2, function(X, theta){exp(theta*X)},
method = "approximate", Xvar = Xvar, title = "Approximate method example")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.