I would like to make my own probability density function in R to simulate some things from a paper.
It is somehow similar to exponential distribution but what i really want to do is to redefine the exponential distribution into a "modified" one...
Is there such a way to do this? Thanks.
I want to simulate this:
b(x) = {(µ/p)(e ^ (-(µx-q)/p) , x > q(xbar) and 0 otherwise }
xbar is an x with a line above it, mean, average
您是否知道从下面截断的指数分布仍然是指数分布?
I believe you can do what you want with ?sample
. Use your known distribution function b(x)
to generate a vector of probabilities, say bprob
, then
sample(x,size, replace=TRUE,prob=bprob)
There are some very interesting methods for generating samples from arbitrary distributions. See for example, Normal RandomNumbers:UsingMachine AnalysisTo Choosethe BestAlgorithm WH PAYNE WashlngtonState University (somewhere on the web), or Numerical Recipes in C The Art of Scientific Computing Second Edition William H. Press,Saul A. Teukolsky et al, chapter 7.3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.