Uniform (rectangular) pdf with variable range

I have data of z values, distributed mostly uniformly. I want to fit it with the uniform distribution (I know that MLE will be just maximum and minimum values). How can I do that?

I tried RooFit::Uniform, but if I initialize my data with variable z with a given range, the very same range will be used when I plot this Uniform pdf. I know that I can select the range for plotting, but can I fit the range in question?

There are examples how to use variable limits for integrals, but I couldn’t find an example of the uniform distribution with variable limits.

I can copy my code if needed.

@jonas could you please take a look whenever you will have time? Thanks!

HI @ynikitenko! Variable range limits can be set in principle via RooRealVar::setRange, but I don’t think you can fit parameters if they are only used in for range limits.

It would be best if you can copy-paste your code such that we can discuss about the best solution for your problem. For example, I can imagine that is could be better to use a step function in your case.

Hi @jonas! Thanks for the reply.
I think that it is not possible to model a Uniform pdf with variable range in RooFit. I think I’ll make a feature request for that.
About the code - I already wrote my own pdf with other parameters. I don’t know what could be substituted for the uniform pdf. It should just exist, IMHO.

What step function do you mean? The Heaviside theta function?

I created a feature request (Allow RooUniform to set lower and upper bounds (support) · Issue #7880 · root-project/root · GitHub). Thanks for all your help and comments!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.