Re: [R] density plot of simulated exponential distributed data

2011-04-28 Thread Juanjuan Chai
I tried logspline function using a lower bound 0 for my data, it works like a charm. When the I changed the xlim only positive part, the vertical line was also gone. That's exactly what I expected. Thanks. -JJ Greg Snow wrote: You might want to use the logspline package instead of the density

Re: [R] density plot of simulated exponential distributed data

2011-04-27 Thread Breheny, Patrick
help-boun...@r-project.org] On Behalf Of Greg Snow Sent: Wednesday, April 27, 2011 1:55 PM To: Juanjuan Chai; r-help@r-project.org Subject: Re: [R] density plot of simulated exponential distributed data You might want to use the logspline package instead of the density function, it allow

Re: [R] density plot of simulated exponential distributed data

2011-04-27 Thread Greg Snow
You might want to use the logspline package instead of the density function, it allows you to specify bounds on a distribution. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@

Re: [R] density plot of simulated exponential distributed data

2011-04-26 Thread Dennis Murphy
Hi: Try this (and note the use of vectorization rather than a loop): rate <- 3 dta <- -log(1 - runif(1000))/rate hist(dta, nclass = 30, probability = TRUE) x <- c(0.001, seq(0, 3, by = 0.01)) lines(x, dexp(x, rate = 3)) This is the difference in timings between the vectorized and iterative metho