Description Usage Arguments Value Author(s) See Also Examples
Plot the log density of data using ed raw estimates
1 2 |
x |
either a formula (e.g. "~ data | condvar") or a numeric vector for which to calculate and plot ed raw estimates |
data |
if |
panel |
a function, called once for each panel, that uses the packet (subset of panel variables) corresponding to the panel to create a display. The default panel function is |
prepanel |
See |
groups |
See |
ylab |
See |
... |
further arguments. See corresponding entry in |
An object of class "trellis".
Ryan Hafen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # plot benchden data
ed_plot(~ x | density, data = benchdat,
scales = list(relation = "free", draw = FALSE),
as.table = TRUE
)
# generate some data
n <- 5000
x <- rnorm(3 * n, mean = rep(c(0, 2, 4), each = n), sd = rep(1:3, each = n))
dd <- data.frame(x = x, cond = rep(1:3, each = n))
# estimate/plot all the data
ed_plot(~ x, data = dd, xlab = "data", aspect = 1)
# estimate/plot by conditioning variable
ed_plot(~ x | cond, data = dd,
xlab = "data", aspect = 1,
as.table = TRUE, layout = c(3, 1))
# with lines
ed_plot(~ x | cond, data = dd, kk = 15,
panel = function(x, ...) {
panel.grid(h = -1, v = -1)
panel.ed(x, ...)
ss <- seq(-8, 15, length = 300)
panel.lines(ss, log(dnorm(ss, mean = mean(x), sd = sd(x))), col = "black")
},
type = c("p", "g"),
aspect = 1,
as.table = TRUE,
layout = c(3, 1)
)
# using "groups"
ed_plot(~ x, data = dd, groups = cond, alpha = 0.75)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.