| ASH1D | R Documentation | 
Univariate density estimation for given observations
ASH1D(x, data = NULL, n = 200, k = 5, r = NULL, rx = 1.1, safe = TRUE, ...)
x | 
 numeric vector.  | 
data | 
 numeric vector (optional).  | 
n | 
 number of bins.  | 
k | 
 smoothing in number of bins.  | 
rx | 
 range expansion.  | 
safe | 
 logical (defautl = TRUE, yes).  | 
... | 
 optional argument (  | 
ASH1D returns a numeric vector with estimated densities.
ASH2D
## Not run: 
n1 <- 30000
n2 <- 60000
g <- c(rep(1, n1), rep(2, n2))
x <- c(rnorm(n1, 0, 1), rnorm(n2, 0, 5))
o <- order(x)
x <- x[o]
g <- g[o]
dt <- ASH1D(x, k = 5)
d1 <- ASH1D(x, data = x[g == 1], k = 10)
d2 <- ASH1D(x, data = x[g == 2], k = 10)
clr <- c(
  dt        = grey(0.0, 0.6),
  d1        = rgb(1.0, 0.5, 0.0, 0.6),
  d2        = rgb(0.0, 0.5, 1.0, 0.6),
  `d1 + d2` = rgb(1.0, 0.0, 0.0, 0.6)
)
EmptyPlot(xlim = range(x), ylim = range(dt, d1, d2, d1 + d2))
par(lwd = 1.5)
lines(x, d1 + d2, col = clr[4])
lines(x, dt, col = clr["dt"])
lines(x, d1, col = clr["d1"])
lines(x, d2, col = clr["d2"])
legend("topright", legend = names(clr), fill = clr, bty = "n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.