Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gam]

Generalized additive model (GAM) is a generalized linear model (GLM) in which the response variable depends on unknown smooth functions of some predictor variables.

11
votes
0answers
318 views

Penalized spline confidence intervals based on cluster-sandwich VCV

This is my first post here, but I've benefited a lot from this forum's results popping up in google search results. I've been teaching myself semi-parametric regression using penalized splines. ...
7
votes
0answers
897 views

Generalised additive model: What is ref.df in R's output?

Hi I am struggling to understand Ref.df in the output screen in R: ...
6
votes
0answers
102 views

When using GAMs, how much concurvity is too much?

Is there a rule of thumb for excessive concurvity? For example, I've heard that a VIF of $>10$ suggests that multicollinearity may be a problem (e.g., in this CV answer), but I cannot find a ...
6
votes
0answers
250 views

Mixed models formulation (GAMM, GLS, nlme): from R to mathematical notation

I have just finalised the analysis of a dataset fitting Generalised additive mixed models (GAMMs) with mgcv package in R v3.3.0. But I am having trouble in writing my models into their correct ...
6
votes
0answers
2k views

Interpreting and reporting gamm4 result

I am new to gam, and most of my knowledge comes from this document http://www3.nd.edu/~mclark19/learn/GAMS.pdf. Now I am using generalized addictive model with random effects to model some data, where ...
5
votes
0answers
37 views

Compare if two regression model behaves similarly

this is my first asking question here... forgive me if my question is not clear enough. I have two datasets; one is ground truth dataset and another is perturbed version of the same dataset. I want ...
5
votes
0answers
296 views

Predictive modeling using GAM (mgcv)

I have seven years of continuous insect population data, along with temperature and humidity parameters. I’d like to use this data to predict future populations in a given year using a generalized ...
5
votes
0answers
231 views

Interpretation of smoothing spline

This question is about interpreting the results from non-linear regression models, especially when using regression splines. The numerical output is not very informative when interpreting the effects, ...
5
votes
0answers
782 views

Marginal effects with logistic generalized additive model in R

I am currently working with a logistic semi-parametric model in R using the mgcv package. The output from the model gives the standard log-odds coefficients; however, reviewers have requested ...
4
votes
0answers
288 views

Post hoc comparison in GAM models

I'm analysing some roe deer biological traits with a gam in mgcv. One of my variable is a factor with nine levels (i.e represents a combination of litter size and sex: M, F, FF, MF and so on) and my ...
4
votes
0answers
517 views

Specifying and extracting random intercepts and slopes from GAMM using bam in mgcv

I have two questions about how to specify random effects structures in mgcv using bam. I'm using bam because I have a large data set (~15,000 data points) that consists of interviews with different ...
4
votes
0answers
1k views

How to fit a regression for log-normal with gamlss

Since my original question was to R-code-specific I'm trying to rewrite it: I want to make a regression where my dependent variable y should follow a log-normal-...
4
votes
0answers
2k views

Describing GAM from ggplot's stat_smooth in a paper

I am writing a paper where I have some figures with lines drawn using ggplot2's stat_smooth with no arguments. When I generate a ...
3
votes
0answers
229 views
3
votes
0answers
46 views

Why the same design matrix for GAM and LM lead to different results?

I am trying to use loess basis expansion on a toy data set. Why the same design matrix for GAM and LM lead to different results? ...
3
votes
0answers
226 views

When are tensor products preferable to s smooths in GAM(M)s?

I learned in this forum and from a book of Simon Wood, that tensor products rather than thin-plate (s) smooths are used when covariates are not naturally on the same scale. However in my experience ...
3
votes
0answers
2k views

gam: choosing between cubic and thin-plate splines

I am using gam (mgcv) to model a continuous response (a soil nutrient) in relation to a continuous predictor plus categorical predictors plus site random effects (modest number of sites) with: ...
3
votes
0answers
194 views

Fitting a GAMM for non-gaussian response variable in R (package gamm4)

