Open drbenvincent opened 2 years ago
Interesting post about zero-sum constrain here https://discourse.mc-stan.org/t/test-soft-vs-hard-sum-to-zero-constrain-choosing-the-right-prior-for-soft-constrain/3884/27
Sounds like a good candidate for pymc-experimental
This should be a simple helper that looks like a PyMC distribution (but is not one) with new
and dist
methods
Following the discussion #5066 (with input from @aseyboldt), I propose a new
ConstrainedUniform
distribution. An ideal use case for this is as a distribution for cutpoints in an ordinal regression.The idea is that the distribution would be a vector of
N>2
uniformly distributed values where the first entry is constrained to take on a givenmin
value and the final entry is constrained to take on a givenmax
value. The first value is hard constrained to take on a particular value, and the final value is also constrained to take on a particular value - because of the use of the Dirichlet (which sums to 1). Use of thecumsum
was also found to be necessary to enforce ordering and avoid divergences in sampling.A
ConstrainedUniform(N)
would haveN-2
degrees of freedom.Minimum working example
The new distribution would be along these lines
If you had the following observations
Then you could have a pleasingly concise ordinal regression model
Note that this amounts to a very simple 'intercept only' model, where
mu
is this intercept. There are no predictor variables in this exampleImplementation issues
When converting that function
constrainedUniform
into a PyMC distribution, then at the very least, you'd have to consider:min=0
andmax=1
it seemscoords