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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
29 views

Derivative-based effect size for Gaussian GAMs

It is often the realistic advice I have seen here that Gaussian GAMs are not regressions with which you can easily approximate an effect size for, as the effects are of course non-linear. However, we ...
Shawn Hemelstrand's user avatar
0 votes
0 answers
24 views

When is partial autocorrelation is important, but not the full autocorrelation?

I am modelling changes in diversity (using a modified Shannon-Weiner index over time for several sites) with a GAM. When I look at the acf and pacf plots, I don't see much autocorrelation in the acf ...
tnt's user avatar
  • 197
0 votes
0 answers
30 views

Is it possible to correct a zero inflated explanatory variables in a GAM?

I am trying to fit a GAM to model a presence/absence of marine mammals in function of temporal and environmental variables using MGCV (hence using binomial distribution). My 'precipitation' ...
Patou's user avatar
  • 1
2 votes
1 answer
51 views

GAM - factor smooth and main effects for both variables?

I am working with data on cuteness judgements and size judgments for differently named fantasy creatures. The interesting part ...
odaxom's user avatar
  • 23
0 votes
1 answer
39 views

How to derive the combined frequency distribution from two independent normally distributed population?

We have two different independent internal function calls for an application module, max of the time taken by two function calls individually determines how much the overall module takes. Individually,...
Satyajit Paul's user avatar
3 votes
1 answer
112 views

Zero- and one-inflated beta GAMM (Generalized additive mixed model) in mgcv

I have vegetation cover (%) data [0,1] that includes 0's and 1's that I'd like to model with a beta GAMM, but don't understand the method for doing so. I've read that if the data includes 0's and 1's ...
Nate's user avatar
  • 1,041
0 votes
0 answers
15 views

GAM posterior simulation for bird population trend

Background This is a follow-up on my last post. I have a GAM of presence of a bird species from a large dataset. There are over 400 sites in my data, where each site corresponds to a unique observer. ...
g-bridge's user avatar
  • 173
1 vote
1 answer
59 views

choice of m (order of derivative) for MGCV splines

I am working on a project that aims to estimate the association between a certain marker in blood and risk of an adverse cardiovascular outcome. Conventionally, a clinical threshold for the marker has ...
dean's user avatar
  • 169
7 votes
1 answer
378 views

Random wiggly smooths for 100s of factor levels

I have a GAM of presence of a bird species from a large dataset. There are over 400 sites in my data, where each site corresponds to a unique observer. Site-level variation is the biggest source of ...
g-bridge's user avatar
  • 173
1 vote
0 answers
26 views

Hierarchical partitioning for GAM model?

I am fitting a gam model with multiple environmental factors as predictors (actual evapotranspiration, climate water deficit, wind speed, etc). My goal is to understand how each one of them contribute ...
salomon_user's user avatar
1 vote
0 answers
12 views

Multinomial gam diagnostic help

I have created a Generalized additive model of a multinomial distribution using the mgcv package, I have used check.gam to do some diagnostic tests but they look ...
G_man932's user avatar
0 votes
0 answers
25 views

Tiny partial effects but high R² in GAMs - and the other way around

I am currently running GAMs with mgcv package and am trying to find a good one by looking at summary() and the visual outputs ...
user_20201213's user avatar
0 votes
0 answers
12 views

Why would you smooth a logical variable in a GAM?

I just used the gam.scope function in the R-package gam to create possible scopes of each explanatory variable of my model to ...
Lena Ortega's user avatar
1 vote
1 answer
45 views

Adding predictor variables to hurdle model

