Learn R Programming

car (version 2.0-21)

densityPlot: Nonparametric Density Estimates

Description

densityPlot contructs and graphs nonparametric density estimates, possibly conditioned on a factor. It is a wrapper for the standard R

Usage

densityPlot(x, ...)

## S3 method for class 'default':
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, ...)
    
## S3 method for class 'formula':
densityPlot(formula, data = NULL, subset, na.action = NULL, xlab, ylab, ...)

Arguments

x
a numeric variable, the density of which is estimated.
g
an optional factor to divide the data.
formula
an R

Value

  • These functions return NULL invisibly and draw graphs.

code

plot

item

  • data
  • subset
  • na.action
  • bw
  • adjust
  • kernel
  • xlab
  • ylab
  • col
  • lty
  • lwd
  • grid
  • legend.location
  • legend.title
  • show.bw
  • rug
  • ...

References

W. N. Venables and B. D. Ripley (2002) Modern Applied Statistics with S. New York: Springer.

See Also

density, bw.SJ, link{plot.density}

Examples

Run this code
densityPlot(~ income, show.bw=TRUE, data=Prestige)
densityPlot(income ~ type, data=Prestige)

Run the code above in your browser using DataLab