Suppose I generate a number of random number according to the exponential distribution and convert them into probability values in R.
prob <- data.frame(round(rexp(2000 ,0.5) , digits = 4))
colnames(prob) <- "V"
prob$V <- prob$V / max(prob$V)
hist(prob$V , prob= TRUE, breaks =30, main=" ", xlab= "Probability Vals", col="red")
lines(density(prob$V, adjust=2), lty="dotted", col="darkblue", lwd=2)
When I plot the distribution of the probability values, here how it looks;
I would like to obtain something like
I have found something called exponentially modified Gaussian distribution and select the parameters as $\mu= -3, \sigma =1, \lambda =0.25$ as shown at this wiki page. However, I am not getting the desired output. The R code is
prob <- data.frame(round(rexp(2000 ,0.25)+ dnorm(2000, mean = -3, sd = 1, log = FALSE) , digits = 4))
I was wondering if someone help me out.
I gather you want an exponential-like distribution with a constant tail for $x$ which is zero away from the interval $0<x<1$. Such a PDF can be written
$$ P(x) = A \ \text{max}\big[C,e^{-\lambda x}\big]\big[\theta(x)-\theta(x-1)\big]$$
where $C<1$ and $0< 1/\lambda < 1$. $C$ is your constant tail, and the turnover from exponential-like to constant happens at $x = -\lambda^{-1}\log C$ (a positive number between 0 and 1). The normalization constant $A$ is determined by
$$1 = \int_0^1 P(x) dx = A \Big[ \int_0^{-\lambda^{-1}\log C} e^{-\lambda x} dx + \int_{-\lambda^{-1}\log C}^{1} C dx\Big],$$ and this gives $$ A = -\frac{\lambda}{C(1+\log C)}$$ so
$$ P(x) = -\frac{\lambda}{C(1+\log C)} \ \text{max}\big[C,e^{-\lambda x}\big]\big[\theta(x)-\theta(x-1)\big].$$
If you want to draw random variables from this distribution, probably the best way is to sample from an exponential distribution and throw away values that don't work (A Monte Carlo method).