I am trying to build GAMs to understand the detectability of two cetacean species using acoustic and visual data. For now, I am running three separate models (All detections (encounters), Acoustic ...
Isha B's user avatar
  • 111
0 votes
0 answers
47 views

Autocorrelation and other problems modeling pupillometry with bam() from mgcv

TLDR: Model shows autocorrelation and non-normality in the residual plots even after AR1 and attempting to control for autocorrelation in parameters; I have a non-continuous time variable (it makes ...
cekoolh's user avatar
1 vote
1 answer
84 views

Use a GLM/GAM model with Gamma family & identity link despite warning?

What I have tried and done so far: I am running GLMs and GAMs on my positive, continuous response variable. I have determined that the Gamma distribution would fit my data best by plotting various QQ ...
user_20201213's user avatar
0 votes
0 answers
18 views

GAM: smooth interaction with factor that depends on second factor

I have the following scenario I'm trying to model with mgcv::gam. I have a continuous explanatory variable X whose response depends on factor A. However, That X*A ...
Anke's user avatar
  • 241
0 votes
0 answers
16 views

Multiple treatment group comparisons in a Generative Additive Mixed Model

I've fitted a GAMM using the mgcv package in R to some time course data from a biological experiment, with multiple drug treatment groups and a vehicle control ...
damtheduck's user avatar
2 votes
1 answer
41 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
0 answers
9 views

How to relate prevalence to factors with multivariate analyses model (GAM beta inflated)?

While analizing the prevalence of cows to brucellosis (illness), and in order to relate it to a set of factors like country, state, and detection technique, I need to apply a multivariate analysis ...
Adonis Cedeño's user avatar
0 votes
0 answers
27 views

How to visualise parametric interaction effect in GAM in R?

I have a GAM with a smooth term (s(x2)), a factor-smooth-interaction (s(x1, fac3, bs = "fs")) a random effect (...
J. S.'s user avatar
  • 1
1 vote
0 answers
22 views

Univariate vs. multivariate gam output

I'm new to GAMs and running some univariate and multivariate models in R with mgcv. I'm struggling to understand differences in model output between the uni and mulivariate. Ex: A plot for a ...
Lmack101010's user avatar
1 vote
1 answer
42 views

GAM on values per cell in a grid cell

I am running a GAM model on grid-cell data at a 1Km spatial resolution ~89K cells. My response variable is species richness, and I use a tw() distribution as it ...
Jess's user avatar
  • 11
0 votes
0 answers
41 views

GAM: mgcv model with kurtosis: Does this need to be solved and how?

I am trying to model CO2 fluxes (fco2) using a number of environmental parameters using a GAM in mgcv. Specifically, I have leaf temperature (tl), vapour pressure deficit (vpd), and transpiration (tr)....
J-M's user avatar
  • 23
0 votes
0 answers
35 views

Post-hoc test for GAMMs

I am analyzing my data with a generalized additive mixed model (GAMM) with the following structure: y ~ Var1 + s(Var2) + s(Var3, bs="re") Var1 is a ...
Teresa's user avatar
  • 1
2 votes
1 answer
68 views

mgcv: Use of s() or te() with interactions in GAMs?

I am trying to model CO2 fluxes (fco2) using a number of environmental parameters using a GAM in mgcv. Specifically, I have leaf temperature (tl), vapour pressure deficit (vpd), and soil water content ...
J-M's user avatar
  • 23
1 vote
0 answers
24 views

How to fit a GAM including continuous and categorical variables

I have data on number of seedlings, sapling and adults of 8 tree species along elevation gradient on two aspects (north- and south-facing) at two sites. On each aspect, the elevation gradient was ...
Zafar A Reshi's user avatar
0 votes
0 answers
20 views

GAM fit on single smooth won't predict above a certain horizontal threshold

I'm a beginner to fitting GAM's. I'm just using a simple formula to fit a GAM using mgcv in R: ...
Michael Anderson's user avatar
0 votes
0 answers
121 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
0 votes
0 answers
40 views

Why do I get NaN p values in some variables when using mgcv to fit generalized additive mixed models?

I am currently trying to fit milk production data collected for three years by using generalized additive mixed model through mgcv package. The problem is, I am getting NaN p values in some variables. ...
Zainab Hassan's user avatar
0 votes
0 answers
15 views

Missing data/ uncertainty in GAMM Random Effect variable

I am facing an issue with a GAMM that I am attempting to fit. I am modeling fish catch in response to several variables (see model below). I am using the mgcv's gamm() function to do so. ...
megsruppUNBC's user avatar
0 votes
0 answers
33 views

How to perform ridge penalisation on an interaction between discrete and continuous variables in `mgcv`?

Using the paraPen term and gamma to control how much penalisation, what is the correct structure of penalty matrix input for <...
jmellor's user avatar
3 votes
1 answer
182 views

GAM negative binomial model improved by log-transforming the dependent variable

I fit a negative binomial GAM model with the R mgcv package. I noticed some heteroskedasticity in the fitted vs response plots. Then I noticed that if I log transform the dependent variable before ...
kk68's user avatar
  • 141
1 vote
0 answers
47 views

Analyzing the impact of a binary variable on ordinal response by various levels of a continuous variable using the mgcv package for gam model

There is a dataset consisting of 1100 in vitro fertilization cycles from 800 patients, indicating that some patients have undergone more than two cycles. The dataset contains 1100 rows. Each cycle ...
insan's user avatar
  • 85
2 votes
1 answer
41 views

Recovering nonlinear functional effects (in a GAM framework) using spline design matrices

I designed a simulation example to understand how splines can work in modeling non-linear functional effects of covariates in a regression framework. I generated the data from the following model: $$ ...
hbaghishani's user avatar
2 votes
1 answer
108 views

In R/mgcv, what's the difference between s(x) + s(y) + ti(x, y), and ti(x) + ti(y) + ti(x, y)

I have a continuous variable and a factor variable, and would like to build a tensor product interaction between the two with a cubic regression spline ...
Fred's user avatar
  • 567
1 vote
1 answer
79 views

How to get model fit from GAM with ordered categorical data?

I am using a GAM with ordered categorial data to estimate temporal trends in shifts from one category to another. I would like to add the model fit to my data, but I don't know what to do with what I ...
mluerig's user avatar
  • 681
1 vote
1 answer
49 views

Understanding Identifiability problem of multiple smooths in GAMs/Additive models

I am a beginner into additive models and GAMs, but have good enough knowledge of linear regression. I was going through this wikipedia article to understand more, but can't seem to understand the ...
user101874's user avatar
0 votes
0 answers
39 views

How are the TPRS functions estimated in GAM using the mgcv package in R? [duplicate]

I have generated a dataset with two covariates x1 and x2 and have fitted a gam model with k=5. The R code is as follows: ...
T_S's user avatar
  • 21
5 votes
1 answer
230 views

Power analysis for GAMM

Question I am struggling with understanding how to run a simulated power analysis for GAMMs. Though my planned studies will include more variables, the core issue I'm trying to work out is to simulate ...
Shawn Hemelstrand's user avatar
6 votes
2 answers
536 views

Building the right GAM model. Struggling with the jump from lmer()

I have I have no experience with gam() but I think this is the right way to model my data. Sample data: ...
Simen Leithe Tajet's user avatar
0 votes
0 answers
25 views

Theoretical question about GAM (generalized additive models)

I'm new to GAM so please be patient with me. This is a theoretical question rather than a coding question. I have a model as follows: response variable (y) = insect abundance; Disturbance type (...
Bugguy's user avatar
  • 1
2 votes
1 answer
113 views

Is Tweedie distribution appropriate for right skewed, continuous, positive response variable with many zeros?

I have a continuous response variable representing plant disease severity, with values ranging from 0 to 5. The R unique function shows the following values in my ...
Ahsk's user avatar
  • 319
0 votes
0 answers
57 views

Temporal and predictive GAMs in time series analysis

I have several long time series (60 years) of meteorological and soil-related variables. My goal is to analyze the temporal dimension of each variable separately, fill in the gaps in the dataset using ...
Paco Herrera's user avatar
1 vote
1 answer
86 views

How to choose theta θ thresholds for ocat family in mgcv package. (ordinal regression)

I have a dependent variable named "FGR" which represents a ratio and takes values between 0 and +Inf. The histogram plot below illustrates the distribution of FGR, excluding +Infinite values ...
insan's user avatar
  • 85
3 votes
1 answer
94 views

A random effect nested in another random effect in R with mgcv package

I am interested in examining the relationship between yearly income and student success, taking into account the hierarchical structure of the data. The data includes schools as random effects, with ...
insan's user avatar
  • 85
0 votes
0 answers
33 views

Modeling a Random Effect nested in another random effect in R using the mgcv Package

I have a dataset consisting of 1000 in-vitro fertilization (IVF) cycles from a total of 700 patients. Each cycle has several variables, including; the total number of follicles the patient had in ...
insan's user avatar
  • 85
1 vote
0 answers
98 views

GAM plots: partial effects, shifted y-axis, or predictions - which representations/interpretations are correct/accurate?

I have two GAMs fitted with a Gamma distribution, with the same model structure with a continuous response variable and one continuous covariate, two categorical covariates, and one random effect: <...
mto23's user avatar
  • 607
2 votes
0 answers
38 views

GAM partial response plot interpretation

I've made the gam in the code below (in R), but I'm struggling to interpret the results. Specifically, the partial response plots for all but one of the variables is linear, and the CI lines cross in ...
blitz1259's user avatar
0 votes
0 answers
40 views

How to determine if an interaction is warranted (in a generalized additive mixed model (GAMM))

I'm interested in determining if an interaction exists between my continuous (SL) and factor (fZone) covariate as it has some basis in biology. An anova() and BIC suggest no interaction is needed, but ...
Nate's user avatar
  • 1,041

1
2 3 4 5
19