Questions tagged [generalized-additive-model]
Generalized additive models (GAMs) are regressions that estimate nonlinear patterns in data. This tag should not be used with the `glm` tag unless the question explicitly deals with comparison of the GAMs with GLMs.
1,117 questions
0
votes
0
answers
2
views
Accounting for temporal autocorrelation with irregular time lags with GAM model in R
I am running a GAM model with bam in the mgcv package in R.
The dataset in the model is calculated from mean hourly speeds for individual fish from position data (x,y, datetime).
...
1
vote
0
answers
19
views
HGAM GAM (mgcv, gam, bam) time series with environmental predictors: Combining Temporal and Environmental Smooths in Hierarchical GAMs
I’m working with hierarchical GAMs (HGAMs) in mgcv (using gam and eventually bam), and I’ve been testing how far I can extend the model while still keeping the results interpretable.
My goal is to ...
3
votes
1
answer
106
views
Interpreting negative REML values in generalized additive models (GAMs)
While fairly new to GAMs, I have fit a number of them recently using REML, and just obtained negative REML scores for the first time.
I have read that when comparing models based on REML, the best ...
0
votes
0
answers
44
views
GAMM model with corCAR1() run-time?
I am running a GAMM model to look at the effect of temperature on the daily patterns (in radians) of an animal's movement (step length). The data is hourly, however there are individuals with hours, ...
0
votes
0
answers
9
views
5
votes
0
answers
106
views
When should I use which smooth/spline in GAMs (for non-mathematicians)?
I delved a bit deeper lately into GAMs and I have the feeling, the more I go into detail the more questions are popping up (well, as usual, I'd say).
I recognized here and there, that there are plenty ...
1
vote
1
answer
76
views
(simulated) residual check for binary GAMM
I've got a dataset describing the infestation of an insect on plants in a very large area. The data were collected using several transects. Each transect is composed of 4 plots, with multiple plants ...
2
votes
0
answers
25
views
comparing smooths in smooth-factor interaction: can I include the intercept?
It might be a bold question, but I wanted to be sure that I am on the right track with my thoughts, since I am no mathematician or something close :)
When using GAMs with a smooth-factor interaction, ...
1
vote
0
answers
13
views
Significance testing between smooths in GAM (bs = 'fs') using emmeans [closed]
I have a GAM model built as:
...
3
votes
0
answers
78
views
Partial "R2" or Deviance Explained for GAMs?
Recently, I was asked about the partial R2 of predictors or how much each term contributes to the overall explanatory "power" of the model. I think it was a question stemming from the ...
5
votes
2
answers
113
views
Drawing Conclusions from a Model with Poor Residuals
I’m working with a GAM to predict bulk density (BD) as a function of depth, soil type, and land cover. The model includes a random effect for the source of the observations (SOURCE).
After checking ...
0
votes
0
answers
38
views
specification of hierarchical GAMs with ti() interactions
I have a survival model for a long term mark-recap study that I am trying to apply to several populations. I have been trying to follow Pedersen et al 2019 for this, but I have variables for which I ...
0
votes
0
answers
14
views
Modeling whether age modulates within-subject condition differences using bam() in R
I have trial-level data from 329 participants aged 18–79. Each participant completed 90 trials of an association task.
Each trial includes:
a within-subject factor Condition (3 levels: A, B, C; 30 ...
0
votes
0
answers
52
views
Dealing with high concurvity and variable selection in GAMMs with imbalanced data (mgcv::bam)
I am using GAMMs to model the probability of occurrence of a species, applying logistic regressions with mgcv::bam() to presence-pseudoabsence data. The dataset ...
5
votes
2
answers
476
views
Why do we say that we model the rate instead of counts if offset is included?
I am fitting the following GAM model. My response variable is aggregated counts of disease incidence at the county-level. I used log(population) as an offset. If I use it this way, I learned that it ...
0
votes
0
answers
44
views
Hierarchical GAM: gam.check small k-index p-value, no acf issues
I fit the following hierarchical gam. My response variable here is Foliar total phosphorus. I have about 20 years of annual data (no gaps) and about 3-5 replicates (collections) per site. I wanted to ...
4
votes
1
answer
86
views
Three-way Interactions within GAMMs and appropriate follow-up analyses
I have a dataset of brain signals that were recorded simultaneously from several brain regions while participants performed a cognitive task. I have two categorical predictors (recording site, ...
1
vote
0
answers
91
views
Comparing significant differences between GAM predictions along a continuous dimension
I am working with a GAM model to study how land cover (LC_L1_factor) affects bulk density (BD) with depth (DEPTH_M):
...
0
votes
0
answers
33
views
Three-Level Hierarchical GAM
I’m fitting hierarchical generalized additive model (HGAMs) to model temporal trends while accounting for nested structure in the data.
The goal here is to specify Site nested within Basin. The model ...
0
votes
0
answers
50
views
Detecting periods of significant change in a hierarchical GAM (HGAM) (Tweedie, log link)
Goal: Annual TP at 4 sites (18 years, ~3 plots per site per year). I fit a hierarchical GAM with a global smooth over Year plus site-specific smooths (factor–smooth interaction). I want to identify ...
0
votes
0
answers
42
views
Unaccounted for residual dependence in hierarchical GAM
I'm in need of some advice on how to account for residual dependence in a fitted GAM that doesn't appear to be driven by temporal structure in the data.
In summary, I am working with a long-term ...
4
votes
1
answer
122
views
Using GAMs and Checking for Autocorrelation in Time Series Data
I’ve been running Generalized Additive Models (GAMs) to explore temporal trends in my soil phosphorus data. I have 20 years of data at each site. I'm considering either modeling individual GAMs for ...
1
vote
0
answers
84
views
Can the random effect estimates of a GAM model be used for developing risk maps?
I have implemented the following model using mgcv package
...
6
votes
1
answer
142
views
GAMM with a global smooth term and site-specific deviations with concurvity present (mgcv::gam())
I’m fitting generalized additive mixed models in R (mgcv::gam()) to study how productivity changes over time across multiple Locations.
Each Location has repeated measurements from several plots. I ...
5
votes
1
answer
188
views
Why do GAMM partial effects have such different scales across distributions (Tweedie vs Gaussian)?
I’m fitting generalized additive mixed models (GAMMs) using mgcv::gam() in R, and I’ve run into a question about the scale of model outputs.
The goal of my analysis ...
3
votes
0
answers
96
views
Re-calculate GAM p-values to reflect uncertainty in the smoothing parameter
This is a re-post of my question here (has votes to migrate, but also required data). I can delete this version and follow instructions to migrate my OP properly, if that's preferred.
This is more of ...
7
votes
1
answer
235
views
How to describe the effect of a term in a GAM with contradictory edf and p-values?
I remember learning that $p$-values from the summary() output are only approximate for generalized additive models (GAMs), but these results are a bit ...
0
votes
0
answers
39
views
Advice for gam diagnostics and the model itself
I'm using the mgcv package playing around with the gam fits to my data. The following question I am trying to answer is whether the animal behaviour between the ...
1
vote
0
answers
72
views
Predicting population-level effects of a hierarchical GAM with both a global smoother and group-level factor-smooth interaction term
I am having difficulty making population-level model predictions on the response scale for a hierarchical binomial generalized additive model (GAM) that contains both a "global smoother" ...
0
votes
0
answers
31
views
Understanding outputs, should we calibrate probabilities obtained in logistic regression models such as GAM INLA?
I am developing a species distribution model for a rare, data-scarce species. To explore the effect of sample prevalence, I fitted several models with different presence–absence ratios by randomly ...
0
votes
0
answers
53
views
Ensuring continuity between two ordinal brms GAMs before and after heat stress peak
I’m working on a Bayesian ordinal regression model using brms to estimate coral bleaching severity levels (4 categories: None, Mild, Moderate, Severe) based on thermal stress.
My data consists of two ...
3
votes
1
answer
107
views
Propagating uncertainty while calculating cumulative timeseries data (negative binomial error distribution)
I am trying to appropriately propagate uncertainty from my predicted datasets following a GAM model. Essentially, I have weekly counts of data (i.e., egg counts), but want to calculate cumulative ...
1
vote
1
answer
81
views
How to correctly specify family, k and random effects for a GAM in the mgcv package
I am currently attempting to model the effects of land management on ecosystem stability. As an example I use deviations from a long-term mean in plant productivity as my response variable (numeric, ...
9
votes
3
answers
479
views
How to handle compositional data as covariates in a model?
Can individual components of compositional data be made into separate covariates in a single model? I want to use average seagrass cover by species as covariates to separate the effects by species of ...
3
votes
1
answer
71
views
F statistic for spline terms in generalized additive model
I am performing a regression analysis using a generalized additive model, 2 spline terms and 12 linear terms. When I use the summary(gam_model) command, I get some F statistics for my 2 spline terms. ...
4
votes
1
answer
125
views
Interpreting large partial effects in GAMMs with mgcv and FSSgam
I’m working on a project that models species distribution and co-occurrence using full-subset generalized additive mixed models (GAMMs) in R, specifically with the mgcv and FSSgam packages. I’ve ...
1
vote
0
answers
49
views
How to address offset for pseudoabsences in a logistical gam
I am trying to run a logistical GAM of probability of occurrence for several fish species from recreational fishing data using the mgcv package in R. The model uses different oceanographic variables ...
3
votes
1
answer
137
views
Why does partialling out fixed effects, give a different results in GAM mgcv?
For baseline I run an OLS with several covariates and high dimensional fixed effects. I also want to run GAM to check if one specific term has a non-linear effect. To do so I first tried with a full ...
1
vote
0
answers
112
views
GAMMs in R: How to interpret global term when concurvity with group-level smoother is present?
I've fixed my model and incorporated all the terms I believe have an effect on my response (abundance of a single species), but I'm stuck on how to interpret the long-term trend plot, ...
6
votes
1
answer
205
views
Natural generalization error measure for GAM models
In many regression settings where we minimize a loss function directly (e.g., squared error in linear regression), the performance measure flows naturally from the loss function used during training. ...
0
votes
0
answers
100
views
Model diagnostics for GAM (Generalised Additive Model)
I am using GAM with the mgcv package in R to predict a discrete variable scaled to [0, 1]. The variable was under a beta distribution (checked with ...
1
vote
1
answer
146
views
R: How to interpret my temporal variogram?
This is a follow-up question to my last one (larger dataset found here). I was able to code a variogram (gstat::variogram()), but the resultant plot is a bit ...
1
vote
1
answer
102
views
generalized additive model equation form and assumptions confusion
I am writing a model equation for a generalized additive model that I am using. I have a continuous response variable (not necessarily normally distributed) and I have 14 predictor variables. Let's ...
2
votes
0
answers
90
views
Can we use REML in a gam for binary outcome?
I am developing a prediction model to predict a binary outcome. I am fitting this as a gam in the R package mgcv. All predictors are fitted as smooth terms, including random effects.
Is it advisable ...
2
votes
0
answers
105
views
How to Perform Cross-Validation for LASSO in GAMLSS to Find Optimal $\lambda$?
I am working with a Generalized Additive Model for Location, Scale, and Shape (GAMLSS) and trying to determine the optimal $\lambda$ values for LASSO-penalized regression using cross-validation. ...
2
votes
1
answer
78
views
Why is term.plot(mod, what = "mu") centered around 0 in GAMLSS?
I am using GAMLSS with family = NBI() and modeling $\mu$ and $\sigma$ as smooth functions of $x$. The true data-generating process for $\mu$ is $\mu = \exp(1 + 0.3x)...
1
vote
2
answers
131
views
How to compare the effect strength of two predictors on a response across different Sites/Years in either GLM or GAM?
My main goal is to compare the effect strength of two predictors ($X_1$ and $X_2$) on a response across different Sites/Years in either GLM or GAM. This leads to specific sub-questions related to my ...
8
votes
1
answer
269
views
Using splines in gamlss with LASSO - Is it sensible?
I'm currently working with Generalized Additive Models for Location, Scale, and Shape (GAMLSS) and considering incorporating LASSO regularization. However, I'm wondering whether it even makes sense to ...
4
votes
2
answers
133
views
Is hurdle GAM analysis appropriate for this data?
I have a very small dataset of seabird count data (12 observations/28 samples prions, 22/28 shearwaters, 12/22 storm petrels) and am interested in the association of these taxa and zooplankton ...
6
votes
1
answer
181
views
Generalized Additive Model with phylogenetic penalty
I would like to fit a GAM that controls for phylogenetic relatedness among observations. I found and adopted this blog post by Nicholas Clark which introduces phylogenetic relationships by adding the ...