Find and Visualize Residuals for Fitted Models
Fit a model of the form
and assume the responses (the
values in the data) follow an inverse Gaussian distribution:
data = {{1.36, 15.36}, {1.69, 16.12}, {4.91, 104.62}, {4.85, 110.06}, {4.41, 99.07}, {2.15, 23.83}, {2.98, 48.86}, {1.19, 16.29}, {4.08, 79.91}, {0.05, 0.89}, {3.69, 70.13}, {2.34, 32.07}, {2.32, 29.39}, {1.77, 26.41}, {0.47, 6.64}};glm = GeneralizedLinearModelFit[data, {x, x ^ 2}, x, ExponentialFamily -> "InverseGaussian", LinkFunction -> Identity]glmresids = glm[{"FitResiduals", "AnscombeResiduals", "PearsonResiduals", "StandardizedPearsonResiduals"}];
labels = {"fit", "Anscombe", "Pearson", "standardized Pearson"};
plots = MapThread[ListPlot[#1, Frame -> True, PlotLabel -> #2, Filling -> 0]&, {glmresids, labels}];View the plots in GraphicsGrid:
GraphicsGrid[Partition[plots, 2], ImageSize -> 400, PlotLabel -> "Types of Residuals"]