When to use a GAM vs GLM












9












$begingroup$


I realize this may be a potentially broad question, but I was wondering whether there are generalizable assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)?



Someone recently told me that GAMs should only be used when I assume the data structure to be "additive", i.e. I expect additions of x to predict y.
Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed.



In the past I have been using a GAM for ecological data, e.g.:




  • continuous timeseries

  • when the data did not have a linear shape

  • I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using "surface plots" together with a statistical test


I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when it's use is indicated over other regression analyses.










share|cite|improve this question











$endgroup$












  • $begingroup$
    GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
    $endgroup$
    – user2974951
    Dec 5 '18 at 11:09






  • 1




    $begingroup$
    The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
    $endgroup$
    – Michael M
    Dec 5 '18 at 11:31






  • 3




    $begingroup$
    While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 11:37










  • $begingroup$
    GLM $subset$ GAM.
    $endgroup$
    – usεr11852
    Dec 6 '18 at 0:31
















9












$begingroup$


I realize this may be a potentially broad question, but I was wondering whether there are generalizable assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)?



Someone recently told me that GAMs should only be used when I assume the data structure to be "additive", i.e. I expect additions of x to predict y.
Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed.



In the past I have been using a GAM for ecological data, e.g.:




  • continuous timeseries

  • when the data did not have a linear shape

  • I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using "surface plots" together with a statistical test


I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when it's use is indicated over other regression analyses.










share|cite|improve this question











$endgroup$












  • $begingroup$
    GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
    $endgroup$
    – user2974951
    Dec 5 '18 at 11:09






  • 1




    $begingroup$
    The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
    $endgroup$
    – Michael M
    Dec 5 '18 at 11:31






  • 3




    $begingroup$
    While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 11:37










  • $begingroup$
    GLM $subset$ GAM.
    $endgroup$
    – usεr11852
    Dec 6 '18 at 0:31














9












9








9


1



$begingroup$


I realize this may be a potentially broad question, but I was wondering whether there are generalizable assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)?



Someone recently told me that GAMs should only be used when I assume the data structure to be "additive", i.e. I expect additions of x to predict y.
Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed.



In the past I have been using a GAM for ecological data, e.g.:




  • continuous timeseries

  • when the data did not have a linear shape

  • I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using "surface plots" together with a statistical test


I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when it's use is indicated over other regression analyses.










share|cite|improve this question











$endgroup$




I realize this may be a potentially broad question, but I was wondering whether there are generalizable assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)?



Someone recently told me that GAMs should only be used when I assume the data structure to be "additive", i.e. I expect additions of x to predict y.
Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed.



In the past I have been using a GAM for ecological data, e.g.:




  • continuous timeseries

  • when the data did not have a linear shape

  • I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using "surface plots" together with a statistical test


I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when it's use is indicated over other regression analyses.







regression generalized-linear-model gam






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 5 '18 at 11:46







lueromat

















asked Dec 5 '18 at 11:05









lueromatlueromat

487




487












  • $begingroup$
    GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
    $endgroup$
    – user2974951
    Dec 5 '18 at 11:09






  • 1




    $begingroup$
    The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
    $endgroup$
    – Michael M
    Dec 5 '18 at 11:31






  • 3




    $begingroup$
    While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 11:37










  • $begingroup$
    GLM $subset$ GAM.
    $endgroup$
    – usεr11852
    Dec 6 '18 at 0:31


















  • $begingroup$
    GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
    $endgroup$
    – user2974951
    Dec 5 '18 at 11:09






  • 1




    $begingroup$
    The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
    $endgroup$
    – Michael M
    Dec 5 '18 at 11:31






  • 3




    $begingroup$
    While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 11:37










  • $begingroup$
    GLM $subset$ GAM.
    $endgroup$
    – usεr11852
    Dec 6 '18 at 0:31
















$begingroup$
GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
$endgroup$
– user2974951
Dec 5 '18 at 11:09




