shadeDens {dafs} | R Documentation |
Add a shaded region to a pdf plot
Description
Useful for shading regions of interest (critical regions perhaps) on a theoretical pdf to illustrate concepts such as P-values.
Usage
shadeDens(x0, x1, dens, col = "lightgrey", n.points = 200,
lty = 1,...)
Arguments
x0 |
A starting x-value for the region to be shaded |
x1 |
An ending x-value for the region to be shaded |
dens |
A function that calculates the pdf |
col |
A color for the shaded region |
n.points |
The number of points to calculate the pdf at over the interval [x0,x1] |
lty |
Line type |
... |
Additional arguments to be fed to |
Details
Adds a filled polygon to an existing pdf plot.
Author(s)
J Curran
Examples
x = seq(-4.5,4.5,by = 0.01)
plot(x, dnorm(x), type = 'l')
x0 = qnorm(0.975)
x1 = 4.5
shadeDens(x0, x1, dnorm)
[Package dafs version 1.0-38 Index]