4
$\begingroup$

I am trying to make two-sample Q-Q plots in Python.

A Python function that is used for calculating quantiles has the option of fitting parameters for the calculation of quantiles. These parameters are mentioned to be location and scale. The description of the fitting procedure: "If fit is True then the parameters for dist are fit automatically using dist.fit. The quantiles are formed from the standardized data, after subtracting the fitted loc and dividing by the fitted scale."

My question is then: When should parameters for calculating quantiles be fitted when comparing two distributions? Here is an example of what one of my Q-Q plots looks like fitted vs not fitted:

Fitted.

Not fitted.

Thank you for your time!

Source for the Python function for calculating quantiles: https://www.statsmodels.org/dev/generated/statsmodels.graphics.gofplots.ProbPlot.html

$\endgroup$
5
  • 1
    $\begingroup$ If you cut out the Python content, what is your statistical question? Please rewrite the question focusing on the statistical issue. $\endgroup$
    – Nick Cox
    Commented Aug 12, 2022 at 11:08
  • $\begingroup$ I have now rephrased my question. Perhaps this is a question more suitable for Stack Overflow? $\endgroup$ Commented Aug 12, 2022 at 11:28
  • 1
    $\begingroup$ I don't use Python so am not the best person to advise on whether the original was suited to Stack Overflow. As a statistical question this is more focused, but I don't understand it yet. What distribution are you trying to fit? If you are comparing two variables, why is a distribution fitted in either case? I am probably asking something dopey. $\endgroup$
    – Nick Cox
    Commented Aug 12, 2022 at 11:50
  • $\begingroup$ Understandable! I think it's rather my question that is dopey, as I don't think I understand my own question very well. I will ask the same question on the developer site and put the answer here after for people who might be interested. Thank you Nick! $\endgroup$ Commented Aug 12, 2022 at 12:08
  • 1
    $\begingroup$ Quantile-quantile plots have two main flavours: quantiles of one variable against quantiles of another variable; quantiles of one variable against expected values if the distribution were some brand-name distribution. In principle, that is one flavour insofar as "another variable" could be "expected values if the distribution were some brand-name distribution". But the first implies no fitting and the second implies fitting. $\endgroup$
    – Nick Cox
    Commented Aug 12, 2022 at 12:13

1 Answer 1

6
$\begingroup$

Goodness-of-fit tests and plots have in general two possible kinds of hypotheses, one version specifies a distribution family, the other a specific distribution.

For example for one sample tests:

Kolmogorov-Smirnov test assumes that the distribution is fully specified, the hypothesis is that the data comes for, e.g. a N(0, 1) distribution. If parameters are estimated, then inference based on standard KS-test does not have the correct p-values.
The Lilliefors test is the Kolmogorov-Smirnov test with estimated mean and variance. The Null hypothesis is that the distribution family of the data is the normal distribution, the parameters are not specified by the Null hypothesis.

Similarly in two sample case:

With estimated parameters or standardized data, the plot and test are based on the hypothesis that the two samples come from the same (loc-scale) distribution family. If parameters are not estimated or data is not standardized, then the underlying hypothesis is that the two samples come from the same distribution, including having the same mean and variance.

As for the two plots in the question:

The first plot with estimated parameters shows that both distribution are likely from the same family.
The second plot, without fitting parameters, shows that the two samples likely do not have the same distribution, either mean, variance or both differ in the samples.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.