Skip to main content

Questions tagged [gamm4]

R package to fit generalized additive mixed models (GAMM) using mgcv and lme4 packages.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

"Fixed" effects when using mgcv and 'bs=fs' in GAMM?

I am curious what the most appropriate way to estimate both the overall/population level smooth effect of x while also estimating random smooths for different ...
Bart Larsen's user avatar
1 vote
0 answers
51 views

gamm and gamm4 give very different smooth term results for mixed models with factor-smooth interaction

I am analyzing an longitudinal dataset which has two groups (patient vs controls; ordered factor) with brain volume data over time. Participants entered the study at different ages and have varied ...
adrianneurosci's user avatar
3 votes
1 answer
100 views

Interpretation help of summary from basic GAM models with random smooths

I have run two GAM models to see if there is a non-linear relationship between my response variable (blood metabolites) and time. I'm currently accounting for individuals (ID_new) with a random smooth ...
Adam9's user avatar
  • 33
0 votes
1 answer
64 views

Nonparametric version of lme- gamm function in R

Is there a non-parametric version of a linear mixed model? I've seen some people cite gamm in R as one but unsure of how I would go about using it. In R, the code I ...
Kiara H's user avatar
0 votes
0 answers
21 views

Structuring new data when predicting via predict.merMod

I am trying to obtain predictions, given new data, from within a loop using the gamm4() function in the mgcv package of R. However, I run into an error message ...
Bill Shipley's user avatar
4 votes
1 answer
53 views

Obtaining, and manipulating, the prediction equation from a gamm model with smooth terms

I have read similar questions submitted here, and have looked in Wood's 2017 book (Generalized additive models: An introduction with R, 2nd edition) but cannot find an answer to my problem. To set up ...
Bill Shipley's user avatar
3 votes
0 answers
124 views

GAMs falsely suggest non-linear function (edf>2) for about 15-25% of simulated data?

I've been learning about GAMs and was curious about how sensitive they are to noise within a given sample. I know people generally say that GAMs are more prone to overfitting than GLMs and need to be ...
Victor Pokorny's user avatar
1 vote
0 answers
20 views

Properly set random effect of nested design in gam?

I have a set of insect traps, where I have counts of beetles per year. I have several records per each trap and year. I would like to estimate the number of beetles per trap, given several predictors. ...
maycca's user avatar
  • 355
2 votes
1 answer
178 views

High autocorrelation in GAMM

I am fitting a GAMM model to understand the evolution of fire elevation in time. I am using the mgcv package from R. My dataset contains 820 fires events with its corresponding elevation, time of ...
salomon_user's user avatar
0 votes
1 answer
33 views

How to analyse a response variable with a right-skewed QQplot and categorical predictors

I am trying to apply a model to my dataset. The way my response variable has been generated is a bit convoluted but it's been checked by my supervisor - I have strings of numbers (e.g 112222333322111) ...
lmnop's user avatar
  • 13
0 votes
0 answers
153 views

Problem fitting GAMM4 with interaction term: "fixed-effect model matrix is rank deficient so dropping 1 column / coefficient"

I am trying to use a gamm4() (mgcv package) equation to model 1) how brain regional volumes change over time and 2) how brain regional volume development differs between males and females. My data is ...
Jamie Roeske's user avatar
1 vote
0 answers
119 views

How to deal with collinearity or concurvity between fixed effect variables and random effect variables?

My current work involves asking subjects from different groups to pronounce multiple words, and I am interested in understanding the relationship between word duration and groups. In R syntax, this ...
C.K.'s user avatar
  • 131
3 votes
1 answer
85 views

Unable to extract AR(p) values from the GAMM function in mgcv

I am using generalized additive models in R with an correlated structure on the residuals, however I am unable to extract the actual coefficients of the AR(p) structure even though they are provide in ...
Warhawk1987's user avatar
0 votes
1 answer
129 views

GAMM4 models in R with either a continuous OR categorial variable in the smooth, and model comparison

To note: I am fairly new to GAMMs. I have read many StackExchange questions/answers and general documentation on GAMMs, and consistently question the proper way to set up my models to answer my ...
Missy's user avatar
  • 1
0 votes
0 answers
150 views

Calculate annual rates from the gam model over time?

