I have used the following Pearson $χ2$ test and the deviance test to assess the negative binomial regression using R as
#########################################
# Pearson's χ2 residuals:
dat.resid <- sum(resid(model, type = "pearson")^2)
dat.resid
model$df.resid
1 - pchisq(dat.resid, model$df.resid)
# Deviance (G2) residuals:
model$deviance
model$df.resid
1-pchisq(model$deviance, model$df.resid)
###########################################
Results:
Goodness-of-fit (GOF) results for the negative-binomial(NB) model
Test Value df p-value
Deviance 63.787 58 0.28
Pearson 50.795 58 0.74
However, my collaborator commented that the goodness-of-fit test based on deviance and Pearson residuals is not valid for the negative binomial regression. It made me confused. I appreciate your suggestions! Thanks!