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)
[1] TRUE
> lambda <= -(6*10^-6) / log(0.001)
[1] 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)
[1] 0.1085921
> sum(x > 6*10^(-6))/length(x)
[1] 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}$