# How to find the best fitting parametric distribution for an empirical dataset (stock returns)?

Given some real-valued empirical data (time series), I could convert it to a histogram to have an (non-parametric) empirical distribution of the data, but histograms are blocky and jagged.

Instead, I would like to identify the best-fitting parametric distribution from the scipy or scipy.stats libraries of distribution functions, so that I can artificially generate a parametric distribution that closely fits the empirical distribution of my real data and is continuous.

If the empirical data are monthly returns of empirical AAPL stock returns, for example, I know that the parametric Johnson-SU distribution resembles, and can mimic, stock return distributions because of its customizable skew. However, the Johnson SU distribution in scipy requires four input parameters to be calibrated. How can I search for the best parameter settings of this parametric distribution from scipy that fits to the empirical distribution of my sample of AAPL returns?

• Maximum likelihood estimation and method of moments estimation are common ways of doing that. – Richard Hardy Dec 20 '20 at 11:51
• they say maximum likelihood estimation, is superior to the method of moments. and i saw afterwards that scipy has MLE built-in which also makes it more convenient. Matching the Johnson parameters, on the other hand, to the target levels of skewness, kurtosis, etc might involve method of moments though, with some help from known closed-form solutions that were derived to show this particular distribution's moments being functions of its parameters. – develarist Dec 20 '20 at 13:19
• I am especially interested in how MLE and method of moments compare in the presence of small-sample size. Furthermore, I still am rebuffed by proponents of parametric fitting and those who support empirical fitting of data, especially when it comes to small-sample size. there doesn't seem to be much consensus – develarist Dec 20 '20 at 13:20
• The current answer below applies to finding the best distribution "family" (use the KS test), but as we both agree here, hope you could put MLE up as an official answer for me to mark, plus your insight on MLE applied to the small-sample setting versus empirical modeling – develarist Dec 20 '20 at 13:23
• What exactly do you mean by parametric fitting, empirical fitting and empirical modeling? Could you explain the differences between them? – Richard Hardy Dec 20 '20 at 14:04

a, b, loc, scale = scipy.stats.johnsonsu.fit(data)