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

464 questions
Filter by
Sorted by
Tagged with
9 views

### How to compute derivatives and periods of change for interactions in GAMS?

I have been stuck in this problem for weeks, and I am not sure if I will be ever able to find a solution without your help. I am analyzing the relation between tweets and temperatures. I believe that ...
164 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 ...
25 views

### GAM factor smooth interaction--include main effect smooth?

I am working with a dataset it which I am interested in modeling an age*sex interaction in the GAMM framework. From examples I have seen and documentation I have read, this is typically accomplished ...
204 views

### Equivalence of random effects via likelihood and smoothed splines

Some fake data: X = runif(1000) ff = rep(1:10,100) E = rnorm(1000) y = x+e+f f = as.factor(ff) When you fit a model like ...
14 views

### Are residuals meaningful when using additive, robust, and regularization models on time series

If I am using additive models, regularization, or robust regression to model time series data, should I still check that the residuals have no autocorrelation and are stationary? I am under the ...
28 views

### implement lasso Regression in GAMs in R

Hello I search a way to select variables in a gam function R by using Lasso Regression. I already fitted a model gam(y~x) with x ...
20 views

### R: how to get effective degrees of freedom?

I'm building a sparse additive model and using the Generalized Cross Validation score for a linear smoother $\hat f(x) = L(x) \underline Y$ GCV(\lambda) = \frac 1n \sum_{i=1}^n \left( \frac{Y_i - \...
9 views

### intervention analysis with multivariate regression

Does intervention analysis make sense when one has multiple external regressors? How would one know if say, a level shift, is caused by a combination of external regressors or by a change in a law ...
61 views

### Should I be concerned about the warning message in model.matrix.default() - non-list contrasts argument ignored?

I am running a GAMM (mgcv package) with percentage/proportion as the dependent variable and a mixture of categorical and continuous variables, after running most of my models, this is the warning ...
22 views

### Include main effect when specifying varying coefficient models with GAMM?

I am trying to model an interaction between two continuous variables in the GAMM framework using gamm in R. For simplicity's sake, I am ignoring the repeated ...
39 views

### Is it possible to make this GAM even less smooth to generate a better fit?

I have done a logistic regression with two independent variables (x1 and x2) and a dependent binary variable (y). The AUC (roc curve) is 0.7915. The heatmap below shows the probabilities resulting ...
184 views

### General Additive Model problems with case-control data in r

I am trying to run the following code using R packages mgcv and survival: ...
25 views

### Why do my splines become not more flexible after altering the parameters in R mgcv?

I have done a logistic regression with two independent variables (x1 and x2) and a dependent binary variable (y). The AUC (roc curve) is 0.7915. After making a heatmap, I noticed the logistic ...
23 views

### Different machine learning models give contradictory results

