[R] generating samples by Monte Carlo
glnbrntt at gmail.com
Tue Mar 30 07:51:51 CEST 2010
> 5000 samples, Exponential distribution (f(x), lambda=0.0005, 0<=x<=360)
If you don't need the truncation at 360 you can just use rgamma to generate
(It's not 100% clear but I assume your lambda is an inverse of a scale
Why are you cutting the x's off at 360?
If you do need to cut it off at 360 (which is very small relative to the
scale of 2000) you
are probably better off generating it by another method. Even a simple
like generating points from a (U(0,360), U(0,f(0)) ) and rejecting those
x-cases with a y-coordinate
greater than the pdf.
However, if you have a more general need for truncated exponential, you
could do a site search
RSiteSearch() on "truncated gamma" and on "truncated exponential".
View this message in context: http://n4.nabble.com/generating-samples-by-Monte-Carlo-tp1695611p1744744.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help