# Solving for the parameter of an exponential distribution

Suppose I have a random variable $$X$$ where $$X$$ follows an exponential distribution of the following form:

$$f_X(x) = \frac{1}{\lambda}e^{-\frac{x}{\lambda}}$$.

I want to find the value of $$\lambda$$ such that $$Pr(X<10^{-8}) \geq 0.95$$ and $$Pr(X>6\times10^{-6}) \geq 0.001$$.

So I have the following two inequalities to solve:

\begin{align} 1-\exp\left(-\frac{10^{-8}}{\lambda}\right)&\geq 0.95\\ \exp\left(-\frac{6\times10^{-6}}{\lambda}\right)&\geq 0.001 \end{align}

Solving the inequalities I have the following: \begin{align} \lambda & \geq \frac{-10^{-8}}{\ln(0.05)}\approx 3.338082e-09\\ \lambda & \leq \frac{-6\times 10^{-6}}{\ln(0.001)}\approx 8.68589e-07 \end{align}

So I would need to choose a value of $$\lambda$$ such that $$3.338082e-09\leq\lambda\leq8.68589e-07$$, correct?

However, when I try to verify this solution via simulation, I don't seem to get the right conclusion, i.e., assume I let $$\lambda = 8.68589e-08$$ then I have the following solution using R

>
> lambda >= (-10^-8) / log(.05)
 TRUE
> lambda <= -(6*10^-6) / log(0.001)
 TRUE


So I am between those two values (so far so good). Now, I'll simulate a large number of random samples from the exponential with the value of $$\lambda=8.68589e-08$$ to check that I get the right probabilities:

> x <- rexp(10000000, 1/lambda)
>
> sum(x < 10^-8)/length(x)
 0.1085921
> sum(x > 6*10^(-6))/length(x)
 0


And so from my simulation, I have that $$Pr(X<10^{-8}) = 0.1085921$$ and $$Pr(X>6\times10^{-6}) = 0$$

which is not what I want. Is my math/logic incorrect somewhere?

Also, here is a histogram of the random samples overlaid with the true exponential density in red. The two blue dashed line correspond to $$6\times10^{-6}$$ and $$10^{-8}$$ $$\begin{array}{}\exp\left(-\frac{a}{\lambda}\right)&\geq& b &\\ -\frac{a}{\lambda}&\geq& \log(b) && \text{logarithm}\\ -{a}&\geq& \log(b)\lambda && \text{multiply with \lambda}\\ -\frac{a}{\log (b)}&\leq& \lambda && \text{multiply with \frac{1}{\log(b)}}\\ &&&& \text{ NOTE! inquality changes} \\&&&& \text{ because this is a negative number }\\ \lambda &\geq& -\frac{a}{\log (b)} && \text{reverse left with right}\\ \end{array}$$
You get a different inequality. Probably your derivation went wrong when you made a multiplication or division with $$\log(b)$$ which is a negative number.
• Does this mean that both bounds flip, i.e., $3.338082e-09\geq\lambda$ and $\lambda \geq 8.68589e-07$? In that case no value of $\lambda$ exists for what I need? Apr 30, 2022 at 20:54
• You can also reason this intuitively. Your $\lambda$ is the mean of the distribution. A higher mean results in more probability in the upper part above 6x10e-6. A lower mean results in more probability in the lower part below 10e-8. Apr 30, 2022 at 20:57