Questions tagged [mgcv]
mgcv is a R package for mixed GAM computation vehicle with GCV/AIC/REML smoothness estimation. Use this tag for any on-topic question that (a) involves mgcv either as a critical part of the question or expected answer, & (b) is not just about how to use mgcv or R.
651 questions
0 votes
0 answers
43 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, ...
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
24 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, ...
3 votes
0 answers
76 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 ...
3 votes
1 answer
173 views
Can I use a GAM for my data even though it's almost binary?
I’m working on my master’s thesis and decided in advance to use a GAM (using mgcv in R). I won't have a lot of data, but I think just enough to model it and just note that there are strong limitations ...
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
51 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
469 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
85 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, ...
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
112 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 ...