# Hypothesis test for arbitrary distribution

Given a sample of $$N$$ observed values I'd like to test the null hypothesis that they arose from an arbitrary PDF (for which I have the analytical form). There are tests in place that can handle some of the well known PDFs (i.e., normal and such) but I've found no way (or package) to extend this process to an arbitrary PDF.

Currently what I do is the following:

1. Given the PDF, construct its CDF
2. Invert the CDF (numerically if necessary)
3. Sample $$N$$ random uniform values in the range $$[0, 1]$$
4. Obtain the PDF values evaluating these $$N$$ random uniform values in the inverted CDF
5. Use the Anderson-Darling k-sample test to test the hypothesis that both samples (original and sampled) originated from the same distribution

This works, but I'd like a more direct approach. Is it possible? How would one do that?

• Do you have alternative distributions that it could have arisen from or is your interest strictly did they arise from distribution $\mathcal{f}$. Apr 8, 2020 at 14:35
• No, I'm just interested in the hypothesis that they arose from the $f$ distribution. Apr 8, 2020 at 14:39

• I usually prefer the AD over the KS test as per Beware the Kolmogorov-Smirnov test! but this sounds like a reasonable approach (also the AD implementation in scipy does not seem to be able to handle arbitrary CDFs) Apr 8, 2020 at 14:23