$begingroup$
GAM's are used when the linear predictor depends linearly on unknown smooth functions of some predictor variables.
$endgroup$
– user2974951
Dec 5 '18 at 11:09




1




1




$begingroup$
The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
$endgroup$
– Michael M
Dec 5 '18 at 11:31




$begingroup$
The distinction is blurry as you can represent numeric covariables e.g. by a spline also in a GLM.
$endgroup$
– Michael M
Dec 5 '18 at 11:31




3




3




$begingroup$
While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
$endgroup$
– kjetil b halvorsen
Dec 5 '18 at 11:37




$begingroup$
While the distinction is blurry, gam's can represent interactions also the smae way as glm's so strict additivity is not needed, the big difference is in inference: gam's need special methods, since estimation is not done via projection, but via smoothing. What that does imply in practice, I don' t understand.
$endgroup$
– kjetil b halvorsen
Dec 5 '18 at 11:37












$begingroup$
GLM $subset$ GAM.
$endgroup$
– usεr11852
Dec 6 '18 at 0:31




$begingroup$
GLM $subset$ GAM.
$endgroup$
– usεr11852
Dec 6 '18 at 0:31










3 Answers
3






active

oldest

votes


















9












$begingroup$

The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable and the covariates, GAM do not assume a priori any specific form of this relationship, and can be used to reveal and estimate non-linear effects of the covariate on the dependent variable.
More in detail, while in (generalized) linear models the linear predictor is a weighted sum of the $n$ covariates, $sum_{i=1}^n beta_i x_i$, in GAMs this term is replaced by a sum of smooth function, e.g. $sum_{i=1}^n sum_{j=1}^q beta_i , s_j left( x_i right)$, where the $s_1(cdot),dots,s_q(cdot)$ are smooth basis functions (e.g. cubic splines) and $q$ is the basis dimension. By combining the basis functions GAMs can represent a large number of functional relationship (to do so they rely on the assumption that the true relationship is likely to be smooth, rather than wiggly). They are essentially an extension of GLMs, however they are designed in a way that makes them particularly useful for uncovering nonlinear effects of numerical covariates, and for doing so in an "automatic" fashion (from Hastie and Tibshirani original article, they have 'the advantage of being completely automatic, i.e. no "detective" work is needed on the part of the statistician').






share|cite|improve this answer











$endgroup$









  • 2




    $begingroup$
    Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 12:30










  • $begingroup$
    Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
    $endgroup$
    – matteo
    Dec 5 '18 at 13:14










  • $begingroup$
    thanks - this is helpful. and yes, I was talking about classic GLMs
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:41










  • $begingroup$
    @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:49












  • $begingroup$
    The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
    $endgroup$
    – matteo
    Dec 5 '18 at 21:10



















9












$begingroup$

I'd emphasize that GAMs are much more flexible than GLMs, and hence need more care in their use. With greater power comes greater responsibility.



You mention their use in ecology, which I have also noticed. I was in Costa Rica and saw some kind of study in a rainforest where some grad students had thrown some data into a GAM and accepted its crazy-complex smoothers because the software said so. It was pretty depressing, except for the humorous/admirable fact that they rigorously included a footnote that documented the fact that they'd used a GAM and the high-order smoothers that resulted.



You don't have to understand exactly how GAMs work to use them, but you really need to think about your data, the problem at hand, your software's automated selection of parameters like smoother orders, your choices (what smoothers you specify, interactions, if a smoother is justified, etc), and the plausibility of your results.



Do lots of plots and look at your smoothing curves. Do they go crazy in areas with little data? What happens when you specify a low-order smoother or remove smoothing entirely? Is a degree 7 smoother realistic for that variable, is it overfitting despite assurances that it's cross-validating its choices? Do you have enough data? Is it high-quality or noisy?



