Hi:

Here's a lattice version:

y <- rbeta(10000, 2, 5)
densityplot( ~ y, xlim = c(0, 1), plot.points = FALSE,
            panel = function(x, y, ...) {
               p <- seq(0.001, 0.999, by = 0.001)
               panel.densityplot(x, col = 'blue', ...)
               panel.xyplot(p, dbeta(p, 2, 5), col = 'red', type = 'l', ...)
              },
            key = list(corner = c(1, 1),
                       text = list(c('Estimated', 'Beta(2, 5)')),
                       lines = list(col = c('blue', 'red')) )

Dennis

On Sat, Mar 19, 2011 at 7:15 PM, Jim Silverton <jim.silverton@gmail.com>wrote:

> Suupose I have
> y <- rbeta(10000, 2, 5)
> and I only want to see only the density plot from x = 0 to x = 1
> How do I do this?
>
> --
> Thanks,
> Jim.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

