Hello!
I need help writing the algebraic notation of complex nonlinear brms
models. I have already fitted the models with success. I now need to “translate” the brms
notation I wrote to algebraic notation, to better understand the difference between the models I have fitted.
The database to which I fitted the models is structured as follows:
sample phase SC gamma tau
1 A020102 2 60 70.030 3164
2 A020102 2 60 38.490 2810
3 A020102 2 60 20.480 2522
In which “phase” and “SC” are categorized grouping factors, “gamma” is the independent variable and "tau"is the response variable.
I am fitting the following nonlinear equation to my data:
\tau = a + b\gamma^c
With a, b and c as the model parameters.
Here are the models set up in brms syntax:
model_A <- brms::bf(tau ~ a + b * (gamma^c),
a ~ 1 + (1|SC|phase),
b ~ 1 + (1|SC|phase),
c ~ 1 + (1|SC|phase),
nl = TRUE)
model_B <- brms::bf(tau ~ a + b * (gamma^c),
a ~ 1 + (1|SC) + (1|SC:phase),
b ~ 1 + (1|SC) + (1|SC:phase),
c ~ 1 + (1|SC) + (1|SC:phase),
nl = TRUE)
model_C <- brms::bf(tau ~ a + b * (gamma^c),
a ~ 1 + (1|SC) + (1|phase),
b ~ 1 + (1|SC) + (1|phase),
c ~ 1 + (1|SC) + (1|phase),
nl = TRUE)
I now need to write these models in algebraic notation, using the correct index notation. I’m specially confused about how to describe nested random effects, the meaning of the :
operator and the difference between (1|SC) + (1|phase)
and (1|SC|phase)
.
This StackExchange question helped a lot, but does not answer all I need. There are also a few similar topics (1, 2, 3) already on Stan Forums, but none of them deal with the :
operator. Also, the equatiomatic
package was removed from the CRAN repository, thus I’m assuming it’s not entirely reliable to use.
Can anyone please help me?
Any help is deeply appreciated.