Discussion:
[R-sig-ME] question about a GAM model (dani)
Highland Statistics Ltd
2018-08-29 19:30:59 UTC
Permalink
------------------------------

Message: 4
Date: Wed, 29 Aug 2018 17:38:44 +0000
From: dani <***@live.com>
To: Ben Bolker <***@gmail.com>, "r-sig-mixed-***@r-project.org"
<r-sig-mixed-***@r-project.org>
Subject: Re: [R-sig-ME] question about a GAM model
Message-ID:
<***@BYAPR06MB3832.namprd06.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Thank you very much Udita and Dr. Bolker for your responses.

It is still not clear to me how should I proceed. Would anyone else be able help with this issue,?




Dani,

GAMs are useful if you use them with care, but confusing if you just apply them because someone else is doing it as well.
Perhaps you should first ask yourself the question why you are applying a GAM. Then focus on the question
whether the output makes sense.

Based on your output it seems that nothing is important (not even as parametric terms). But I am not familiar with your
data; things like collinearity can mess up the shape of smoothers. And you don't mention the size of your data set neither.

I suggest that you have a go at Wood (2017), or if I may be bold enough to self-cite....try our Beginner's Guide to GAM (2012).



Kind regards,

Alain Zuur






 Best regards,

Dani


Sent from Outlook<http://aka.ms/weboutlook>


________________________________
From: R-sig-mixed-models <r-sig-mixed-models-***@r-project.org> on behalf of Ben Bolker <***@gmail.com>
Sent: Tuesday, August 28, 2018 6:19 AM
To: r-sig-mixed-***@r-project.org
Subject: Re: [R-sig-ME] question about a GAM model



Don't forget to run k.check() on your model to see if you specified a
large enough basis dimension to start with ...

On 2018-08-28 05:51 AM, Bansal, Udita wrote:
> Hi Dani,
>
> I don�t know much about GAM but I know you can look at the plots for fitted model results to check if there is any curvature. You can use the following code:
>
> par(mfrow = c(1,3))
> plot(GAMmodel)
>
> Bests
> Udita
>
> On 28/08/18, 1:58 AM, "R-sig-mixed-models on behalf of dani" <r-sig-mixed-models-***@r-project.org on behalf of ***@live.com> wrote:
>
> Hi everyone,
>
>
> I have a question about a GAM model where I included three non-parametric terms. I obtained the results below. can I conclude that the associations were in fact linear and run a final GLM model without including splines? To me it seems unnecessary to include splines in the final model. How should I report these results?
>
>
> # Approximate significance of smooth terms:
> # edf Ref.df Chi.sq p-value
> # s(x1) 1.61 2.01 1.17 0.550
> # s(x2) 1.00 1.00 0.00 0.955
> # s(x3) 1.00 1.00 4.61 0.032 *
>
> Thank you very much,
> Dani
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-***@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> _______________________________________________
> R-sig-mixed-***@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

_______________________________________________
R-sig-mixed-***@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]




------------------------------

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


------------------------------

End of R-sig-mixed-models Digest, Vol 140, Issue 34
***************************************************

--

Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: ***@highstat.com
URL: www.highstat.com

And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands



Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).
dani
2018-08-29 19:42:26 UTC
Permalink
Hello Dr. Zuur,


Thank you so much for your message!


I am only using this model for educational purposes, I am just playing with a dataset of 500 observations. Variables x1 and x2 are covariates and they are both displaying non-parametric associations with the outcome. The x3 variable is the variable of interest.


I noticed the value of 1 for edfs for the covariate and for the variable of interest so I asked myself if I should not remove the parametric term and re-run the model is situations like these.


If this happens when I conduct an analysis for a study, do I present such results or I re-run the model without smoothers on x2 and x3, even though in bivariate associations with the outcome, x2 and x3 showed non-parametric associations.


Thank you so much for your suggestions, I will definitely look at the two books again, they are always useful!

Best,

Dani

<http://aka.ms/weboutlook>


________________________________
From: R-sig-mixed-models <r-sig-mixed-models-***@r-project.org> on behalf of Highland Statistics Ltd <***@highstat.com>
Sent: Wednesday, August 29, 2018 12:30 PM
To: r-sig-mixed-***@r-project.org
Subject: Re: [R-sig-ME] question about a GAM model (dani)




------------------------------

Message: 4
Date: Wed, 29 Aug 2018 17:38:44 +0000
From: dani <***@live.com>
To: Ben Bolker <***@gmail.com>, "r-sig-mixed-***@r-project.org"
<r-sig-mixed-***@r-project.org>
Subject: Re: [R-sig-ME] question about a GAM model
Message-ID:
<***@BYAPR06MB3832.namprd06.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Thank you very much Udita and Dr. Bolker for your responses.

