Questions tagged [mgcv]
mgcv (Mixed GAM Computation Vehicle) is a CRAN package for the R language, it contains routines for GAMs and other generalized ridge regression with multiple smoothing parameter selection by GCV, REML or UBRE/AIC. Also GAMMs.
mgcv
496
questions
0
votes
0
answers
20
views
SVC GAM in the presence of factor variable and transformation of coefficients into relative risk
I would like to get your confirmation on two doubts I have on the application of SVC GAM.
Basically, I would like to know
how to deal with factor variables when predicting spatially varying ...
0
votes
0
answers
20
views
structure of multinomial model in mgcv
I am trying to model the proportions of a variable with four categories through time and at four different sites. Most sites have all four categories of the variable, but some sites only have three ...
0
votes
1
answer
51
views
Prediction values don't match fitted function from GAM model
I have a presence/absence data for a species occurrence and I did a binomial GAM using sea surface temperature (sst) as a predictor variable.
My df object is a data.frame with the presence/absence ...
0
votes
0
answers
12
views
Effects Contrast Matrix for Interaction with Multiple Grand Means
I want to include an interaction between two factors: area and house_type, in my GAM (MGCV), I hope to make a sum-to-zero contrast encoding.
But, I do not want each combination of the factors to be ...
1
vote
0
answers
24
views
Run mgcv package in python via rpy2
I am trying to create a python package to run mgcv in R, to replace the functionality of pyGAM. I want to start with the r command gam(), and need to use rpy2 to transfer data from R. I don't know how ...
0
votes
0
answers
68
views
Missing category in reference level in multinomial GAM with mgcv in R
Consider the multinomial GAM with mgcv in R
library(mgcv)
multinom = gam(list(sound ~ word + s(long, lat),
~ word + s(long, lat),
~ word + s(long, ...
0
votes
0
answers
31
views
gam function output (mgcv package)
How can I improve my bam model if 3/4 gam.check plots show poor diagnosis, except for the histogram of residuals (which shows a normal distribution).
My response variable is soundscape saturation (...
0
votes
1
answer
120
views
Step failure (and iteration limit) in multinomial GAM with mgcv in R
I have a data set with 40 sites (long, lat) by 2 ages by 2 genders by 6 words and 6 dependent sound categories (coded 0 to 5) as simulated here:
sound <- sample(0:5, size=960, replace=T)
...
1
vote
0
answers
48
views
mgcv predict.gam in R version 4 gives error, in R version 3, no error
In R version 3.6.3, my predict.gam function gives a result. When I use R 4.x, I get errors for some types of predict, but not others:
library(gam)
library(dplyr)
gm1 <- predCol ~ s(VCF_nontree) + ...
1
vote
1
answer
22
views
How to Plot Difference Smooth with confidence Intervals using gamm4 in R
I am currently working on fitting splines with gamm4 and I have hierarchical data. In my dataset, Trial_no is nested within VP, and SoundType (levels: STA and DEV) is a level-1 predictor. My model ...
1
vote
1
answer
44
views
How can I enable openMP in Mac OS for mgcv R package?
I'm trying to run GAMMs in mgcv and hoping to utilise multi-threaded computation but openMP is not enabled on my Apple M2 Pro running Sonoma 14.1.1. I don't know a lot about the back-end of R, so ...
1
vote
1
answer
30
views
Plotting a QQplot from a logistic GAM fitted with mgcv and using weights
Here is a little script describing my problem.
I am fitting a logistic model in R using the mgcv package.
The dataset represent the occurrence of an event under certain conditions.
For this model, I ...
1
vote
2
answers
68
views
Using both foreach and bam from the mgcv package
I have several large GAM models to fit (lots of data, various distributions for residuals and random effect smooths). Currently, I use foreach with a cluster of processors based on the parallel ...
0
votes
0
answers
56
views
How to visualize GAM fit with a multiple imputed dataset?
I’m working with a dataset that has missing values, and I am using multiple imputation with the mice package in R. I then fit a Generalized Additive Model (GAM) using the mgcv package on the imputed ...
1
vote
1
answer
39
views
Cannot force legend to bottom in gratia::compare_smooths
I am using the wonderful gratia package to visualize multiple gam models from the mgcv package using the compare_smooths function. While I am able to create the gams properly and draw them, I cannot ...