I like GAMS and think they're under-appreciated for data exploration. They're just super-flexible and if you allow yourself to science without rigor, they will take you farther into the statistical wilderness than simpler models like GLMs.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:59










  • $begingroup$
    Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
    $endgroup$
    – Wayne
    Dec 5 '18 at 19:39












  • $begingroup$
    @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
    $endgroup$
    – Tilen
    Jan 19 at 19:46



















3












$begingroup$

I have no reputation to simply add a comment. I do totally agree with Wayne’s comment: With greater power comes greater responsibility. GAMs can be very flexible and often we get/see crazy-complex smoothers. Then, I strongly recommend researchers to restrict degrees of freedom (number of knots) of the smooth functions and to test different model structures (interactions/no interactions etc.).



GAMs can be considered in between of model-driven approaches (although the border is fuzzy I would include GLM in that group) and data-driven approaches (e.g. Artificial Neural Networks or Random Forests who assume fully interacting non-linear variables’ effects). In accordance, I do not totally agree with Hastie and Tibshirani because GAMs still need some detective work (Hope no one kills me for saying so).



From an ecological perspective, I would recommend using the R package scam to avoid these unreliable variable crazy-complex smoothers. It was developed by Natalya Pya and Simon Wood and it allows constraining the smooth curves to desired shapes (e.g. unimodal or monotonic), even for two-way interactions. I think GLM becomes a minor alternative after constraining the shape of the smooth functions but this is only my personal opinion.



Pya, N., Wood, S.N., 2015. Shape constrained additive models. Stat. Comput. 25 (3), 543–559. 10.1007/s11222-013-9448-7






share|cite|improve this answer











