How can I fit distribution for data which "almost fits"? I have a sample for events occurring at certain continuous distances (kilometers), let's suppose emergency calls to hospitals. I have 200k observations, coming from 500 hospitals for an entire month. So, when I plot a histogram for my  distances vector, it  looks to me like a Beta distribution with determined parameters, but actually it's not. Below we have these histograms with respectively 50 and 20k bins:
 
Yes, the second histograms shows some spikes and pits, and this is maybe my biggest problem to fit, because every goodness-of-fit test gives me extremely low p-values, (and I have already tried to use smaller samples with the same shape).
When I use Probability Plot my results seems to be "kinda good", but not perfect.

I've been reading about method of moments and kernel density estimation, in order to understand if I can use them to fit my data to a pdf (even if not from the theoretical ones), but first I would like to know some things:

*

*Is there anything I could or I should do about my data before estimation? Is window smoothing a valid alternative?

*Should I give up trying to fit it into beta? Is there a way to tell something like "this is beta, but with error margins"? What could I say in the paper to support my decision?

*If my answer isn't in any of the alternatives above, what should I be reading right now to advance?

I need to fit it to make some conclusions about fuel and maintenance of the cars.
 A: The answer by @Ben, which you've already accepted, is great.
I'll just add that a Beta distribution has bounded support (assumes an upper maximum), whereas you're dealing with distances, which don't naturally lend themselves to such an assumption. Moreover, the QQ plot indicates a potential uncertainty in the tail of the fitted distribution.
Therefore, I recommend to also try to fit to your datasets:

*

*a Gamma distribution (perhaps constrained with shape parameter $k = \alpha = 2$),

*a Weibull distribution (perhaps constrained with shape parameter $k = 2$, a case which is equivalent to a Rayleigh distribution).

https://en.wikipedia.org/wiki/Gamma_distribution
https://en.wikipedia.org/wiki/Weibull_distribution
https://en.wikipedia.org/wiki/Rayleigh_distribution (equivalent to Weibull with shape parameter $k = 2$)
A: The overwhelming majority of datasets do not perfectly fit any parameterised class of distributions used in probability theory.$^\dagger$  Those classes of distributions represent an infinitesimally small sliver of the set of all distributions and so it is rare that a dataset comes from one of these classes.  As a result, you often get situations like this one where a dataset is close to a known parameterised distribution, but does not quite fit it.  As a secondary matter, it is well known that if you do a classical hypothesis test, even a tiny deviation from the null hypothesis (of a perfect distribution fit) will manifest in the p-value going to zero as the sample size grows to infinity.  Consequently, when you test a large dataset against a parameterised class of distributions, you will almost always get a rejection of the null hypothesis if you have sufficient data.
Now, most likely your dataset follows an almost-beta distribution that is not equivalent to any standard parameterised class used in probability theory.  You can get a reasonable estimate of the true distribution using a KDE (e.g., with a beta kernel) or some other non-parametric estimator.  Alternatively, since your observations involve multiple variables, you might get a better fit to a parameterised class of distributions for the conditional distribution arising from regression analysis (looking at the distribution of one variable conditional on one or more others).  Answers to your specific questions are below.


Is there anything I could or I should do about my data before estimation?  Is window smoothing a valid alternative?

Don't change your data to try to get a desired conformity with a hypothesised class of distributions --- instead, change your inference to conform to the evidence in your data.

Should I give up trying to fit it into beta?  Is there a way to tell something like "this is beta, but with error margins"?  What could I say in the paper to support my decision?

What do you mean by "give up"?  You tested this hypothesis and it was rejected with strong evidence --- end of test.  If you don't "give up" the null hypothesis after testing and strongly rejecting it, what was the test for?
As to what you can say here, you can say that this distribution is close to a beta distribution, but with some deviation in the upper tails.  If you want to quantify this you could use a measure of distance between distributions (e.g., between your empirical distribution and the closest "fitted" beta distribution) (see e.g., Chung et al 1989).  If you do this then I think you will find that there is a fairly small distance between your distribution and the class of beta distributions.

If my anwer isn't in any of the alternatives above, what should I be reading right now to advance?

I recommend you read about non-parametric inference, and bear in mind the general rule that parametric models for continuous random variables are approximations to true datasets at best.

$^\dagger$ There is an exception to this when dealing with discrete data with finite support.  For data with finite support, the categorical distribution actually does cover every possible distribution.  However, for continuous variables, parameterised classes are much smaller relative to the space of all possible distributions.
