### Testing the tests

#### (Jul 1, 2018)

Examining residuals is a key aspect of testing a model's fit.  In two previous blogs I first introduced two competing definitions of a residual for a grouped count, while later I showed how deviance residuals were superior to the older-style Pearson residuals.  If a model is correct, then the deviance residuals by age should look like random N(0,1) variables.  In particular, they should be independent with no obvious pattern linking the residual at one age with the next, i.e. there should be no autocorrelation.

In this article we will look at three alternative test statistics for lag-1 autocorrelation, i.e. correlation with the neighbouring value.  Each test statistic is based on the Pearson correlation…

### Minding our P's, Q's and R's

#### (Mar 22, 2016)

I wrote earlier that deviance residuals were better than Pearson residuals when examining a model fit for Poisson counts.  It is worth expanding on why this is, since it also neatly illustrates why there are limits to models based on grouped counts.

When fitting a model for Poisson counts, an important step is to check the goodness of fit using the following statistic:

$\tilde{\chi}^2 = \sum_{i=1}^n r_i^2$

where $$r_i$$ represents the residual for the $$i^{\rm th}$$ Poisson count, usually a cell in a contingency table with $$n$$ such cells.  If the model is correct, the residuals $$\{r_i\}$$ are usually assumed to be values drawn from the N(0,1) distribution.  This in turn means that $$\{r_i^2\}$$ are values…