Let g be the link function, y be the target variable, and $\beta_1x_1$+... $\beta_nx_n$ for some $n \in \mathbb{N}$ be the linear predictor. One of the assumptions for a GLM states that there exists a linear relationship between $g(E(y))$ and $\beta_1x_1$+... $\beta_nx_n$.

I was wondering what are some ways of testing for this.

Would simply plotting the linear predictor vs. the transformed target variable work? For say an assumed Gamma distribution, would a plot of the deviance residuals vs. the linear predictor also work?


1 Answer 1


One possibility is to fit an expanded model that allows curvature, like a model with transformations of the $x$ variable(s) and/or with polynomial terms (including interactions) between the $x$ variables. You can assess the difference in fit using likelihood-based methods, and you can see whether the transformation is needed by graphing the (back-transformed) estimates of $E(y)$ as a function of particular predictors, holding all others fixed. For example, if you include a quadratic term in $x_1$ and want to see if it is needed, you can graph $g^{-1}(\hat\beta_0 + \hat\beta_1 x_1 + \hat\beta_2 x_1^2 + \dots)$ as a function of $x_1$, holding all other $x$ variables fixed at their mean values, or at other reasonable values such as the mode in case of nominal $x$. On the same graph, overlay the function obtained by the linear fit, $g^{-1}(\hat\beta_0 + \hat\beta_1 x_1 + \dots)$, without the quadratic, with the other $x$ variables fixed at the same values as in the first graph. Then use your subject matter knowledge to decide whether the additional complexity is worth it based on difference between the predictions shown by the two curves (even the back-transformed linear fit will be curved because of the nonlinear link function).

It may be the case that the curvature is "significant" in either the p-value or likelihood-based fit statistic sense, but that the additional complexity simply is not worth the trouble because the predictions are so similar. This can easily happen in "big data" applications. Or, it may be the case that the predictions are so different that the curved link is obviously needed.

The same trick can be used with the other $x$ variables. If the curvature involves two or more $x$ variables simultaneously, as in the case of interaction, a similar trick using 3-D surface plots can be used.

Quadratics are not necessary here; the above "method" is simply a diagnostic for curvature in the predicted link function. You could play the same game with any function that allows curvature, by using transformations in the $x$ variables, by using a neural network, by using a Fourier series-based function, etc. If curvature is deemed to be important using this diagnostic tool, then you still have to figure how to model it. For example, if you detect important curvature using a quadratic term, that does not necessarily mean you want to use a quadratic model for the curvature.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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