I am trying to model two variables showing a non-linear relationship, as shown in the scatterplot below, with a Generalized Additive Mixed Model in R (package 'gamm4). The data represents roughly 15 ...
3
votes
0answers
111 views

How to account for patterns in GAMM residuals due to the addition of an offset?

I have been wrestling with some model problems for a few weeks now and would like some help. I am trying to determine whether fish catch rates have changed following an event using GAMM. Because ...
3
votes
0answers
2k views

Using gamm4 for generalized additive models with random effects. Use the fitted values from the `mer` part or the `gam` part?

As the title indicates, I am using the R package gamm4 for generalized additive modeling with random effects. The response for individual $i$ in group $j$, $y_{ij}$, is modeled in terms of the ...
3
votes
0answers
830 views

Generalized additive model

I need help on how to interpret results for Generalised Additive Models(GAM) in R using the mgcv package. I have a dataset called flood which has a dependent variable called year (1985-2014) and the ...
3
votes
0answers
351 views

Simultaneous and Pointwise Confidence Bands for GAMs

I am performing a penalized B-spline regression on a simple time series of count data in R using the mgcv package. When I calculate a pointwise confidence band from the standard error of the fit based ...
3
votes
0answers
2k views

How to calculate deviance explained for a general additive mixed model (GAMM)?

I am working with the package mgcv fitting some GAMs with several covariates, and the same models with GAMMs including annual correlation. Applying the ...
3
votes
0answers
827 views

The correct use of tensor product in gam (mgcv) function

I want to resurrect a question that I asked two months ago (Comparing gam models using ti( )), but adding more explanations. The aim of my analyses was to compare several gam models with different ...
3
votes
0answers
639 views

How should I report the significance of a spline smooth obtained using mgcv in R?

I wish to test whether a spline-based smooth could be replaced by a linear term. I am using the mgcv package in R. Using the example from the helpfile: ...
3
votes
0answers
1k views

Lasso regression with GAM models in R

I'm using a regression package that uses gam() from the mgcv package. Is it possible to include an L1 penalty with the ...
3
votes
0answers
230 views

Algorithm for selecting interactions without very many degrees of freedom (mgcv, gam)

I've got a semi-parametric model that I'm fitting with GAM's (mgcv in R). It is of the form $$y = \theta + X'\beta + f(Z) + \text{Interactions!} + \epsilon$$ I've got 289 observations. Many of ...
3
votes
0answers
291 views

GAM sample size

A common rule of thumb in social science is to have at least $30$ observations for regression (without any complicated effects). Does someone know such rule of thumb for GAMs? Are $50$ observations ...
2
votes
0answers
20 views

How do I use GAMs in instrumental variable analysis?

I have an outcome $Y$, a risk factor $X$, and an instrument $Z$. In a two-stage least squares (2SLS) setting, the first stage is $$ X=Z + \varepsilon $$ and the second stage uses predictions from ...
2
votes
0answers
23 views

Which index is preferred in GAM, “R-sq” or “Deviance explained”?

I use mgcv package in R to build a Generalized Additive Model. When looking at results of (e.g., summary()), there are two ...
2
votes
0answers
101 views

Difference between s() and ti() terms in mgcv package when applied to one variable

I am using the mgcv package in R to fit logistic GAMs to survey data. In one of my models I use an interaction between two covariates. I am currently trying to fit ...
2
votes
0answers
81 views

Formulating mutli-membership random effects in lme4/GAMM4

I'm trying to fit a GAM with multi-membership random effects and nested effects in the package GAMM4, which uses lme4 syntax. Does anyone have any experience doing this in either package? Is it ...
2
votes
0answers
35 views

GAMM with multiple and crossed random effects

I am new to Generalized additive mixed models (GAMM) and I'm trying to model a behavioral response variable (time spent shading eggs by a nesting bird in minutes ...
2
votes
0answers
114 views

Time series models (e.g. ARMA) a type or extension of GLM? Particular/stipulated forms of dependence in time series models

I am trying to understand the relationship between ARMA Time Series models and the GLM (Generalized Linear Model) family of models. As far I know, all GLMs have the following 3 components: 1) random ...
2
votes
0answers
79 views

