densityPlot
contructs and graphs nonparametric density estimates, possibly conditioned on a factor.
It is a wrapper for the standard R density
function.
densityPlot(x, ...)
"densityPlot"(x, g, bw = "SJ", adjust=1, kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), xlab = deparse(substitute(x)), ylab = "Density", col = palette(), lty = seq_along(col), lwd = 2, grid=TRUE, legend.location = "topright", legend.title = deparse(substitute(g)), show.bw = FALSE, rug = TRUE, ...)
"densityPlot"(formula, data = NULL, subset, na.action = NULL, xlab, ylab, ...)
~ variable
to estimate the unconditional
density of variable
, or variable ~ factor
to estimate the density of variable
within each level of factor
.na.action
option,
initially set to na.omit
.1
, indicates no adjustment;
if plotting by groups, adjust
may be a vector of adjustment factors, one for each group.density
).x
."Density"
.palette
.TRUE
(the default), grid lines are drawn on the plot."upperright"
; see legend
.TRUE
, show the bandwidth(s) in the horizontal-axis label or (for multiple groups)
the legend; the default is FALSE
.TRUE
(the default), draw a rug plot (one-dimentional scatterplot) at the bottom of the density estimate.plot
.NULL
invisibly and draw graphs.
density
, bw.SJ
, link{plot.density}
densityPlot(~ income, show.bw=TRUE, data=Prestige)
densityPlot(income ~ type, data=Prestige)
Run the code above in your browser using DataLab