WOLFRAM NOTEBOOK

WOLFRAM|DEMONSTRATIONS PROJECT

Comparing Some Residuals for Generalized Linear Models

sample size
100
exponential family
Poisson
Gaussian
gamma
inverse Gaussian
raw residual
Pearson residual
Anscombe residual
A number of different kinds of residuals are used in the analysis of generalized linear models. Generalized linear models can be characterized by a variance function that is the variance of a distribution as a function of its mean up to a multiplicative constant. A fit or raw residual is the difference between the observed and predicted values. Pearson residuals scale this difference by the square root of the variance function to adjust for the expected variation in the observations. Anscombe residuals provide a transformation toward normality for the assumed variance function.
For linear regression with normal or Gaussian observations, these three types of residuals are the same. For other exponential families of distributions, Anscombe residuals should be closer to the bell-shaped distribution familiar in linear regression, particularly for larger datasets.
The example in this Demonstration is a model with two predictor variables
x
and
y
. It shows the residuals plotted against predictor values and displayed in histograms. Change the exponential family to choose a different dataset and model. Adjust the sample size to fit models for smaller or larger datasets.
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.