> 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
the exponentials 

 rgamma(5000,shape=1,rate=0.0005)
(It's not 100% clear but I assume your lambda is an inverse of a scale
parameter)

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
rejection method
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.

______________________________________________
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.

Reply via email to