I have a GAMM that’s multivariate. It’s also a hurdle_gamma() model due to the presence of 0’s throughout the dataset. I continuously get errors when attempting to run the model and I’m not sure where they are coming from.
model <- bf(mvbind(var1, var2, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15 ) ~ gear_type + s(effort, k = 55) + s(doy, bs = 'cc', k = 20) + s(landing_year, k = 22) + s(forest, k = 15) + s(herbaceous, k = 15) + s(open_water, k = 15) + s(X,Y, bs= 'ts', k = 44) + (1|boat_id) + (1|landing_mun) + (1|basin_id), hu ~ gear_type + s(effort, k = 55) + s(doy, bs = 'cc', k = 20) + s(landing_year, k = 22) + s(forest, k = 15) + s(herbaceous, k = 15) + s(open_water, k = 15) + s(X,Y, bs= 'ts', k = 44) + (1|boat_id) + (1|landing_mun) + (1|basin_id)) + hurdle_gamma() M1 <- brm(formula = model, data = completed_catch_data, iter = 2000, warmup = 1000, cores = 4, save_warmup = FALSE)
I get the following error:
Compiling Stan program... Error in stanc(file = file, model_code = model_code, model_name = model_name, : parser failed badly
I’ve tried the recommended steps of uninstalling rstan and StanHeaders and reinstalling the github libraries for rstan and StanHeaders. I’ve double checked that my RTools C++ toolchain was downloaded and installed. What other explanations are there for this error?
A few questions that might also help me figure out the problem:
Do the knots for each smooth need to be specified by the knots argument in the brm() function instead of within the smooth? e.g., my model has s(x, bs =, k = ), should the knots for each smoothing term instead be moved to brm(knots = )?
Does the family argument in brm() need to be specified for the hurdle model to work? i.e., brm(family = hurdle_gamma())
Is there something about mvbind() that is causing this issue? I was able to run a single variable model with the same model as above without errors.
- Operating System: Windows 11
- brms Version: 2.19.0
- R version 4.3.1