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
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
p-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Juanjuan Chai
> Sent: Tuesday, April 26, 2011 4:19 PM
> To: r-help@r-project.org
> Subject: [R] density plot of simulated exponential distributed data
>
> Hi all,
>
> I tried to plot the den
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
Hi all,
I tried to plot the density curve using the data from simulation. I am
sure that the data should be exponentially distributed, but the plot
of density curve always starts from (0,0) which is not the case for
exponential distribution. Is there any way around this, to keep the
curve
5 matches
Mail list logo