Probability of probability with certainty? Let $x$ be a uniformly distributed variable across the interval [0, 0.1], inclusive, where x represents the probability of a particular event occurring during a trial. If $528174$ trials occur, and in each of these trials the event does not occur, what is the smallest real $y$ so that that $x < y$ with at least $95%$ certainty?
 A: This looks like a Bayesian question where the prior distribution is $X \sim U[0,0.1]$ with density $10$ on that interval, and $0.95$ is a posterior probability,
while $\mathbb P(528174 \text{ failed attempts }\mid X=x)=(1-x)^{528174}$
and we are looking for $y$ to satisfy $\dfrac{\int\limits_{x=0}^y 10 (1-x)^{528174}\, dx}{\int\limits_{x=0}^{0.1} 10 (1-x)^{528174}\, dx} = 0.95$
which will lead to $1-\left( 1-y\right)^{528175}=0.95-0.95\times 0.9^{528175}$
and $y =1- \sqrt[528175]{0.05+0.95\times 0.9^{528175}}$.
You would have got almost exactly the same result if starting with $X\sim U[0,1]$ to get $y = 1- \sqrt[528175]{0.05} \approx -\frac{\log_e(0.05)}{528175}$ and these values are all just under $5.672 \times 10^{-6}$.  Compare this with the rule of three which would have suggested $\frac{3}{528174} \approx 5.680 \times 10^{-6}$
A: I'm going to define random variables a bit differently for the sake of convenience.
Let $n=528174$ and $X\sim \text{Binomial}(n,P)$ where $P \sim \mathcal{U}[0,0.1]$.
The question you're asking is to identity the smallest $y\in [0,0.1]$ such that $$\mathbb{P}(P<y|X=0)\geq 0.95$$ From Baye's Theorem $$\mathbb{P}(P<y|X=0)=\frac{\mathbb{P}(X=0|P<y)\mathbb{P}(P<y)}{\int_{0}^{0.1}\mathbb{P}(X=0|P=p)f_P(p)dp}$$ It's easy to see how $$\mathbb{P}(P<y)=\int_0^yf_P(p)dp=10y$$ whereas $$\int_0^{0.1}\mathbb{P}(X=0|P=p)f_P(p)dp=\int_0^{0.1}10(1-p)^ndp=\frac{10}{n+1}\Big[1-(0.9)^{n+1}\Big]$$ On the other hand, $$\mathbb{P}(X=0|P<y)=\int_0^y\mathbb{P}(X=0|E_y,P=p)f_{P|E_y}(p)dp$$ Here, $E_y=[0,y)$, $f_{P|E_y}(p)=1/y$ for $p\in E_y$, and $f_{P|E_y}(p)=0$ elsewhere. We get the following expression for $\mathbb{P}(X=0|P<y)$: $$\mathbb{P}(X=0|P<y)=\int_0^y\frac{1}{y}(1-p)^ndp=\frac{1-(1-y)^{n+1}}{y(n+1)}$$ Putting everything together, $$\mathbb{P}(P<y|X=0)=\frac{1-(1-y)^{n+1}}{1-(0.9)^{n+1}}$$ Finally, $$\mathbb{P}(P<y|X=0) \geq 0.95 \iff y\geq 1-\Big[0.05+0.95\cdot \big(0.9\big)^{n+1}\Big]^{\frac{1}{n+1}}$$ The smallest such value of $y$ is approximately $5.67 \times 10^{-6}$
