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

45 questions
14k views

### Why does including latitude and longitude in a GAM account for spatial autocorrelation?

I have produced generalized additive models for deforestation. To account for spatial-autocorrelation, I have included latitude and longitude as a smoothed, interaction term (i.e. s(x,y)). I've based ...
1k views

### Can I use bootstrapping to estimate the uncertainty in a maximum value of a GAM?

I have data from an experiment where I look at the development of algal biomass as a function of the concentration of a nutrient. The relationship between biomass (the response variable) and the ...
12k views

### Confidence interval for GAM model

Reading mgcv::gam's help page: confidence/credible intervals are readily available for any quantity predicted using a fitted model However I can't figure a ...
5k views

### Help me fit this non-linear multiple regression that has defied all previous efforts

EDIT: Since making this post, I have followed up with an additional post here. Summary of the text below: I am working on a model and have tried linear regression, Box Cox transformations and GAM but ...
19k views

### How to include an interaction term in GAM?

The following code evaluates the similarity between two time series: ...
5k views

### Predicting with random effects in mgcv gam

I am interested in modeling total fish catch using gam in mgcv to model simple random effects for individual vessels (that make repeated trips over time in the fishery). I have 98 subjects, so I ...
2k views

### R/mgcv: Why do te() and ti() tensor products produce different surfaces?

The mgcv package for R has two functions for fitting tensor product interactions: te() and <...
9k views

### Selecting knots for a GAM

When selecting an appropriate number of knots for a GAM one might want to take into account the number of data and increments on the x-axis. What if we have 100 increments on the x-axis with 1000 ...
9k views

### How I can interpret GAM results?

I have a question about Generalized Additive Models. What is Deviance explained, GCV score and Scale est. in GAM results? What these indicators show?
2k views

### When to use a GAM vs GLM

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 ...
236 views

### ANOVA table (and its interpretation) for a single GAM model

I am not really confident in interpreting the ANOVA table of a GAM model. I understand how it can be used to compare models (see for instance this question), but I am interested in interpreting it for ...
995 views

### Generalized additive models — who does research on them besides Simon Wood?

I use GAMs more and more. When I go to provide references for their various components (smoothing parameter selection, various spline bases, p-values of smooth terms), they are all from one ...
2k views

### Generalized additive models (GAMs), interactions, and covariates

I've been exploring a number of tools for forecasting, and have found Generalized Additive Models (GAMs) to have the most potential for this purpose. GAMs are great! They allow for complex models to ...
6k views

### ANOVA to compare models

I'm looking at this site for a workshop on GAM in R: http://qcbs.ca/wiki/r_workshop8 In the end of the section 2. Multiple smooth terms they show an example, where ...
6k views

### Two methods of adding random effects to a GAM give very different results. Why is this and which one should be used?

A particular section of the mgcv documentation gives multiple methods of incorporating random effects into a generalized additive model. Two methods are 1) to add a smooth term in the class labels ...
2k views

### Interpretation of bs(x) and gam Results

This is a two-part question. 1) I've read the description of the bs function in the R splines package, but I don't think I ...
227 views

### Introductory Text for GAM

I'm looking for a text to help someone who uses GLMs in practice become familiar/comfortable with GAMs. Online or physical textbook would be fine. I am approaching this as a practitioner, so I would ...
230 views

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

For concreteness: ...
120 views

### Different ways of modelling interactions between continuous and categorical predictors in GAM

The following question builds on the discussion found on this page. Given a response variable y, a continuous explanatory variable ...
2k views

### smoothing methods for gam in mgcv package

i am currently working with gam models in the mgcv package and for me the smoothing methods are a bit confusing and i hope that you guys can help me to understand that better. So here is what i've ...
2k views

### Centering constraints in MGCV GAM

The help pages for MGCV in R states the following: Note that when using factor by variables, centering constraints are applied to the smooths, which usually means that the by variable should ...
2k views

### GAM with categorical variables - interpretation

I want to use GAM to analyze my experimental data. In my experiment, participants basically play a game for 40 experimental years. In total I have 6 different conditions and I have a between-subject ...
86 views

### Is there a reasonable way to impose a prior within a likelihood-based model?

I have been using GAM (mgcv's gam()) to perform a fairly complex and computationally intensive analysis - I have millions of observations and dozens of terms ...
647 views

### Selecting GAM with/without random effects - residual plots vs. AIC

My question is about fitting GAMs with a random effect in mgcv, using s(x, bs="re"). I understand that determining the random effects structure should occur before determining the fixed effects ...
873 views

### GAMM with zero-inflated data

Is it possible to fit a GAMM(Generalized Additive Mixed Model) for zero-inflated data in R? If not, is it possible to fit a GAM(Generalized Additive Model) for zero-inflated data with a negative ...
207 views

### Are GAM models linear in the parameters?

Consider a GAM model, expressed in mgcv just to fix ideas: my_model <- gam(y ~ ti(x1)+ti(x2) + ti(x1, x2), method= "REML") ...
1k views

### Build a covariance matrix for GAM

I am using a GAM in R to compare time series data from 3 countries. The data sets are of hourly measurements for one year. The main aim here is to show when at which time of the day and day of the ...
2k views

### How to summarize GAM model result from multiple imputation data in R

I am very new to R and not very experienced in statistics. I have this general question regarding applying Generalized Additive Models (GAM) in multiple imputation dataset. I used R package mice for ...
991 views

1k views

### gam smoother vs parametric term (concurvity difference)

I have a gam model that is: gam=gam(sv~s(day,bs="tp")+s(range,bs="tp")+s(time,bs="cc"),data=train.all,gamma=1.4,method="REML") the ...
400 views

### Sum to Zero Constraint GAM Factor Interaction

I was under the impression that the smooths fit with mgcv were made identifiable through a sum to zero constraint - i.e. if one was to sum the smooth over the ...
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 ...