How to define the line to fit in Q-Q plot? I'm trying to figure out if my data follows a normal distribution and if it contains outliers. I have plotted the histogram and now I would like to plot the quantile-quantile (Q-Q) plot. My point is, I'm using a qq plot from statsmodel library in Python (statsmodels.graphics.gofplots.qqplot) and there are four options in this function to plot the line to make it easy to compare the distributions. I can't completely understand these four options, and of course, I don't want to make false conclusions. Could someone help me to understand these parameters better? For example, I would go by the 's', but I also think the
'q' would be a good choice, and I'm confused between 'q' and 'r'.
Options for the reference line to which the data is compared:
“45” - 45-degree line
“s” - standardized line, the expected order statistics are scaled by the standard deviation of the given sample and have the mean added to them
“r” - A regression line is fit
“q” - A line is fit through the quartiles.
None - by default no reference line is added to the plot.
Here are the images with the combinations of the parameters fit + line


For goodness-of-fit tests and plots, there are two main hypothesis

*

*sample comes from a specific distribution with given, fixed parameters, e.g. standard normal with loc=0 and scale=1, N(0, 1)

*sample comes from a specific distribution family, i.e. the distribution family is specified but parameters are not pre-specified, e.g. sample comes from normal distribution with some arbitrary loc and scale, N(mean, var)

standard normal
"fit=False" and "line=45" is for the "Null hypothesis" that the sample comes from a standard normal distribution N(0, 1). The plot in the example shows that  it is very unlikely that the sample comes from a standard normal distribution. This can be also used for other distributions when all parameters are prespecified.
Normal distribution family
If either "fit=True" or line is not "45", then the plot is adjusted for some estimate of loc and scale. The option differ either in the way loc and scale are estimated or how the plot data and axes are scaled.
"fit=True" estimates the distribution parameters by maximum likelihood and uses distribution with estimated parameters as reference or zscores the data before plotting.
Note, normal distribution only has loc and scale as parameters, while other distributions like t also have a shape parameter that needs to be either predefined by the user or estimated with MLE
"fit=False" uses the standard distribution as reference, but adjusts the plot axes to account for loc and scale. In this case the reference line is drawn to match the location and slope of the sample points.
If line="r", then the line is computed by linear regression of the plot points which can easily be affected by outliers.
If line="q", then the line is based on quartiles which is robust to outliers (as long as the fraction of outliers is not too large).
As far as I remember, line="s" only applies to the case of normal distribution where sample mean is an estimate for loc and sample standard deviation is an estimate for scale. (AFAIR, it is even more affected by outliers than line="r".)
In the normal distribution case several options lead to essentially the same results (in large samples), e.g. using mean and variance instead of MLE.
However, in cases where the distribution has shape parameters, the options imply different assumption about the estimation of the distribution parameters. Example comparing sample from t-distributions with different degrees of freedom.
