3
$\begingroup$

I have plotted the qqplot of the residuals that my model generates with the python module statsmodel

sm.qqplot(data, line ='r') and it looks like this enter image description here

The points are placed on a straight line but the sample quantiles do not correspond to the theoretical quantiles expected from a normal distribution.

What does it mean?

Furthermore, I also tried using the scipy function probplot probplot(data,dist='norm',plot=plt) and I got

enter image description here

I don't understand: are points on the y-axis the sorted values or the quantiles? the scipy documentation says

probplot generates a probability plot, which should not be confused with a Q-Q or a P-P plot. Statsmodels has more extensive functionality of this type, see statsmodels.api.ProbPlot.

$\endgroup$
3
  • $\begingroup$ I don't think the comment you cite makes sense. The plots you show are identical in essence. An historic name, still used but declining in popularity, is a normal probability plot. The plot is also called a normal scores plot, a probit plot, etc. But it is a quantile-quantile plot and often (in my reading increasingly) called a normal quantile plot. (For normal read also Gaussian if so inclined.) $\endgroup$
    – Nick Cox
    May 13 at 10:21
  • $\begingroup$ Personally I am happy if any plot with quantiles on one or both axes is called a quantile plot, although plots with cumulative probability on the vertical axis are more likely to be called (empirical) (cumulative) distribution (function) plots. $\endgroup$
    – Nick Cox
    May 13 at 10:24
  • $\begingroup$ See stats.stackexchange.com/questions/101274/… $\endgroup$
    – Tim
    May 13 at 11:42

1 Answer 1

4
$\begingroup$

It's the same plot. I am not an expert on your software, but the following is a confident series of guesses. The sorted residuals are one and the same as the quantiles in this context.

On the vertical axis are your residuals and on the horizontal axis are what you would get on average with a sample of the same size drawn from a normal distribution with the same mean (zero) and SD. If all points fell on the line, you would have a perfect normal distribution, but that is just an ideal. In fact experienced statistical people would expect faking of data in that case as readily as a genuine perfect fit.

In practice you have slightly fatter tails in the residuals than a normal distribution, which is not in itself cause for alarm. In essence, the model passes this particular health check. That doesn't mean that there might not be other diagnostics that would point to a better model.

It takes a bit of experience to know how much variability is acceptable and how much points to systematic departures that need to be addressed. One handle is a line-up test that goes back at least to Shewhart. Call up a random number routine to get several normal quantile plots, all drawn from a a normal with zero mean and the same SD. Then does the observed quantile plot stick out as very different from the fake plots. The idea is similar to a line-up in police procedure: show not just the suspect but other people too in a line-up and see whether a witness identifies the suspect. Another handle, and an even better one, is whether you can identify a change to the model that improves the quantile plot.

$\endgroup$
7
  • $\begingroup$ yes it's python, i added some informations. but why one use sample quantiles and the other sorted values? aren't they 2 different things? $\endgroup$
    – Alucard
    May 13 at 9:55
  • $\begingroup$ Not different here. It is common practice to use quantiles (unqualified) to refer to all the sorted values, That usage goes back at least to Wilk and Gnanadesikan in 1968 jstor.org/stable/2334448 $\endgroup$
    – Nick Cox
    May 13 at 10:06
  • $\begingroup$ thanks, i didn't know it. $\endgroup$
    – Alucard
    May 13 at 10:10
  • $\begingroup$ @hi, sorry for contacting you so late, but today i was rereading your answer and i tried to download the file you linked but my institution doesn't have the access. i realized i didn't understand well. i understood that ojn the x axis we have realizations sampled from a normal distribution and on the y axis the ordered residuals, but i don't get why the line is not at 45 degrees and the notation. are the ticks on the x axis the sigma? $\endgroup$
    – Alucard
    Jun 15 at 20:06
  • $\begingroup$ The reference is WILK, M. B. and GNANADESIKAN, R. 1968. Probability plotting methods for the analysis for the analysis of data. Biometrika 55: 1-17. DO 10.1093/biomet/55.1.1 The theoretical quantiles on the x axis are for a standard normal distribution with mean 0 and SD 1, so I think you're guessing right. Doesn't Python offer documentation? $\endgroup$
    – Nick Cox
    Jun 15 at 20:52

Your Answer

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

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