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:
- Given the PDF, construct its CDF
- Invert the CDF (numerically if necessary)
- Sample $N$ random uniform values in the range $[0, 1]$
- Obtain the PDF values evaluating these $N$ random uniform values in the inverted CDF
- 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?