# Using Jeffreys prior for Bernoulli distribution to find the prior of a transformation on p

The question goes like this: Use Jeffreys prior for Bernoulli distribution and find the prior for $$\eta$$ where: $$\eta(p) = \left(\frac{p}{1-p}\right)$$

So $$\eta$$ here is some kind of a transformation on the Bernoulli parameter $$p$$, and I know that Jeffreys prior $$\pi(p)$$, for Bernoulli distribution, is:

$$\pi(p) = \sqrt{I(p)} = \sqrt{\frac{1}{p(1-p)}}$$

The solution for the question is:

$$f_n(\eta) = f_p(g^{-1}(\eta))\cdot (g^{-1}(\eta))'$$ $$= \sqrt{\frac{1}{p(1-p)}} \cdot p(1-p)$$ $$= \sqrt{p(1-p)}$$

I'm trying to understand the solution:

$$f_p(g^{-1}(\eta))$$ is just $$\pi(p)$$, right? cause I see its equal to $$\sqrt{\frac{1}{p(1-p)}}$$.

And I didn't get what is $$(g^{-1}(\eta))'$$.. here its equal to $$p(1-p)$$ so it can't be the derevative of $$\pi(p)$$, so what it is then?

And basically they didn't use the fact that $$\eta(p) = \left(\frac{p}{1-p}\right)$$, they just used the prior for Bernoulli, right?

• Please add the self-study tag & read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. Please make these changes as just posting your homework & hoping someone will do it for you is grounds for closing. Commented Mar 11, 2023 at 1:22
• Close-voters: OP is showing where they got stuck, so it's a well-posed self-study question. Voting to leave open, and upvoting. Commented Mar 12, 2023 at 9:49

You know the Jeffreys' prior density for $$p$$ is proportional to $$\sqrt{\frac{1}{p(1-p)}}$$ and that the corresponding odds are $$\eta=\frac{p}{1-p}$$.

This looks as if it is just a change of variables with $$g(p)=\frac{p}{1-p}$$ and so $$g^{-1}(\eta)=\frac{\eta}{1+\eta}$$ with derivative $$\frac{1}{(1+\eta)^2}$$ giving a density for $$\eta$$ proportional to $$\sqrt{\frac{1}{\frac{\eta}{1+\eta}\left(1-\frac{\eta}{1+\eta}\right)}}\frac{1}{(1+\eta)^2} =\frac{1}{(1+\eta)\sqrt{\eta}}$$. It is possible to do the integration, so I would have thought that the density of $$\eta$$ is $$f_\eta(\eta)=\frac{1}{\pi (1+\eta)\sqrt{\eta}}$$ for $$\eta>0$$.

I cannot see why you might want to substitute back to put this in terms of $$p$$; a proper change of variables would of course take you back to the Jeffreys' prior of $$\frac1\pi\sqrt{\frac{1}{p(1-p)}}$$ while a simple substitution would give the rather meaningless $$\frac1\pi\sqrt{\frac{(1-p)^3}{p}}$$, not what your quoted solution says.

Here is an R simulation demonstration of the density for $$\eta$$:

set.seed(2023)
p <- rbeta(10^6, 1/2, 1/2) # Jefferys' prior
eta <- p / (1-p)
plot(density(eta, from=0, to=50), log="y")
curve(1 / (pi * (1+x) * sqrt(x)), from=0, to=50, add=TRUE, col="red")