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]]
Take a look at pvladens() function in "bootruin" package. Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu ----- Original Message ----- From: Jim Silverton <jim.silverton at gmail.com> Date: Saturday, March 19, 2011 10:16 pm Subject: Re: [R] Part of a density plot To: r-help at r-project.org> 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 at r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code.
On 2011-03-19 19:15, Jim Silverton 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?I'm not quite sure what you want, but this may be it: plot(density(y), xlim = c(0, 1), xaxs = 'i') Peter Ehlers
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]]