shadeDens | R Documentation |
Useful for shading regions of interest (critical regions perhaps) on a theoretical pdf to illustrate concepts such as P-values.
shadeDens(x0, x1, dens, col = "lightgrey", n.points = 200, lty = 1,...)
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 |
Adds a filled polygon to an existing pdf plot.
J Curran
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.