It is still not clear to me how should I proceed. Would anyone else be able help with this issue,?




Dani,

GAMs are useful if you use them with care, but confusing if you just apply them because someone else is doing it as well.
Perhaps you should first ask yourself the question why you are applying a GAM. Then focus on the question
whether the output makes sense.

Based on your output it seems that nothing is important (not even as parametric terms). But I am not familiar with your
data; things like collinearity can mess up the shape of smoothers. And you don't mention the size of your data set neither.

I suggest that you have a go at Wood (2017), or if I may be bold enough to self-cite....try our Beginner's Guide to GAM (2012).



Kind regards,

Alain Zuur






Best regards,

Dani


Sent from Outlook<http://aka.ms/weboutlook>


________________________________
From: R-sig-mixed-models <r-sig-mixed-models-***@r-project.org> on behalf of Ben Bolker <***@gmail.com>
Sent: Tuesday, August 28, 2018 6:19 AM
To: r-sig-mixed-***@r-project.org
Subject: Re: [R-sig-ME] question about a GAM model



Don't forget to run k.check() on your model to see if you specified a
large enough basis dimension to start with ...

On 2018-08-28 05:51 AM, Bansal, Udita wrote:
> Hi Dani,
>
> I don�t know much about GAM but I know you can look at the plots for fitted model results to check if there is any curvature. You can use the following code:
>
> par(mfrow = c(1,3))
> plot(GAMmodel)
>
> Bests
> Udita
>
> On 28/08/18, 1:58 AM, "R-sig-mixed-models on behalf of dani" <r-sig-mixed-models-***@r-project.org on behalf of ***@live.com> wrote:
>
> Hi everyone,
>
>
> I have a question about a GAM model where I included three non-parametric terms. I obtained the results below. can I conclude that the associations were in fact linear and run a final GLM model without including splines? To me it seems unnecessary to include splines in the final model. How should I report these results?
>
>
> # Approximate significance of smooth terms:
> # edf Ref.df Chi.sq p-value
> # s(x1) 1.61 2.01 1.17 0.550
> # s(x2) 1.00 1.00 0.00 0.955
> # s(x3) 1.00 1.00 4.61 0.032 *
>
> Thank you very much,
> Dani
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-***@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> _______________________________________________
> R-sig-mixed-***@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

_______________________________________________
R-sig-mixed-***@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]




------------------------------

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


------------------------------

End of R-sig-mixed-models Digest, Vol 140, Issue 34
***************************************************

--

Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: ***@highstat.com
URL: www.highstat.com<http://www.highstat.com>

And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands



Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).

_______________________________________________
R-sig-mixed-***@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]
dani
2018-08-29 20:08:27 UTC
Permalink
Hello Dr. Zuur,


Thank you so much for your prompt and detailed response. That is very helpful! Thank so much for your advice!


I also have another issue that is not clear to me and I could not find any information about that so far. Assuming that my model includes many parametric covariates, does it make any sense to standardize coefficients in a binomial GAM model and report both unstandardized and standardized coefficients for the parametric coefficients in a manuscript? I have never seen that in the literature, so I really do not know how to approach this issue.


Best regards,

Dani




________________________________
From: Highland Statistics Ltd <***@highstat.com>
Sent: Wednesday, August 29, 2018 12:55 PM
To: dani; r-sig-mixed-***@r-project.org
Subject: Re: [R-sig-ME] question about a GAM model (dani)



On 29/08/2018 20:42, dani wrote:

Hello Dr. Zuur,


Thank you so much for your message!


Dani,

I am only using this model for educational purposes, I am just playing with a dataset of 500 observations. Variables x1 and x2 are covariates and they are both displaying non-parametric associations with the outcome. The x3 variable is the variable of interest.


The fact that x1 vs Y and x2 vs Y show non-linear patterns is no 100% guarantee that in a model with Y ~ X1 + X2 each of them also show a non-linear pattern.


I noticed the value of 1 for edfs for the covariate and for the variable of interest so I asked myself if I should not remove the parametric term and re-run the model is situations like these.

That is a sensible line of thinking. The AIC is also your friend here.


If this happens when I conduct an analysis for a study, do I present such results or I re-run the model without smoothers on x2 and x3, even though in bivariate associations with the outcome, x2 and x3 showed non-parametric associations.

My strategy for GAMs is to only use those covariates as smoothers that make (biological) sense. You can then either start with a parametric model (e.g. a GLM) and inspect residuals, or start with a (simple) GAM and see what the edf tells you (or see how the smoothers look like) and potentially move back to a GLM (but note that link functions can also cause non-linear patterns, or remove non-linear patterns). This is the chicken or the egg.

