Posit Cloud RAM not enough for GAMM

I am attempting to compute a generalised additive mixed-effects model (GAMM) in Posit Cloud. I have the standard plan (i.e., 32 GB RAM and 8 CPUs). In the settings, I changed the project resources to allocate 32 GB RAM and 8 CPUs ... and my GAMM still didn't run, and it crashed the session. As soon as the model starts running, it eats up all the RAM (the icon at the top of the page turns red), and then crashes with the following error message:

"The previous R session was abnormally terminated due to an unexpected crash"

The data for the model has approx. 42k rows, and one of the random effects has approx. 22k levels, so I understand it takes quite a bit of RAM. What I don't understand is why the session is still crashing – does anyone have any insight on this issue?

Here is the model specification:

mod_full = bam(varietal_closeness ~ 
                   s(AdA_longitude, AdA_latitude, k = 30) + 
                   age + gender + length_in_location +
                   s(id, bs = "re") +
                   s(AdA_place, bs = "re") +
                   s(variable_id, bs = "re"),
                 data = dat, family = "binomial", 
                 nthreads = 3,
                 discrete = T)

The problem is your number of levels (22k)

Thanks for the reply. Yes, I figured the 22k levels in the random effects is the problem – computed the models without them runs within seconds. But in the cloud, is there no way to get the model to fit without the session crashing?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.