Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
52 views

I am running a GAM model with bam in the mgcv package in R. The dataset in the model is calculated from mean hourly speeds for individual fish from position data (x,y, datetime). AR_hourly <- ...
mikejwilliamson's user avatar
1 vote
0 answers
54 views

I fit a hierarchical generalized additive model with a sum to zero smooth interactions (bs="sz"). I would like to take the first derivative and plot the simultaneous confidence interval in ...
Camila's user avatar
  • 11
3 votes
1 answer
131 views

I'm using the mgcv package in R to build generalized additive models (GAMs), and I often use cubic regression splines (cr) instead of the default thin plate regression splines (tp) (mainly because cr ...
Tripartio's user avatar
  • 2,383
2 votes
1 answer
67 views

I am plotting a nonlinear generalized additive model (gam) using R's mgcv package: library(mgcv) V <- rep(1, nrow(dt) fit <- gam(cbind(V, group_number) ~ s(time_elapsed, exposure_group, bs='fs'...
Stefan Verweij's user avatar
1 vote
0 answers
95 views

I am getting nonsensical fits from both mgcv::gam() and mgcv::bam() whenever I use ML, REML, or fREML, despite clear trends in the test data. I believe the issues started after I installed openBLAS ...
Stefano Mezzini's user avatar
2 votes
1 answer
137 views

In the documentation for mgcv::pcls(), an example of constructing a monotonically increasing gam model is provided with the following code: set.seed(1234) # added for reproducibility in this post only ...
langtang's user avatar
  • 25.3k
4 votes
2 answers
137 views

