Ed is a nonparametric density estimation method that turns density estimation into a regression problem, providing much-needed diagnostics for evaluating goodness-of-fit and visualization for identifying interesting features without being influenced by artifacts introduced by the estimation method. It also helps deal with some common problems encoutered using traditional KDE approaches, such as fixed bandwidths, boundaries / discontinuities, bias, and choosing optimal smoothing parameters. A preprint of a paper describing the method is available here.

Ed raw estimates of the 28 "benchden" benchmark densities with the true density superposed:

```
devtools::install_github("hafen/ed")
```

To recreate the plot above:

```
ed_plot(~ x | density, data = benchdat,
scales = list(relation = "free", draw = FALSE),
panel = function(x, y, ..., subscripts) {
panel.ed(x, ...)
tmp <- ed_raw(x)
ss <- seq(min(tmp$x), max(tmp$x), length = 200)
panel.lines(ss, log(benchden::dberdev(ss,
dnum = benchdat$dennum[subscripts][1])), col = "black", lwd = 2)
},
cex = 0.3,
between = list(x = 0.25, y = 0.25),
aspect = 1,
layout = c(7, 4),
as.table = TRUE
)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.