I am trying to express the difference in the 'speed of increase' between two categories in gam modelling. My data represents the cumulative values over time [0-100%]...
maycca's user avatar
  • 355
4 votes
1 answer
851 views

Calculation of degrees of freedom for B-splines

I am confused about how the degrees of freedom in a B-spline are calculated in the package splines. The documentation for the B-spline function can be found here: https://www.rdocumentation.org/...
Brian M.'s user avatar
1 vote
0 answers
97 views

Calculating confidence intervals for gamm4 models [closed]

I am working with gamm4 models in my research and am having trouble understanding how to go about calculating confidence intervals for my models. EX model: m<-gamm4(turbidity~ year+discharge,data=...
Taylor's user avatar
  • 11
0 votes
1 answer
164 views

CIs for random intercepts from gam and stan_gamm4 are similar, but those from gamm4 are not. why?

Question: how can one obtain a good confidence interval for the estimated random effects from gamm4? Motivation: The example below, using binomial data with a random intercept, shows that estimated ...
Greg Dropkin's user avatar
2 votes
1 answer
566 views

Is my GAM modeling longitudinal change appropriately?

My data includes the following: Y which is a physiological measure Age continuous Gender ...
CanyonView's user avatar
2 votes
1 answer
167 views

What to do when GAMM is linear?

I have the following gamm4 output: This is longitudinal data modeled as: ...
CanyonView's user avatar
5 votes
1 answer
549 views

How to interpret non-signicant intercept but significant smooth terms with GAM in R?

I have the following gam model: ...
CanyonView's user avatar
3 votes
1 answer
533 views

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 ...
Roasty247's user avatar
  • 242
1 vote
0 answers
173 views

GAMM with BETAR(Link = "Logit") [closed]

I'm trying to use betar in gamm4 models but keep hitting an error. As far as I can tell, betar is one of the families that should be available - can anyone identify why I would keep hitting this error?...
Mooklie's user avatar
  • 11
1 vote
0 answers
211 views

Interpreting a GAM model output

I have been working on a GAM regressing model with interaction and the summary output have several parameter coefficient and also a some approximate significant of smooth terms. Do u need to interpret ...
Nicholas_K's user avatar
0 votes
2 answers
511 views

use GAMM models for full circular wind direction data

using a GAM modeling approach enables to include circular data as fixed effects. I wish to analyze the effect of wind on the flight behaviour of birds. In order to do so I want to add wind speed and ...
Some's user avatar
  • 1
4 votes
2 answers
581 views

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 ...
Dan's user avatar
  • 43
1 vote
0 answers
177 views

Decomposition of r square into fixed and random effect in a GAMM (mgcv)

for a paper I estimated a generalized additive model using R's mgcv. One reviewer now asks whether it would be possible to report a marginal and conditional r square instead of a global r square to &...
HolgerSteinmetz's user avatar
7 votes
1 answer
2k views

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 ...
Blundering Ecologist's user avatar
1 vote
0 answers
83 views

Times series forecasting , why predictions are the same over time

This is my first time posting here , I am doing an energy consumption forecast , my data contains the energy every hours I have two seasonality ,every 24 hours and every 7 days (daily and weekly). I ...
zemni houssem's user avatar
2 votes
0 answers
143 views

Adding interaction term with multiple variables in gamm4?

I am using gamm4 model from R package gamm4 (random slope=age_m, random intercept=FLEHS_ID and groupdescription): m1 I only look ...
Anran CAI's user avatar
2 votes
1 answer
260 views

Is GAM appropriate for these data

I am strangling to find the right modeling method for my data. Short explain of the dataset : I have a variable called alpha diversity ( Alpha diversity refers to the average species diversity in a ...
Anna Antonatou -Pappaioannou's user avatar
1 vote
0 answers
73 views

Error in X %*% diag(diagU[indi]) : non-conformable arguments with GAMM4 [closed]

I've started working with gams recently and I am having a bit of trouble with gamm. I built my model with the gam function and everything runs smoothly with the following code. gamtot <- gam(...
Albert's user avatar
  • 11
4 votes
1 answer
1k views

Specifying random effects using GAMM4

I am missing something when trying to specifiy random effects on Gamm4. Reproducible example: Consider the following simulated data: ...
ramiro's user avatar
  • 133
1 vote
1 answer
508 views

INTERPRETATION OF GRAPHIC RESULTS OF GAM IN R

Hello I am trying to adjust a GAM in R. I am new to GAM and I am trying to see the relationship that can exist through time in 57 river stations that are divided into Impacted and not previously ...
Cristian Perdomo's user avatar
2 votes
1 answer
954 views

How to interpret the plotted difference of in-factor smooths

I used the gamm4 R package to analyze the location effect on heart rate over time (Inc_age), including some linear co-variates and a random effect. My model looks like this: ...
MartjeLM's user avatar
1 vote
0 answers
331 views

Using and interpreting GAMMs

I have been struggling to fit a model using gamm4. context of my study I'm trying to fit a 'gamm binomial' to model the probability of having a new component in a group. In my data, components are ...
Mario's user avatar
  • 11
0 votes
0 answers
613 views

how to interpret the smoothed effect of time in GAMM models

I have recently taken a plunge into the world of Generalized Additive Mixed Models (GAMMs) after learning that including the quadratic and cubic fixed and random effects of time to understand students'...
Anne Ng's user avatar
  • 31
1 vote
0 answers
750 views

Negative binomial random effects models (glmmTMB/gamm/gamm4)

Can anyone help please. Am I missing something fundamental here? I would like to test for a Cave and a Category effect in the same model, and I'd like to know if I've specified the random effects ...
Lisa's user avatar
  • 33
1 vote
1 answer
318 views

Irregular time series with multiple sampling sites

I have a dataset of marine debris items (number of items standardized per effort: Items/(number of volunteers * Hours * Length)) taken from 2 main locations (WA and Queensland) in Australia (8 Sub ...
Catarina Serra Gonçalves's user avatar
2 votes
1 answer
2k views

Using gamm4 on zero-inflated count data with Tweedie or zero-inflated Poisson distributions

I'm working with a dataset with a large number of zero-counts on the response variable. This dataset consists of qualitatively coded interviews in a number of important categories, but many of the ...
lschar's user avatar
  • 21
2 votes
0 answers
105 views

gam/gamm when response variable is complex

I would like to fit a generalized additive mixed model using mgcv or gamm4, but have a response variable consisting of complex numbers where y=a+1i*b. Is this possible, and if so are there any special ...
sea83's user avatar
  • 31
3 votes
0 answers
857 views

Correct way to account for repeated measures and spatial autocorrelation in GAMM (R)

I am using the gamm function in the mgcv package in R to specify a model that predicts abundance with respect to elevation and year based on repeated measures from several sites. My overarching ...
Julie L's user avatar
  • 313
6 votes
1 answer
2k views

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 ...
akandes's user avatar
  • 71
7 votes
1 answer
3k views

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 ...
Circus pygargus's user avatar
1 vote
0 answers
64 views

Determine maxima and minima of fitted GAMM smooth

I have been using gamm4 to model the daily activity pattern of a certain behavior as a binomial response (whether the behavior occurs or not for each hour of the day). I am comparing the daily ...
user139351's user avatar
1 vote
1 answer
398 views

Does family 'ocat' work with gamm4 in R? [closed]

I am trying to fit a GAMM to ordered categorical data using gamm4 in R. In the help file for gamm4, it says the argument 'family'...
user206892's user avatar
2 votes
0 answers
1k views

Model Comparison of GAMs using gamm4

I am using a GAM from package gamm4 in R to fit a varying coefficient model for longitudinal data. I have data consisting of ...
user206892's user avatar
1 vote
1 answer
1k views

Gamm residuals patterns: temporal and spatial

I'm trying to fit a GAMM model with this dataset, which can be downloaded here: https://ufile.io/8umh6 . The dataset consists of 60 pixels sampled in two different areas: BAR and MON, 30 for each one. ...
Kol Rocket's user avatar
1 vote
2 answers
742 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 ...
F.Sivy's user avatar
  • 11
2 votes
1 answer
393 views

GAMM with fragmented spatial data - presence/absence response

Quite stuck so hope someone could help me in the right direction. Some background for the data: For the last 15 years data have been collected on a specific species during the period from early ...
Ken T's user avatar
  • 41