plot.scdensity {scdensity} | R Documentation |
Plot method for class scdensity
.
Description
Creates a plot of a shape-constrained kernel density estimate. The amount of information
in the plot is controlled by detail
.
Usage
## S3 method for class 'scdensity'
plot(x, detail = 4, main = c("Density Estimate",
"Q-Q Plot"), xlab = c(x$data.name, "Constrained KDE Quantiles"),
ylab = c("Density", "Sample Quantiles"), type = c("l", "l", "p"),
lty = c(1, 2, 0), pch = c(-1, -1, 1), col = c("black", gray(0.4),
"black"), lwd = c(2, 1, 0), zero.line = TRUE, ...)
Arguments
x |
An object of S3 class |
detail |
An integer from 1 to 4, indicating the level of information to include in the plot. 1: plot only the constrained estimate. 2: draw both the constrained and unconstrained estimates on the same plot. 3: add a rug showing the data points. 4: additionally plot a Q-Q plot of the observed data versus the constrained estimate in a second panel (for qualitative assessment of goodness-of-fit). |
main |
A string passed on to the |
xlab |
A string passed on to the |
ylab |
A string passed on to the |
type |
A vector of up to 3 strings specifying the |
lty |
A vector of up to length 3, specifying the |
pch |
A vector of up to 3 integers specifying the |
col |
A vector of up to 3 strings specifying the |
lwd |
A vector of up to length 3 specifying the |
zero.line |
A logical value indicating whether or not a horizontal line should be drawn through zero to aid visualization. |
... |
Extra parameters passed to the initial |
Examples
# Basic usage:
x <- rlnorm(30)
scKDE <- scdensity(x)
plot(scKDE)
# Show only the constrained estimate
plot(scKDE, detail=1)
# Show the constrained and unconstrained estimates. Change line color and width.
plot(scKDE, detail=2, col=c("red","blue"), lwd=c(3,2))
# Show the Q-Q plot, but change that plot's symbol and its size.
plot(scKDE, detail=4, pch=c(-1, -1, 3), cex=0.5)