Closed Nicholaswogan closed 2 years ago
The constraints look non-trivial to me.
I am also not sure what distribution you want over the parameters. If you want it uniform in parameter_1
and parameter_2
within their lower and upper bounds, their sum will not be uniform between 0 and constant
.
Maybe you can explain a bit where these constraints come from. Are they really hard constraints, or knowledge from previous experiments?
I would move either the first two or the last constraint into the likelihood function, whichever option is more relaxed (i.e., causes fewer rejections). This is achieved by returning a very low likelihood (e.g., -1e100
), when the constraint is not met.
It is beneficial for the sampler if you can add a slight slope towards the good region of the constraint. e.g., -1e100 * (1 + parameter_1 + parameter_2)
or similar. This is because if you use the exact same constant, this is a likelihood plateau, and the live points have to be reduced until it is traversed.
It can be beneficial to assume something with slightly softer boundaries than a hard limit. For example, if a normal distribution is assumed, the data could, if informative enough, update to something different.
Ya sorry, I should explain more. I aim to infer posteriors for 3 parameters describing the structure of an atmosphere:
P_surface
= The atmospheric pressure at the surface of a planetP_cloud_top
= The atmospheric pressure at the top of the cloudsP_cloud_thickness
= P_cloud_bottom
- P_cloud_top
. The thickness of the clouds measured in pressure.I want to specify log-uniform prior distributions for all parameters. But also, I want the prior to satisfy the fact that the cloud must be located at a pressure lower than the surface pressure (it must be in the sky!)
P_cloud_top
+ P_cloud_thickness
< P_surface
Maybe it makes sense to infer the following 3 parameters
P_surface
P_cloud_top
P_cloud_bottom
With the priors
P_lower_bound < P_surface < P_upper_bound
P_lower_bound < P_cloud_top < P_surface
P_cloud_top < P_cloud_bottom < P_surface
The transformation from the uniform cube to the prior distribution is then possible by doing the transformation, one step at a time.
Just so you know. I have very little prior knowledge of the value of these parameters. They could be anything between some pretty massive bounds. This is why I aim to use a wide uniform prior.
OK, then I would recommend three independent log-uniform priors, and implement the last constraint in the likelihood as I mentioned above.
The transformation from the uniform cube to the prior distribution is then possible by doing the transformation, one step at a time.
Ah, yes, with a shifted bound based on the previous priors, that also works.
That is what the dependent prior section "A similar effect can be achieved by defining transforms in sequence:" tries to demonstrate.
Ok great thanks!
One related question. I also have parameters which are gas concentrations. These concentrations need to have uniform priors in log space, and also sum to <= 1 (in non-log space). I see your section in the docs about Fractional priors: https://johannesbuchner.github.io/UltraNest/priors.html#Fraction-parameters . Would it be straightforward to use a Dirichlet distribution in this case?
Yes
For alpha = 1, the dirichlet distribution samples the simplex uniformly. But I don't want to sample the simplex uniformly. I want to sample the simplex in such a way so that each parameter is log-uniformly distributed between, for example, (1e-10, 1).
Do you know a way to do this?
Yeah, have a look at https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation Assume you already have n "random" uniform numbers (the prior proposal in the cube variable), and follow the formula.
I have updated the docs which hopefully clarifies the dependent prior section. Let me know if you have further suggestions to the docs.
Description
I am trying to specify a prior transformation from the uniform cube to the prior distribution for the following prior:
What I Did
I saw your example for dependent priors: https://johannesbuchner.github.io/UltraNest/priors.html#Dependent-priors . But this example doesn't make it clear to me how to do the transformation. Part of this is my fault. I'm an atmospheric chemist, and only dabble in statistics.
So a question: How do I specify the transformation corresponding to the prior given above?
and a recommendation: The example for dependent priors is hard to follow. I recommend explaining the example more thoroughly, and also giving a simpler example for dependent priors (e.g. my prior above is simpler than your example).