I’m attempting to run a model in brms with gamma distribution however, I’m not having much success. I’m new to brms (and modelling in general, honestly) so it’s very likely I’m missing something very simple.
My model is below. When I try to run this model I get the error message:
Error: The parameter ‘sigma’ is not a valid distributional or non-linear parameter. Did you forget to set ‘nl = TRUE’?
From what I understand this error message is suggesting I specify the model as non-linear, which actually I believe it is. However, I don’t know how to do this. I tried just adding nl= true to the model code but I still get the same error message. I tried it in a few different places without success. Instead of just continuing to aimlessly try to add it to different parts of the model I should probably gain a better understanding of where it belongs, why the error message says I need it, and what other information may be required to run this as a non-linear model. Any help and suggestions welcome!
Please let me know if there is any more information you require!
Ah… That’ll certainly cause a problem then! Ha. The reason I was trying to run it with sigma is that I wanted to compare if there was a difference in estimates between modelling log transformed IVI (explained below) with poisson distributions and priors versus modelling untransformed IVI with gamma distributions. The model for logIVI is as follows:
m4_cor ← brm(bf(logIVI ~ 1+ chicks + nestlingage + (1 + chicks + nestlingage| fyear) + (1 | fsite) + (1|fpair),
sigma ~ fyear),
data = data1,
prior = c(set_prior(“normal(0, 0.5)”, class = “b”, coef = “nestlingage”),
set_prior(“normal(-0.1, 0.5)”, class = “b”, coef = “chicks”),
set_prior(“normal(6, 0.5)”, class = “Intercept”),
set_prior(“lkj(2)”, class = “cor”), # delete this line if you don’t want to estimate correlation among ranef
set_prior(“cauchy(0,1)”, class = “sd”)),
warmup = 1000,
iter = 5000,
chains = 3,
cores = 2,
control = list(adapt_delta = 0.99, max_treedepth = 15),
backend = “cmdstanr”,
threads = threading(2))
I am interested in looking at how residual variance differs across years to test hypotheses related to year specific differences in behaviour ( I study variance-sensitivity, formally termed risk-sensitivity, if you’re familiar with that by chance).
I’ll take a look at that today. It may be something I need to incorporate in the above model too, by the sounds of it.
IVI means inter-visit interval. In my case, it is the time between consecutive provisioning visits of adult peregrine falcons to the nest. It’s always positive. Lots of values < 1 hour (most), many within 2 hours, decreasing to a maximum of I believe around 8 hours.