I am relatively new to data analysis using machine learning and i got following problem while doing this machine learning problem. I have a data set with 80 features of 250 observations (rows) (but ...
12 views

### GAM betar, Deviance explained is more than 100%?

It is my first time using GAM, However I am having a challenging issue: I am getting “Deviance explained = 102%” and I don’t know how we suppose to interpret it.Does it relate to the warning message ...
230 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 ...
327 views

### Robust GAM that covers Gaussian distribution

I was looking at CrossValidate archives as well as r-archives and crantastic...for a package that has a robust approach to generalized additive models. I found two packages "robustgam" and "rgam" but ...
22 views

### Should I use Poisson or Gaussian family in GAM?

I would like to ask if I am right to use a Gaussian family in my GAM analysis. I have some count data of the number of animals captured per 100 traps, which is not normally distributed. Then I did a ...
63 views

### What is the acceptable level of concurvity?

I got the following concurvity values as a result of a GAM model. ¿are they high or low? I don't know what is the acceptable value... Thanks, Karla .
21 views

### Plotting summed effects of factor levels in interactions in a GAMM model

I am new in GAMM and I am analyzing a data to find the effect of year, tree species and their interaction on richness of insects on the trees. I expect that year will have an overall nonlinear effect. ...
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 ...
51 views

### Circular smooths within a GAM-GEE framework

I have a predictor variable which I fit in a GAM as a circular smooth term: ...
24 views

### Need to center continuous variables in GAMs?

This is just a quick question, but I remember reading somewhere that continuous variables used in splines for generalized additive models ought to be centered (especially for GAMs rather than just as ...
23 views

### Can someone explain me how cumulative association in distributed lag models works?

I'm trying to fit some distributed lag models with dlnm package in R. When I specify cumul=TRUE, I obtain extra parameters ...
44 views

### When to choose regression splines over smoothing splines? [duplicate]

I am currently studying how to model covariates beyond linearity in order to use them with GAMs for regression / classification purposes. Talking about splines, two types were presented: regression ...
16 views

### Potential use of GAM's in Python to evaluate dataset

I'm working with a dataset of >100k rows that includes 4 columns: ['Person','x_value','y_value','binary_response'] My goal is to able to run tests to evaluate ...
22 views

### solution to non linear correlations in glm

I'm doing a glm to test the relation between one variable with diferent climatic variables. Nothing is significative and I think maybe the problem is that the relation between the variables is not ...
37 views

### GAM discrete time survival prediction in R [closed]

So I've been trying to perform a discrete time survival analysis in R. I have been using the discSurv package to generate the augmented data matrix for the full ...
23 views

### what are the intercepts in mgcv's ordered-factor difference smooths?

I aim to plot the gam() model fit back on the original data. My impression was that gam() has special treatment for ordered ...
837 views

### Replace missing values in a continuous variable with some predefined number, possibly a negative number?

Is it an acceptable idea to replace missing values with some arbitrary negative number like -99 in a continuous variable that contains only zeros and positive values besides NAs? In my dataset I ...
23 views

### GAM goodness-of-fit under covariates shift

I have GAM models that were fitted using PyGAM and its defaults for fitting a linear GAM. To validate the model I do a leave-one-out cross-validation looking at either a Spearman's rank correlation ...
19 views

### GAM model residuals

I have a huge problem with my model. I did a GAM Model with negative binomial distribution (with mgcv library). Now I want to do an overdispersion test but I think that this doesn't exist for ...
2k views

### How to explain the gam plot to a non-statisticians

I have a GAM model to study the relationship between antibody titers at Cord (on the log scale) with the maternal antibody titers (on the log scale) and duration between vaccination and delivery. ...
10 views

### Confidence in model selection

I have a Gam model built for a time series study over 15 study sites for ecological analysis. I have run the model and I have a significant intercept, ecologically sound significant results, 55% ...
325 views

### using biomod2 package with continuous response variables

I am looking to correlate crop area with climate variables and then predict for future if suitability of crop areas will change/remain same under different climate scenarios (in line with species ...
28 views

### How does one intuitively interpret significance of splines/GAM term?

Consider the data dput here. I can predict y from x using a cubic spline: ...
26 views

### significance of difference smooths

I am working to understand what is represented by the standard errors and confidence intervals of smooths of ordered factors. In this toy example, I wish to determine (1) the overall form of the trend ...
23 views

### concurvity in presence of random smooths [closed]

I am trying to fit a GAMM containing per subject random smooths using the bam function in mgcv as follows: ...
181 views

### Getting better p-values for a gam model with multiple explanatory terms using bootstrapping

I'm running a GAMM in R on count data with multiple explanatory variables, including both continuous variables with smoothers and factors, a random effect, and a Poisson distribution using the gamm4 ...
409 views

### Different Interactions specifications with gamm

Could someone please explain how these two gamm from the mgcv package specifications differ? I am using the Owls data and first ...
512 views

### Confidence interval for the slope of a GAM

I need to fit a large number (thousands) of GAMs (using package mgcv in R with automated selection of smoothing terms, if that matters), and for each GAM I need to know whether the slope of the smooth ...
35 views

### Why does “ smooth term” have “parametric” effect?

I read a blog about Generalized Additive Model (GAM). In this blog, the author used summary(gam1), then some information is printed: ...
2k views

### GAM model summary: What is meant by “significance of smooth terms”?

I have dataset for which I am constructing a GAM model, with a number of factors predicting the dependent variable. When I take a summary of the model, I get a chart that indicates the "significance ...
35 views

### zero inflated presence absence binomial GAM in R

I am fitting a binomial GAM using mgcv in R. My data is presence (1)/ absence(0) of dolphin acoustic detections in 10 minute time windows over ~1 year period. However, I have only ~750 presences to ~...
36 views

### Is there a maximum number of independent variables for generalized additive model?

I noticed that we sometimes pick the indenpendent variables into the GAM model, but don't consider if we have add "too many" of them. For example, if I have a dataset with 100 observations, what is ...
480 views

### Can you extrapolate values of the dependent variable with a GAM?

I'm trying to find issues where GLMs are better than GAMs and came to the idea that GLMs can make predictions beyond the scope of the data used to feed the model (i.e, extrapolations), while GAMs ...
8 views

### Performing a GAM with correct error distribution and smoothing functions

I'm applying a GAM from package mgcv using two continuous explanatory variables with a binomial response. What would be the best error distribution to use (Family and link)?
45 views

### Application of GAM on large dataset

I was suggested that my questions were too broad. As I commented below, I have nearly a million data points and perhaps a hundred variables. This may be a very basic modeling question: I am curious to ...