Why is GAMM fit so poor?

I have annual measurements of these 3 IDs and would like to visualise their overall trend (one curve) using R's gamm function in order to control for ...
2
votes
0answers
204 views

GAM - Smooth comparison with factor variables

I try to compare the splines for my 6 categories. To this end, first I tried the ordered factor approach and posted the result here. This comparison is not sufficient for me since I would like to have ...
2
votes
0answers
202 views

Model Comparison of GAMs using gamm4

I am using a GAM from package gamm4 in R to fit a varying coefficient model for longitudinal data. I have data consisting of ...
2
votes
0answers
254 views

Prediction Confidence Intervals when fitting a GAM model using gam package

Is there any way to get a prediction confidence interval from a model fit with gam package? Working with mgcv is not an option for me as it doesn't provide as good fit as gam does on my data. The ...
2
votes
0answers
52 views

Non-constant overdispersion (overdispersion parameter depending on covariate) in negative binomial regression

In a negative binomial regression (daily number of cases of a disease over time), after controlling for several factors and experimenting with several functional forms, my results still don't look ...
2
votes
0answers
80 views

What should be reported for a fitted GAM?

There are many items in results of a fitted generalized additive model (GAM). Which criteria should be reported generally? Particularly, how can we show a good fit of a logistic GAM?
2
votes
0answers
30 views

Can I define unique basis functions in GAMs?

I am modelling a process evolving over time using GAMs. There is some theory that says that the time evolution should look like a particular function, so I would like to smooth the time component ...
2
votes
0answers
104 views

Fit big GAM with constraints on linear terms

I'm trying to fit MGCV GAM with constraints on linear terms. I feed a dataset with factor variable G. Number of rows is about 30-40k. Number of model parameters - ...
2
votes
0answers
429 views

GAMs vs GLMs with feature engineering - is there a practical difference?

I recently came across this tutorial on General Additive Models (GAMs). Quoting the article: The principle behind GAMs is similar to that of regression, except that instead of summing effects of ...
2
votes
0answers
941 views

Which gam.check() output is most reliable in mgcv R package?

I have been studying Simon Wood's excellent book to aid my understanding and analysis of GAMs to my data, in addition to looking at some application papers of mgcv. The gam.check() function outputs ...
2
votes
0answers
193 views

Why does the predicted trend line from a gamm not match the fitted values generated by the same model?

I am using a GAMM to ask whether the first date of flowering for several plant species is occurring earlier or later over the past ~40 years (potentially due to climate change). I have separate ...
2
votes
0answers
325 views

Chi square and p value in GAM results in R

I would like to know how to interpret chi square and p values in GAM. As I understand p values basically tell us a story about the graphs - how low is the probability that there's just a straight ...
2
votes
0answers
191 views

GAM model and interactions between nonparametric terms / additive interactions and GAM?

I have a GAM model with several continuous parametric covariates, one non-parametric covariate, and two continuous parametric predictors. I am using R. The reason I am employing GAM is to be able to ...
2
votes
0answers
151 views

Combine multiple GAM models

I have multiple GAM models (1000) done for my cross-validation. Now I would like to combine all of these models to an average GAM model, which would be the final model used for prediction. Is this ...
2
votes
0answers
704 views

GAMM model with spatial and temporal autocorrelattion

I am trying to integrate spatial and temporal autocorrelation to my GAMM model using packages mgcv and nlme. The following code runs, but I do not know, how to interpret the “s(x, y)” command results....
2
votes
0answers
39 views

Derivation for the second order expansion in the paper “Additive Logistic Regression: A Statistical View of Boosting”

I need help with a derivation. In the paper "Additive Logistic Regression: A Statistical View of Boosting". The authors make a second order approximation about $f(x)=0$ to the following function $J(...