I am fitting GAMs in R using the mgcv R package. I then want to perform posterior predictive checks to compare observed and simulated outcomes. A toy example using the performance R package: library(...
wrong_path's user avatar
0 votes
0 answers
146 views

I would like to run a generalised additive model (GAM) regression with some clustered survey data, where I fit a spline for one of the variables. I would like to estimate robust standard errors, ...
roller_coaster's user avatar
0 votes
0 answers
66 views

I'm running a mixed model in mgcv::bam() and my most complex model is throwing the below error both on my PC (RStudio) & my work's high powered computing system running Linux. I think it's ...
Caitlin H's user avatar
1 vote
1 answer
32 views

I'm trying to plot a factor-smooth term bs='fs' from my model, but I keep getting this error from gratia::draw(mod): Error in seq.default(from = lower, to = upper, length.out = n) : 'length.out' must ...
Nate's user avatar
  • 489
0 votes
0 answers
87 views

I'm building a GAM via mgcv, which takes days to build. Is there any way to know how much of the model has been built just to get an indication of what is left? Can I print all details during the run ...
ella's user avatar
  • 201
0 votes
1 answer
146 views

As far as I know, mgscv's vis.gam does not feature an argument like exclude = c("s(id)", ...) to exclude a random effect s(id, bs = "re") of a GAMM from the prediction. Is there ...
David's user avatar
  • 107
1 vote
1 answer
94 views

I am interested in testing the linear trend separately from the nonlinear component in a GAMM. I have followed an example from the mgcv documentation and answers to relevant questions on stackexchange ...
Athanassios Protopapas's user avatar
0 votes
1 answer
63 views

I have a small (n=28) dataset of three seabird occurrence count data and have run a hurdel GAM model (using mgcv::gam()) with first using a binary model with presence/absecene, and then a negative ...
daragh brown's user avatar
1 vote
1 answer
73 views

I am running the model below (modGI_test): modGI_test <- gam(Met1 ~ Antibiotics + s(Timepoint, k=7) + s(Timepoint, by=Antibiotics, k=7, m=1) + s(Timepoint, ID_new,...
pemb_bex6789's user avatar
1 vote
1 answer
189 views

I try to fit a GAM model with a multidimensional categorical response variable combining three binomial dimensions (e.g., A-B by a-b by α-β) lacking certain combinations and depending on a smooth of ...
David's user avatar
  • 107
0 votes
1 answer
217 views

I am using the mgcv package to train a gam model (family = betar(), method = 'REML' using 10 threads). I use the tp basis. I split my dataset in multiple train-test splits - my main interest is ...
TheRajVJain's user avatar
2 votes
0 answers
54 views

I'm working with the gam function from the mgcv package in R, and I have a custom function that uses a weights vector to fit the model. My issue is that when I pass a weights vector to the function as ...
Paco Herrera's user avatar
1 vote
0 answers
122 views

I am fitting this model: m <- bam(f, data = d, family = binomial(link = 'logit'), select = TRUE, method = 'REML') where f is y ~ s(t) + s(x1) + s(x2) + s(x3) + ...
beng5000's user avatar
1 vote
2 answers
110 views

I'm trying to fit a model in R which shows how depth and sediment type influence seagrass density (response) and collected a dataframe with about 5000 rows. For ease of data collection, we have ...
Matt Macdonald's user avatar
5 votes
1 answer
158 views

I am running some fairly large gam models and don't want to parallelize the computations, or at least want to be able to control the degree of parallelization. (Besides not wanting to fry my machine ...
Ben Bolker's user avatar
  • 230k
2 votes
1 answer
74 views

I am using MGCV to generate predictions for a GAM using a cubic spline forced through a certain point. I have generated the gam exactly as outlined in this post: https://stat.ethz.ch/pipermail/r-help/...
Gretel's user avatar
  • 23
0 votes
1 answer
379 views

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 ...
Maria Inês Silva's user avatar
1 vote
0 answers
76 views

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 ...
Yifan Wang's user avatar
0 votes
0 answers
117 views

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, ...
David's user avatar
  • 107
0 votes
0 answers
100 views

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 (...
Carla Mere's user avatar
0 votes
1 answer
388 views

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) ...
David's user avatar
  • 107
1 vote
0 answers
64 views

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) + ...
we need a Mat. Stat.'s user avatar
1 vote
1 answer
190 views

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 ...
user25610677's user avatar
1 vote
1 answer
328 views

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 ...
shanananthi's user avatar
1 vote
1 answer
197 views

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 ...
Arnaud's user avatar
  • 387
1 vote
2 answers
228 views

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 ...
David M. Kaplan's user avatar
0 votes
0 answers
177 views

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 ...
Katherine Drummond's user avatar
1 vote
1 answer
76 views

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 ...
flâneur's user avatar
  • 321
2 votes
1 answer
298 views

I created a GAM model using mgcv. My response variable is log transformed. I would like to plot this model using gratia. However, I want to make sure the y-axis is exponentiated after I plot it using ...
Eazye's user avatar
  • 21
1 vote
1 answer
147 views

How do you extract the pooled estimated degrees of freedom (edf) from a pooled generalized additive model ? library(mice) # For multiple imputation library(mgcv) # For GAM models library(broom) # ...
Katherine Drummond's user avatar
2 votes
2 answers
279 views

I cannot add points to the diagram of GAM results displayed with the plot_smooths() function of tidymv package. I would like to add points to the diagram of GAM results displayed with the plot_smooths(...
RHT's user avatar
  • 23
0 votes
1 answer
26 views

I have created this regression model that works well : model1 = bam(depend ~ s(indep, by = gender.x,bs = "tp") + s(Age, by = gender.x, bs = "tp") + ti(Age, indep, by = gender....
Ruben MIRANDA MARCOS's user avatar
3 votes
2 answers
220 views

I'm trying to use bam() and method="fREML" to speed up my analyses. require(mgcv) require(gratia) require(brms) require(DHARMa) require(marginaleffects) mode11 <- bam(Met1 ~ s(Timepoint, ...
Adam9's user avatar
  • 55
0 votes
0 answers
74 views

Am performing mgcv::gam over each unique XY pairing (2 in this instance) and both of these pairings have just 11 obs. Ideally, the prediction of A=0 should be somewhere between B = 2,000 and 1,000. ...
user11057680's user avatar
1 vote
1 answer
7k views

I am trying to draw GAMs in R using the below code. This code always used to work, and I could draw the partial effect of my smoothed term, but randomly it no longer works, consistently triggering ...
flâneur's user avatar
  • 321
3 votes
2 answers
142 views

I am attempting to "bam.update" my fitted mgcv::bam model that uses the "weights" argument and getting the following error: Error in model.frame.default(gp$fake.formula, data, ...
Max Moldovan's user avatar
1 vote
2 answers
99 views

Is it possible to get predictions from a GAM object for specific terms from 'partial' newdata, which only provides values for the terms to predict? Running predict.gam with type = 'terms' for specific ...
chm's user avatar
  • 124
1 vote
1 answer
226 views

Is there a way to include residual variance in the predictions from predict.gam()? For reference: I've used brms for similar purposes before, and it has two distinct functions, fitted() and predict(). ...
TY Lim's user avatar
  • 623
2 votes
1 answer
275 views

I am trying to fit a GAM model using library(mgcv) for a data set containing five factors. Some factors are nested. There is an independent variable named x and a response variable named y. The goal ...
Tabata's user avatar
  • 45
0 votes
1 answer
131 views

The Scam package allows to create Shape Constrained Additive Models and uses some routines from the mgcv package. The Parsnip package from the Tidymodels framework allows to create the following types ...
user3516915's user avatar
1 vote
1 answer
103 views

I have a large dataset that I need to predict some values for. I have this small reproducible example below. I would like to predict for a few years ahead using either gam or glm, however, I can't ...
Salvador's user avatar
  • 1,973
0 votes
0 answers
256 views

I have count data of a species which I am modelling using GAMs with negative binomial and Tweedie families. I want to compare the models visually using rootograms. This works fine for the negative ...
DMAD Tim's user avatar
0 votes
0 answers
238 views

I am trying to fit a binomial GAM using the mgcv library in R. Because I have a high number of data points (~20,000), I am using the bam function. The structure of the model is as follows: Model <- ...
Jerome's user avatar
  • 35
1 vote
1 answer
62 views

The update() function of R does not work with objects returned from the gamm4() function of the mgcv package. Question: *Does anyone know of an equivalent way of updating gamm4 objects? * I have found ...
Bill Shipley's user avatar

1
2 3 4 5
11