R package to fit generalized additive mixed models (GAMM) using mgcv and lme4 packages.
Questions tagged [gamm4]
47 questions
12
votes
0 answers
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 I want to see how "speedChange" correlates with…

nan
- 905
- 2
- 10
- 19
8
votes
1 answer
QR factorization and linear regression
I have been reading "Generalized Additive Models an Introduction with R" by Simon Wood and have come across a section I'm having trouble with. On page 13 it is stated that the model or design matrix
$X$ can always be decomposed into
$$X = Q…

Ian
- 351
- 3
- 8
6
votes
1 answer
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 timeCS) in relation to several predictor variables: maximum temperature (maxT), species…

akandes
- 71
- 4
5
votes
1 answer
Using a gamm4 model to predict estimates in new data
I have been experimenting with gamm4 to derive GAMMs of some repeated measures data.
The models looks very nice and seem to give more flexibility than my LMMs.
Ultimately I want to compare models not by the quality of their fit (also the reality of…

jusjosgra
- 181
- 1
- 5
5
votes
0 answers
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 summary function to our GAMs and GAMMs we got the R squared that inform about the quality of our…

C.Saavedra
- 51
- 1
- 5
5
votes
1 answer
Adding a variance structure when fitting a gamm with Gamma distribution
I am using the code below to fit a gamma GAMM introducing a variance structure that informs the model that variance of the response variable is much larger in one of the levels of the factor coast than in the other. I am using the gamma distribution…

Sandy
- 91
- 4
4
votes
2 answers
GAM with many binary factors
I am trying to model the blood glucose response at 15-minute intervals after a meal. The meal event has many continuous variables (like time of day, body weight, etc) and many binary variables (like butter, bread, breakfast, etc).
I have tried…

Dan
- 43
- 4
4
votes
1 answer
Presence/Absence GAMM with penalized smoother convergence/completion problem, data set too large
I am having issues running a GAMM to determine presence/absence with a very large data set (9,000,000 rows x 13 cols) using GAM4 in R. I think the data set may be too large and is causing convergence/completion issues. Does anyone have insight to…

matt b.
- 41
- 2
3
votes
1 answer
How to interpret non-signicant intercept but significant smooth terms with GAM in R?
I have the following gam model:
m1 <- gam(Y ~ s(Age, bs = 'ad', k = -1) + Sex + ti(Age, by = Sex, bs ='fs'),
data = DF,
method = 'REML',
family = gaussian)
I chose adaptive functions because this is physiological…

CanyonView
- 239
- 2
- 9
3
votes
1 answer
Basis dimension (k) too low for the smooth term in a GAMM
I am running a generalized additive model (GAM), but when I check the model diagnostics (using gam.check()) I run into problems. I have tried adjusting the value of k, but this isn't working. What am I missing?
Note that gam.check() lets you see if…

Blundering Ecologist
- 243
- 2
- 14
3
votes
1 answer
Specifying random effects using GAMM4
I am missing something when trying to specifiy random effects on Gamm4.
Reproducible example:
Consider the following simulated data:
library(gamm4)
library(ggplot2)
residualNoise <- 20
blockNoise<- 10
nBlocks <- 3
n<-100
df <-…

ramiro
- 101
- 3
3
votes
1 answer
GAMM with Zero-Inflated Negative Binomial - Looking for a package in R
I am looking for an R package to fit Generalized Additive Mixed Models (GAMMs) with ZINB distribution.
ZINB is not available in the mgcv package nor in the gamm4 package. I read here that it might be possible with the brms package, but I have never…

Circus pygargus
- 419
- 3
- 18
3
votes
0 answers
Help interpreting plot.gam in R (gamm4)
I'm not sure this question is better suited for Cross Validated or Stack Overflow, please don't hesitate to tell me if I ask it on the wrong forum. I'd appreciate some help interpreting what shows the result of plot.gam on a GAM object with random…

Kjian
- 253
- 1
- 9
2
votes
1 answer
What to do when GAMM is linear?
I have the following gamm4 output:
This is longitudinal data modeled as:
gamm4(Mean_DTI ~ s(Age) + Sex + Timepoint_yrs,
random = ~ (1 + Timepoint_yrs | ID),
data = DF)
I choose gamm because the data is…

CanyonView
- 239
- 2
- 9
2
votes
1 answer
AIC comparison of GAMM and LMM: Is it valid?
I have 2 models, using exactly the same variables, one fitted as a linear mixed model (LMM) and another fitted as a generalised additive mixed model (GAMM). I am interested in the fixed effect X and whether it is more appropriate (or just…

Roasty247
- 202
- 2
- 9