$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "65"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f380426%2fwhen-to-use-a-gam-vs-glm%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    9












    $begingroup$

    The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable and the covariates, GAM do not assume a priori any specific form of this relationship, and can be used to reveal and estimate non-linear effects of the covariate on the dependent variable.
    More in detail, while in (generalized) linear models the linear predictor is a weighted sum of the $n$ covariates, $sum_{i=1}^n beta_i x_i$, in GAMs this term is replaced by a sum of smooth function, e.g. $sum_{i=1}^n sum_{j=1}^q beta_i , s_j left( x_i right)$, where the $s_1(cdot),dots,s_q(cdot)$ are smooth basis functions (e.g. cubic splines) and $q$ is the basis dimension. By combining the basis functions GAMs can represent a large number of functional relationship (to do so they rely on the assumption that the true relationship is likely to be smooth, rather than wiggly). They are essentially an extension of GLMs, however they are designed in a way that makes them particularly useful for uncovering nonlinear effects of numerical covariates, and for doing so in an "automatic" fashion (from Hastie and Tibshirani original article, they have 'the advantage of being completely automatic, i.e. no "detective" work is needed on the part of the statistician').






    share|cite|improve this answer











    $endgroup$









    • 2




      $begingroup$
      Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
      $endgroup$
      – kjetil b halvorsen
      Dec 5 '18 at 12:30










    • $begingroup$
      Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
      $endgroup$
      – matteo
      Dec 5 '18 at 13:14










    • $begingroup$
      thanks - this is helpful. and yes, I was talking about classic GLMs
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:41










    • $begingroup$
      @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:49












    • $begingroup$
      The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
      $endgroup$
      – matteo
      Dec 5 '18 at 21:10
















    9












    $begingroup$

    The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable and the covariates, GAM do not assume a priori any specific form of this relationship, and can be used to reveal and estimate non-linear effects of the covariate on the dependent variable.
    More in detail, while in (generalized) linear models the linear predictor is a weighted sum of the $n$ covariates, $sum_{i=1}^n beta_i x_i$, in GAMs this term is replaced by a sum of smooth function, e.g. $sum_{i=1}^n sum_{j=1}^q beta_i , s_j left( x_i right)$, where the $s_1(cdot),dots,s_q(cdot)$ are smooth basis functions (e.g. cubic splines) and $q$ is the basis dimension. By combining the basis functions GAMs can represent a large number of functional relationship (to do so they rely on the assumption that the true relationship is likely to be smooth, rather than wiggly). They are essentially an extension of GLMs, however they are designed in a way that makes them particularly useful for uncovering nonlinear effects of numerical covariates, and for doing so in an "automatic" fashion (from Hastie and Tibshirani original article, they have 'the advantage of being completely automatic, i.e. no "detective" work is needed on the part of the statistician').






    share|cite|improve this answer











    $endgroup$









    • 2




      $begingroup$
      Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
      $endgroup$
      – kjetil b halvorsen
      Dec 5 '18 at 12:30










    • $begingroup$
      Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
      $endgroup$
      – matteo
      Dec 5 '18 at 13:14










    • $begingroup$
      thanks - this is helpful. and yes, I was talking about classic GLMs
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:41










    • $begingroup$
      @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:49












    • $begingroup$
      The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
      $endgroup$
      – matteo
      Dec 5 '18 at 21:10














    9












    9








    9





    $begingroup$

    The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable and the covariates, GAM do not assume a priori any specific form of this relationship, and can be used to reveal and estimate non-linear effects of the covariate on the dependent variable.
    More in detail, while in (generalized) linear models the linear predictor is a weighted sum of the $n$ covariates, $sum_{i=1}^n beta_i x_i$, in GAMs this term is replaced by a sum of smooth function, e.g. $sum_{i=1}^n sum_{j=1}^q beta_i , s_j left( x_i right)$, where the $s_1(cdot),dots,s_q(cdot)$ are smooth basis functions (e.g. cubic splines) and $q$ is the basis dimension. By combining the basis functions GAMs can represent a large number of functional relationship (to do so they rely on the assumption that the true relationship is likely to be smooth, rather than wiggly). They are essentially an extension of GLMs, however they are designed in a way that makes them particularly useful for uncovering nonlinear effects of numerical covariates, and for doing so in an "automatic" fashion (from Hastie and Tibshirani original article, they have 'the advantage of being completely automatic, i.e. no "detective" work is needed on the part of the statistician').






    share|cite|improve this answer











    $endgroup$



    The main difference imho is that while "classical" forms of linear, or generalized linear, models assume a fixed linear or some other parametric form of the relationship between the dependent variable and the covariates, GAM do not assume a priori any specific form of this relationship, and can be used to reveal and estimate non-linear effects of the covariate on the dependent variable.
    More in detail, while in (generalized) linear models the linear predictor is a weighted sum of the $n$ covariates, $sum_{i=1}^n beta_i x_i$, in GAMs this term is replaced by a sum of smooth function, e.g. $sum_{i=1}^n sum_{j=1}^q beta_i , s_j left( x_i right)$, where the $s_1(cdot),dots,s_q(cdot)$ are smooth basis functions (e.g. cubic splines) and $q$ is the basis dimension. By combining the basis functions GAMs can represent a large number of functional relationship (to do so they rely on the assumption that the true relationship is likely to be smooth, rather than wiggly). They are essentially an extension of GLMs, however they are designed in a way that makes them particularly useful for uncovering nonlinear effects of numerical covariates, and for doing so in an "automatic" fashion (from Hastie and Tibshirani original article, they have 'the advantage of being completely automatic, i.e. no "detective" work is needed on the part of the statistician').







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Dec 5 '18 at 13:29

























    answered Dec 5 '18 at 12:08









    matteomatteo

    1,371513




    1,371513








    • 2




      $begingroup$
      Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
      $endgroup$
      – kjetil b halvorsen
      Dec 5 '18 at 12:30










    • $begingroup$
      Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
      $endgroup$
      – matteo
      Dec 5 '18 at 13:14










    • $begingroup$
      thanks - this is helpful. and yes, I was talking about classic GLMs
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:41










    • $begingroup$
      @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:49












    • $begingroup$
      The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
      $endgroup$
      – matteo
      Dec 5 '18 at 21:10














    • 2




      $begingroup$
      Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
      $endgroup$
      – kjetil b halvorsen
      Dec 5 '18 at 12:30










    • $begingroup$
      Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
      $endgroup$
      – matteo
      Dec 5 '18 at 13:14










    • $begingroup$
      thanks - this is helpful. and yes, I was talking about classic GLMs
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:41










    • $begingroup$
      @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:49












    • $begingroup$
      The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
      $endgroup$
      – matteo
      Dec 5 '18 at 21:10








    2




    2




    $begingroup$
    Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 12:30




    $begingroup$
    Well, but as said in comments, all of that can be done with glm's also ... I suspect the main difference is pragmatic. The R implementation in mgcv does a lot of things you cannot do with glm, but could have been done in that framework also ...
    $endgroup$
    – kjetil b halvorsen
    Dec 5 '18 at 12:30












    $begingroup$
    Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
    $endgroup$
    – matteo
    Dec 5 '18 at 13:14




    $begingroup$
    Yes, I agree with you, GAMs are an extension of GLMs. However the question was about when to use GAM and when to use GLM, and it seemed to me that the op meant "classical" forms of GLMs, which do not usually include a set of basis function as predictors and are not used to reveal/approximate unknown nonlinear relationship.
    $endgroup$
    – matteo
    Dec 5 '18 at 13:14












    $begingroup$
    thanks - this is helpful. and yes, I was talking about classic GLMs
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:41




    $begingroup$
    thanks - this is helpful. and yes, I was talking about classic GLMs
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:41












    $begingroup$
    @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:49






    $begingroup$
    @ matteo just two more things: i) what exactly do you mean by "true relationship is likely to be smooth, rather than wiggly"? and ii) "particularly useful for uncovering nonlinear effects of numerical covariates" - how would one describe / quantify nonlinearity (e.g. with mgcv)?
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:49














    $begingroup$
    The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
    $endgroup$
    – matteo
    Dec 5 '18 at 21:10




    $begingroup$
    The true relationship might not actually be smooth, however GAMs typically control for model complexity by adding a "wiggliness" penalty during the process of likelihood maximization (usually implemented as a proportion of the integrated square of the second derivative of the estimated function). Nonlinear effects of numerical covariates means that the influence of a particular numerical variable on the dependent variable might, for example, not increases/decreases monotonically with the variable value, but have an unknown shape, e.g. with local maxima, minima, inflection points,...
    $endgroup$
    – matteo
    Dec 5 '18 at 21:10













    9












    $begingroup$

    I'd emphasize that GAMs are much more flexible than GLMs, and hence need more care in their use. With greater power comes greater responsibility.



    You mention their use in ecology, which I have also noticed. I was in Costa Rica and saw some kind of study in a rainforest where some grad students had thrown some data into a GAM and accepted its crazy-complex smoothers because the software said so. It was pretty depressing, except for the humorous/admirable fact that they rigorously included a footnote that documented the fact that they'd used a GAM and the high-order smoothers that resulted.



    You don't have to understand exactly how GAMs work to use them, but you really need to think about your data, the problem at hand, your software's automated selection of parameters like smoother orders, your choices (what smoothers you specify, interactions, if a smoother is justified, etc), and the plausibility of your results.



    Do lots of plots and look at your smoothing curves. Do they go crazy in areas with little data? What happens when you specify a low-order smoother or remove smoothing entirely? Is a degree 7 smoother realistic for that variable, is it overfitting despite assurances that it's cross-validating its choices? Do you have enough data? Is it high-quality or noisy?



    I like GAMS and think they're under-appreciated for data exploration. They're just super-flexible and if you allow yourself to science without rigor, they will take you farther into the statistical wilderness than simpler models like GLMs.






    share|cite|improve this answer











    $endgroup$













    • $begingroup$
      I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:59










    • $begingroup$
      Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
      $endgroup$
      – Wayne
      Dec 5 '18 at 19:39












    • $begingroup$
      @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
      $endgroup$
      – Tilen
      Jan 19 at 19:46
















    9












    $begingroup$

    I'd emphasize that GAMs are much more flexible than GLMs, and hence need more care in their use. With greater power comes greater responsibility.



    You mention their use in ecology, which I have also noticed. I was in Costa Rica and saw some kind of study in a rainforest where some grad students had thrown some data into a GAM and accepted its crazy-complex smoothers because the software said so. It was pretty depressing, except for the humorous/admirable fact that they rigorously included a footnote that documented the fact that they'd used a GAM and the high-order smoothers that resulted.



    You don't have to understand exactly how GAMs work to use them, but you really need to think about your data, the problem at hand, your software's automated selection of parameters like smoother orders, your choices (what smoothers you specify, interactions, if a smoother is justified, etc), and the plausibility of your results.



    Do lots of plots and look at your smoothing curves. Do they go crazy in areas with little data? What happens when you specify a low-order smoother or remove smoothing entirely? Is a degree 7 smoother realistic for that variable, is it overfitting despite assurances that it's cross-validating its choices? Do you have enough data? Is it high-quality or noisy?



    I like GAMS and think they're under-appreciated for data exploration. They're just super-flexible and if you allow yourself to science without rigor, they will take you farther into the statistical wilderness than simpler models like GLMs.






    share|cite|improve this answer











    $endgroup$













    • $begingroup$
      I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:59










    • $begingroup$
      Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
      $endgroup$
      – Wayne
      Dec 5 '18 at 19:39












    • $begingroup$
      @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
      $endgroup$
      – Tilen
      Jan 19 at 19:46














    9












    9








    9





    $begingroup$

    I'd emphasize that GAMs are much more flexible than GLMs, and hence need more care in their use. With greater power comes greater responsibility.



    You mention their use in ecology, which I have also noticed. I was in Costa Rica and saw some kind of study in a rainforest where some grad students had thrown some data into a GAM and accepted its crazy-complex smoothers because the software said so. It was pretty depressing, except for the humorous/admirable fact that they rigorously included a footnote that documented the fact that they'd used a GAM and the high-order smoothers that resulted.



    You don't have to understand exactly how GAMs work to use them, but you really need to think about your data, the problem at hand, your software's automated selection of parameters like smoother orders, your choices (what smoothers you specify, interactions, if a smoother is justified, etc), and the plausibility of your results.



    Do lots of plots and look at your smoothing curves. Do they go crazy in areas with little data? What happens when you specify a low-order smoother or remove smoothing entirely? Is a degree 7 smoother realistic for that variable, is it overfitting despite assurances that it's cross-validating its choices? Do you have enough data? Is it high-quality or noisy?



    I like GAMS and think they're under-appreciated for data exploration. They're just super-flexible and if you allow yourself to science without rigor, they will take you farther into the statistical wilderness than simpler models like GLMs.






    share|cite|improve this answer











    $endgroup$



    I'd emphasize that GAMs are much more flexible than GLMs, and hence need more care in their use. With greater power comes greater responsibility.



    You mention their use in ecology, which I have also noticed. I was in Costa Rica and saw some kind of study in a rainforest where some grad students had thrown some data into a GAM and accepted its crazy-complex smoothers because the software said so. It was pretty depressing, except for the humorous/admirable fact that they rigorously included a footnote that documented the fact that they'd used a GAM and the high-order smoothers that resulted.



    You don't have to understand exactly how GAMs work to use them, but you really need to think about your data, the problem at hand, your software's automated selection of parameters like smoother orders, your choices (what smoothers you specify, interactions, if a smoother is justified, etc), and the plausibility of your results.



    Do lots of plots and look at your smoothing curves. Do they go crazy in areas with little data? What happens when you specify a low-order smoother or remove smoothing entirely? Is a degree 7 smoother realistic for that variable, is it overfitting despite assurances that it's cross-validating its choices? Do you have enough data? Is it high-quality or noisy?



    I like GAMS and think they're under-appreciated for data exploration. They're just super-flexible and if you allow yourself to science without rigor, they will take you farther into the statistical wilderness than simpler models like GLMs.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Dec 5 '18 at 13:14

























    answered Dec 5 '18 at 12:38









    WayneWayne

    16k23973




    16k23973












    • $begingroup$
      I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:59










    • $begingroup$
      Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
      $endgroup$
      – Wayne
      Dec 5 '18 at 19:39












    • $begingroup$
      @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
      $endgroup$
      – Tilen
      Jan 19 at 19:46


















    • $begingroup$
      I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
      $endgroup$
      – lueromat
      Dec 5 '18 at 18:59










    • $begingroup$
      Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
      $endgroup$
      – Wayne
      Dec 5 '18 at 19:39












    • $begingroup$
      @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
      $endgroup$
      – Tilen
      Jan 19 at 19:46
















    $begingroup$
    I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:59




    $begingroup$
    I imagine that I most often do what those grad students did: throw my data in a gam and be dazzled by how well mgcv handles my data. I try to be parsimonious with my parameters, and I check how well the predicted values match my data. your comments are a good reminder to be a bit more rigorous - and maybe finally get simon woods book!
    $endgroup$
    – lueromat
    Dec 5 '18 at 18:59












    $begingroup$
    Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
    $endgroup$
    – Wayne
    Dec 5 '18 at 19:39






    $begingroup$
    Heck, I'll go so far as to use a smoother to explore a variable, and then either fix the degrees of freedom at a low value or eliminate the smooth and use, say, a squared term if the smoother was basically quadratic. A quadratic makes sense for an age effect, for example.
    $endgroup$
    – Wayne
    Dec 5 '18 at 19:39














    $begingroup$
    @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
    $endgroup$
    – Tilen
    Jan 19 at 19:46




    $begingroup$
    @Wayne, I came here exactly for an answer on data exploration in relation to GAMs, and saw you pointed it out. How do you use GAMs for data exploration? And how would you decide whether a GAM is needed, or if a GLM would suffice. Would it make sense to simply run a simple GAM in which you run the response and each of the potential predictors in turn, plot that, and see if the relationship warrants a GAM (i.e. non-linear and non-monotonic relationship)?
    $endgroup$
    – Tilen
    Jan 19 at 19:46











    3












    $begingroup$

    I have no reputation to simply add a comment. I do totally agree with Wayne’s comment: With greater power comes greater responsibility. GAMs can be very flexible and often we get/see crazy-complex smoothers. Then, I strongly recommend researchers to restrict degrees of freedom (number of knots) of the smooth functions and to test different model structures (interactions/no interactions etc.).



    GAMs can be considered in between of model-driven approaches (although the border is fuzzy I would include GLM in that group) and data-driven approaches (e.g. Artificial Neural Networks or Random Forests who assume fully interacting non-linear variables’ effects). In accordance, I do not totally agree with Hastie and Tibshirani because GAMs still need some detective work (Hope no one kills me for saying so).



    From an ecological perspective, I would recommend using the R package scam to avoid these unreliable variable crazy-complex smoothers. It was developed by Natalya Pya and Simon Wood and it allows constraining the smooth curves to desired shapes (e.g. unimodal or monotonic), even for two-way interactions. I think GLM becomes a minor alternative after constraining the shape of the smooth functions but this is only my personal opinion.



    Pya, N., Wood, S.N., 2015. Shape constrained additive models. Stat. Comput. 25 (3), 543–559. 10.1007/s11222-013-9448-7






    share|cite|improve this answer











    $endgroup$


















      3












      $begingroup$

      I have no reputation to simply add a comment. I do totally agree with Wayne’s comment: With greater power comes greater responsibility. GAMs can be very flexible and often we get/see crazy-complex smoothers. Then, I strongly recommend researchers to restrict degrees of freedom (number of knots) of the smooth functions and to test different model structures (interactions/no interactions etc.).



      GAMs can be considered in between of model-driven approaches (although the border is fuzzy I would include GLM in that group) and data-driven approaches (e.g. Artificial Neural Networks or Random Forests who assume fully interacting non-linear variables’ effects). In accordance, I do not totally agree with Hastie and Tibshirani because GAMs still need some detective work (Hope no one kills me for saying so).



      From an ecological perspective, I would recommend using the R package scam to avoid these unreliable variable crazy-complex smoothers. It was developed by Natalya Pya and Simon Wood and it allows constraining the smooth curves to desired shapes (e.g. unimodal or monotonic), even for two-way interactions. I think GLM becomes a minor alternative after constraining the shape of the smooth functions but this is only my personal opinion.



      Pya, N., Wood, S.N., 2015. Shape constrained additive models. Stat. Comput. 25 (3), 543–559. 10.1007/s11222-013-9448-7






      share|cite|improve this answer











      $endgroup$
















        3












        3








        3





        $begingroup$

        I have no reputation to simply add a comment. I do totally agree with Wayne’s comment: With greater power comes greater responsibility. GAMs can be very flexible and often we get/see crazy-complex smoothers. Then, I strongly recommend researchers to restrict degrees of freedom (number of knots) of the smooth functions and to test different model structures (interactions/no interactions etc.).



        GAMs can be considered in between of model-driven approaches (although the border is fuzzy I would include GLM in that group) and data-driven approaches (e.g. Artificial Neural Networks or Random Forests who assume fully interacting non-linear variables’ effects). In accordance, I do not totally agree with Hastie and Tibshirani because GAMs still need some detective work (Hope no one kills me for saying so).



        From an ecological perspective, I would recommend using the R package scam to avoid these unreliable variable crazy-complex smoothers. It was developed by Natalya Pya and Simon Wood and it allows constraining the smooth curves to desired shapes (e.g. unimodal or monotonic), even for two-way interactions. I think GLM becomes a minor alternative after constraining the shape of the smooth functions but this is only my personal opinion.



        Pya, N., Wood, S.N., 2015. Shape constrained additive models. Stat. Comput. 25 (3), 543–559. 10.1007/s11222-013-9448-7






        share|cite|improve this answer











        $endgroup$



        I have no reputation to simply add a comment. I do totally agree with Wayne’s comment: With greater power comes greater responsibility. GAMs can be very flexible and often we get/see crazy-complex smoothers. Then, I strongly recommend researchers to restrict degrees of freedom (number of knots) of the smooth functions and to test different model structures (interactions/no interactions etc.).



        GAMs can be considered in between of model-driven approaches (although the border is fuzzy I would include GLM in that group) and data-driven approaches (e.g. Artificial Neural Networks or Random Forests who assume fully interacting non-linear variables’ effects). In accordance, I do not totally agree with Hastie and Tibshirani because GAMs still need some detective work (Hope no one kills me for saying so).



        From an ecological perspective, I would recommend using the R package scam to avoid these unreliable variable crazy-complex smoothers. It was developed by Natalya Pya and Simon Wood and it allows constraining the smooth curves to desired shapes (e.g. unimodal or monotonic), even for two-way interactions. I think GLM becomes a minor alternative after constraining the shape of the smooth functions but this is only my personal opinion.



        Pya, N., Wood, S.N., 2015. Shape constrained additive models. Stat. Comput. 25 (3), 543–559. 10.1007/s11222-013-9448-7







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited 2 days ago









        kjetil b halvorsen

        29.4k980215




        29.4k980215










        answered Dec 12 '18 at 8:38









        Rafael Muñoz-MasRafael Muñoz-Mas

        311




        311






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Cross Validated!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f380426%2fwhen-to-use-a-gam-vs-glm%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How do I know what Microsoft account the skydrive app is syncing to?

            When does type information flow backwards in C++?

            Grease: Live!