Questions tagged [mgcv]
mgcv is a R package for mixed GAM computation vehicle with GCV/AIC/REML smoothness estimation.
507
questions
2
votes
0
answers
33
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 ...
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 ...
2
votes
1
answer
52
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 ...
3
votes
1
answer
113
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 ...
0
votes
0
answers
16
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. ...
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 ...
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 ...
1
vote
0
answers
28
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 ...
1
vote
0
answers
13
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 ...
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 ...
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 ...
0
votes
0
answers
49
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 ...
1
vote
0
answers
36
views
Using emmeans with GAM Model: Testing Group Differences on Specific Days
I'm analyzing data from an experiment involving 3 different groups that were observed over a period of 120 days, with data collected every 5 days. I fit a GAM to capture the temporal dynamics and I ...
1
vote
1
answer
85
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 ...
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 ...
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 (...
1
vote
0
answers
24
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 ...
1
vote
1
answer
37
views
Extract random effects from gamm with mgcv
Hi I've started fitting simple gams with random intercepts using mgcv and bs='re', but I can't seem to find how to extract the conditional modes/random effects/BLUPs for each level of my factor. ie ...
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)....
1
vote
0
answers
39
views
I get the following error in R when using mgcv package no applicable method for 'smooth.construct' applied [closed]
I am trying to use a gam function (mgcv package) to decompose the response variable pulse voltage into a combination of polynomial and exponential components.
I get the following error:
...
2
votes
1
answer
72
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 ...
1
vote
0
answers
44
views
Spatio-temporal predictions with GAMs
I am using R package mgcv to model spatio-temporal variation in an ecological variable (y). I have data for "y" from across 8 years, and from >2000 locations across the United Kingdom. I ...
0
votes
0
answers
36
views
How to address the heteroskedasticity and non-normality of my residuals in my model?
My study is about the influence of board diversity (gender and age) and fund size on the voting behavior of pension funds. I have also included control variables that concern the board type, board ...
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:
...
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 ...
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. ...
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 <...
1
vote
0
answers
48
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 ...
2
votes
1
answer
112
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 ...
1
vote
1
answer
84
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 ...
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:
...
5
votes
1
answer
231
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 ...
0
votes
0
answers
58
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 ...
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
...
3
votes
1
answer
95
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 ...
0
votes
0
answers
34
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 ...
0
votes
0
answers
22
views
Why am I missing the result of a smoothing effect in a GAMM while interpreting results from summary command
I have been using GAMMs to analyze time series data and I have included a smoothing term (hour of day by season) and I can't seem to find the results for the winter season. I have the proper ...
0
votes
1
answer
78
views
Termplots in GAMLSS
I am interested in plotting the marginal effects in my GAMLSS model. However, what puzzles me a bit is that when using the term.plot() function from the ...
0
votes
0
answers
41
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 ...
0
votes
0
answers
27
views
Why are there two different scale estimates in GAM model with mgcv
Im am doing some modelling with the mgcv package, specifically the gam function
...
2
votes
1
answer
100
views
Seasonal GAM: are correlation structures needed?
I am currently modellingusing the 'mgcv' package in R. My response variable is called log.tr, representing the log of residence time. My data looks a little bit like this:
...
0
votes
1
answer
38
views
What is the reference edf for generalized additive models?
From the summary of my fitted generalized additve model (gam) I see two edfs. The first edf is the model edf and second is the reference edf.
However, for AIC estimation, the reference edf is used. ...
0
votes
0
answers
17
views
Interpretation of Changes introduced by ti() in Logistic GAM Modeling
I am currently working on a logistic regression model using the mgcv package.
The mode contains 3 variables (x1 and x2, continuous) and x3 (categorical) and I believe there is interaction between the ...
0
votes
0
answers
16
views
Must an alpha=0.01 be used to interpret significance of parametric terms in a GAM?
I have fit a time-series count HGAM with environmental covariates as parametric terms and year as a site-varying smooth term. I am wondering if I need to use an alpha threshold of 0.01 to interpret ...
4
votes
1
answer
268
views
How 'by' factor works with 'fs' random smooth in gam?
I've a large dataset including a response bmk, a continuous predictor delay, a group factor (...
2
votes
1
answer
59
views
GAM Parameter Estimates and Shrinkage
I run the following GAM model in R using the mgcv pacakge:
...
1
vote
1
answer
147
views
Predicting mean smooth in GAM with multiple continuous and categorical "by" variables
I use a GAM to model interactions between two continuous and one unordered categorical factor with three levels. Depending on significance of the smooth terms I would like to extract and visualize ...
1
vote
1
answer
61
views
Hierarchical gam (HGAM) with 'by' ordered factor and random smooth 'fs' effect: why so wiggly?
Following the same m3 model approach proposed by Gavin Simpson on my data, I compared an ordered factor model (m3_of) to a non-ordered factor model (m3). The global shapes trend to be similar; however ...
0
votes
1
answer
37
views
Non-linear formulas in mgcv
in brms (which is heavily based on mgcv) there is a possibility to define non-linear formulas (meaning not linear in parameters). However, for different reasons I need to use mgcv.
E.g. the model
<...
2
votes
1
answer
137
views
GAM - parametric coefficients - what is mgcViz::pterm() actually plotting?
I built a GAM with two categorical variables and two smooth terms, following this structure:
...