Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I want to draw a QQ plot for Negative Binomial distribution to see if the Generalized linear model fit well or not. But since there is no normality assumption exist in my model, normal QQ plot will not be suitable in this case. What kind of plot should I do? And how can I do it in R?

I can not simply use qqplot(negative binomial, data). I am writing a function including this plot, and the data for observations and variables are the things I will put in after I write down the function, and they are not fixed values. So I do not have a fixed form for the negative binomial part. However, what I want to know is the fit of the model, so I need to create something else to check that.

share|improve this question
1  
As I understand it the theory of generalized linear models says that asymptotically (i.e. as the number of counts per sample gets large) the Pearson (scaled) residuals of a GLM should be normally distributed; however, this is often only very approximately true for a data set where the mean is fairly small. This is also different from testing the marginal distribution of the data, which won't be negative binomial even if the distribution conditional on predictors is NB ... – Ben Bolker Apr 24 '12 at 12:54
1  
see e.g. Ben and Yohai 2004 J Comp Graphical Stats jstor.org/stable/1391143 . I don't know if this has been implemented anywhere ... – Ben Bolker Apr 24 '12 at 14:10
1  
a little more poking around finds it in S-PLUS 6.0's "Robust Stats" package. Oh well, time for someone to re-implement it from the paper. In the meantime, the standard practice is to use the Q-Q plot on the (Pearson or deviance) residuals and hope for the best ... – Ben Bolker Apr 24 '12 at 14:30
1  
Just because it works for a linear model doesn't mean it has any application to the general linear model. What would you even do if your analysis found egregious departures from the negative binomial assumptions? – AdamO Apr 25 '12 at 15:25

migrated from stackoverflow.com Apr 25 '12 at 11:37

1 Answer

?qqplot . The function accepts two inputs, one of which is your reference distribution and the other of which is your test distribution. You may be confusing it with qqnorm which is a "quickie" version of qqplot that automatically uses a normal distribution for the reference dataset.

share|improve this answer
I think you mean qqplot, qqnorm ... – Ben Bolker Apr 24 '12 at 13:42
@BenBolker thanks -- every now and then I arise from the depths of Unix and have to watch my Caps key. – Carl Witthoft Apr 24 '12 at 14:42
I think this may be misleading, because you don't want to compare either the marginal distribution of your data or the residuals from your model fit to a negative binomial distribution ... the only circumstances where you would want to compare to a NB would be if you (1) have a single homogeneous data set [unlikely if you are fitting GLMs] or (2) all your predictors are categorical (so you can divide your data set and test the negative binomiality of each sub-category independently). – Ben Bolker Apr 24 '12 at 15:28
I can not simply use qqplot(negative binomial, data). I am writing a function including this plot, and the data for observations and variables are the things I will put in after I write down the function, and they are not fixed values. So I do not have a fixed form for the negative binomial part. However, what I want to know is the fit of the model, so I need to create something else to check that. – zca0 Apr 24 '12 at 17:10
Finally I used QQ plot for cdf of Negative binomial distribution against uniform distribution and got a reasonable analysis because QQ plot for pdf of Negative binomial distribution against anything does not make any sense to get conclusions for the model. – zca0 Jul 2 '12 at 11:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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