# Data exploration to determine if GAMs are appropriate [duplicate]

How to decide, based on data exploration and data visualisation, between a GAM and a GLM.

Linear Models (LM) assume that the relationship between the response and the predictor are linear. Generalized Linear Models (GLM) assume linearity on the link scale, which means we can work with non-linear relationship between the response and the predictor, but this relationship still needs to be monotonic (i.e. either going upwards on downwards). Generalized Additive Models (GAM) do not assume any particular relationship, which means this relationship can go up and down (i.e. it is curved or wiggly). I hope I correctly summarized it up to here.

The issue of difference between GLM and GAM, or when to use GAMs as opposed to GLMs has been covered elsewhere (e.g. here) - this is not what my question is about.

My primary question is what kind of data exploration or data visualisation tools would you typically use in order to determine if GAMs are an appropriate tool as opposed to GLM. What would be a good guidelines to follow for a typical practice on deciding that.

Sub-questions:

1) If the response is continuous, I suppose you could just do a scatterplot for the response and each of the predictors, which should likely give you a hint. Correct?

2a) But if the response is presence/absence (1/0), you would need a binomial model, whether GLM or GAM. How would you decide (based on data exploration and visualisation) on which one to use?

2b) If data are presence/absence, would it make sense to run simple GAMs for the response and each of the potential predictors in turn, plot them to see the relationships, and then either use GAMs if the relationships are curvy, or a GLM if they are not? Would this be considered a good practice to guide your analytical decisions?

## marked as duplicate by kjetil b halvorsen, mdewey, Michael Chernick, jbowman, mktJan 22 at 10:19

• It is said in answers to those questions that most of what can be done with gams can be done with glm's, using splines. Estimation of splines is done differently within those frameworks (smoothing splines versus regression splines), but it is not clear how important this is. So mainly the decision is pragmatic, for instance gam's as implemented in mgcv (in R) have a lot of options integrated, so in some cases it might be practical to use. But you don't need any specific exploratory tools for that decision! If the question is if it is necessary to use splines: TRY! plot results, see. – kjetil b halvorsen Jan 22 at 15:00