Alain





Thank you so much for your suggestions, I will definitely look at the two books again, they are always useful!

Best,

Dani


________________________________
From: R-sig-mixed-models <r-sig-mixed-models-***@r-project.org><mailto:r-sig-mixed-models-***@r-project.org> on behalf of Highland Statistics Ltd <***@highstat.com><mailto:***@highstat.com>
Sent: Wednesday, August 29, 2018 12:30 PM
To: r-sig-mixed-***@r-project.org<mailto:r-sig-mixed-***@r-project.org>
Subject: Re: [R-sig-ME] question about a GAM model (dani)




------------------------------

Message: 4
Date: Wed, 29 Aug 2018 17:38:44 +0000
From: dani <***@live.com><mailto:***@live.com>
To: Ben Bolker <***@gmail.com><mailto:***@gmail.com>, "r-sig-mixed-***@r-project.org"<mailto:r-sig-mixed-***@r-project.org>
<r-sig-mixed-***@r-project.org><mailto:r-sig-mixed-***@r-project.org>
Subject: Re: [R-sig-ME] question about a GAM model
Message-ID:
<***@BYAPR06MB3832.namprd06.prod.outlook.com><mailto:***@BYAPR06MB3832.namprd06.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Thank you very much Udita and Dr. Bolker for your responses.

It is still not clear to me how should I proceed. Would anyone else be able help with this issue,?




Dani,

GAMs are useful if you use them with care, but confusing if you just apply them because someone else is doing it as well.
Perhaps you should first ask yourself the question why you are applying a GAM. Then focus on the question
whether the output makes sense.

Based on your output it seems that nothing is important (not even as parametric terms). But I am not familiar with your
data; things like collinearity can mess up the shape of smoothers. And you don't mention the size of your data set neither.

I suggest that you have a go at Wood (2017), or if I may be bold enough to self-cite....try our Beginner's Guide to GAM (2012).



Kind regards,

Alain Zuur






Best regards,

Dani


Sent from Outlook<http://aka.ms/weboutlook>


________________________________
From: R-sig-mixed-models <r-sig-mixed-models-***@r-project.org><mailto:r-sig-mixed-models-***@r-project.org> on behalf of Ben Bolker <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, August 28, 2018 6:19 AM
To: r-sig-mixed-***@r-project.org<mailto:r-sig-mixed-***@r-project.org>
Subject: Re: [R-sig-ME] question about a GAM model



Don't forget to run k.check() on your model to see if you specified a
large enough basis dimension to start with ...

On 2018-08-28 05:51 AM, Bansal, Udita wrote:
> Hi Dani,
>
> I don�t know much about GAM but I know you can look at the plots for fitted model results to check if there is any curvature. You can use the following code:
>
> par(mfrow = c(1,3))
> plot(GAMmodel)
>
> Bests
> Udita
>
> On 28/08/18, 1:58 AM, "R-sig-mixed-models on behalf of dani" <r-sig-mixed-models-***@r-project.org on behalf of ***@live.com><mailto:r-sig-mixed-models-***@r-***@live.com> wrote:
>
> Hi everyone,
>
>
> I have a question about a GAM model where I included three non-parametric terms. I obtained the results below. can I conclude that the associations were in fact linear and run a final GLM model without including splines? To me it seems unnecessary to include splines in the final model. How should I report these results?
>
>
> # Approximate significance of smooth terms:
> # edf Ref.df Chi.sq p-value
> # s(x1) 1.61 2.01 1.17 0.550
> # s(x2) 1.00 1.00 0.00 0.955
> # s(x3) 1.00 1.00 4.61 0.032 *
>
> Thank you very much,
> Dani
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-***@r-project.org<mailto:R-sig-mixed-***@r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> _______________________________________________
> R-sig-mixed-***@r-project.org<mailto:R-sig-mixed-***@r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

_______________________________________________
R-sig-mixed-***@r-project.org<mailto:R-sig-mixed-***@r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]




------------------------------

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-***@r-project.org<mailto:R-sig-mixed-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


------------------------------

End of R-sig-mixed-models Digest, Vol 140, Issue 34
***************************************************

--

Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: ***@highstat.com<mailto:***@highstat.com>
URL: www.highstat.com<http://www.highstat.com>

And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands



Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).

_______________________________________________
R-sig-mixed-***@r-project.org<mailto:R-sig-mixed-***@r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


--

Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: ***@highstat.com<mailto:***@highstat.com>
URL: www.highstat.com<http://www.highstat.com>

And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands



Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).



[[alternative HTML version deleted]]
Loading...