# 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.

198 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
323 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. ...
933 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: ...
113 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 ...
266 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 ...
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 ...
358 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 ...
265 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, ...
315 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 ...
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: ...
563 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 ...
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-...
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 ...
45 views

### How can I incorporate a known measurement error per group into a GAM?

I am trying to investigate surface changes using a time series of 3D point clouds. Due to data volume, I am segmenting the point cloud in small (eg. 50cmx50cm) areas and for each compute a generalized ...
63 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 ...
278 views

### How to measure variable importance in a GAM model?

For concreteness: ...
115 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 ...
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 ...
370 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 ...
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 ...
886 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 ...
217 views

### Is there a way to add covariates to centile GAM curves in R?

Using the package "mgcv" I fitted a GAM to demonstrate head circumference changes over the lifetime for data stemming from two different countries; ...
659 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: ...
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 ...
234 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 ...
320 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 ...
22 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 ...
69 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 ...
85 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 ...
78 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 ...
134 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 ...
77 views

### Concurvity in additive modelling. Parametric term?

I am modelling a outcome in gam were two variables (x1 and x2) are continuous and the other four are factors. I have a suspicion that x1 and x2 might be collinear so I want to check that. As I ...
87 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 ...
165 views

### GAM: Plotting gam models of different treatments?

I want to figure out the best way to plot gams, but I am getting confused about the best way to do this for my data. Please note that I am not a statistician, so 'stats/coding for dummies' answers are ...
270 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 ...
266 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 ...
326 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 ...
99 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?
34 views

### Using a recoded window 10 days back in a GAM-model, is that a double whammy or is it OK to do?

I'm formulating a prediction in a logistic reression type in a GAM model. ...
128 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 - ...
496 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 ...
1k 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 ...
256 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 ...
53 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? ...
369 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 ...
257 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 ...
206 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 ...
166 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 ...
216 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 ...
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(...