Please also provide the following information in addition to your question:

- Operating System: win10
- brms Version: newest

```
tree <- gl(3,100)
d0<-rnorm(300,5,1)
t<-5
dt<-d0^(1/3)*rnorm(300,0.5,0.1)*t+d0
mydat<-data.frame(tree,d0,dt)
fit_mydat <- brm(
bf(dt ~ (beta * (1 - alpha) * 5 + d0^(1-alpha))^(1/(1-alpha)),
beta ~ 1, alpha ~ 1,
nl = TRUE),
data = mydat, family = gaussian(),
prior = c(
prior(lognormal(0.5, 0.05), nlpar = "beta"),
prior(normal(0.3, 0.01), nlpar = "alpha")
),
control = list(adapt_delta = 0.95)
)
```

In my case, the nlpar alpha belongs to a normal (0.3, 0.01) distribution, I want to replace the sd (i.e. 0.01) with randomed samples from a different distribution, such as normal (0.01, 0.005). Is it possible to do this in brms?

Hi,

my best guess is that this is not directly possible in brms as I don’t think you directly combine distributional and non-linear models but would tag @paul.buerkner for confirmation.

Best of luck with your model!

1 Like

Thanks for your suggestion and I am still waiting for his response and confirmation. Paul closed this issue in github and suggested me to put this issue here.

For what reason would you like to change that? Since only nlpar alpha (one parameter) informs the hyperparameter (the SD you want to model), there is not much gained by that approach.

1 Like

Hi, Paul

I just want to follow a procedure provided in Coomes et al., 2011 (Bayesian hierarchical modelling section, paper title : Moving on from Metabolic Scaling Theory: hierarchical models of tree growth and asymmetric comprtition for light)

Ah you simply want an hierarchical model? This is easy. See the `brms_nonlinear`

vignette for an example.

Yes, I totally understand. The code I provided above just modified from the brms_nonlinear vignette. However, in the case provided in Coomes, σ2 of α was also a hyperparameters, sampled from an inverse gamma distribution, which I can not prepare in brms.

my code:

tree <- gl(3,100)

d0<-rnorm(300,5,1)

t<-5

dt<-d0^(1/3)*rnorm(300,0.5,0.1)*t+d0

mydat<-data.frame(tree,d0,dt)

fit_mydat <- brm(

bf(dt ~ (beta * (1 - alpha) * 5 + d0^(1-alpha))^(1/(1-alpha)),

beta ~ 1, alpha ~ 1,

nl = TRUE),

data = mydat, family = gaussian(),

prior = c(

prior(lognormal(0.5, 0.05), nlpar = “beta”),

prior(normal(0.3, 0.01), nlpar = “alpha”)

),

control = list(adapt_delta = 0.95)

)

Did you look at the cumulative loss payments example? There it is shown how to model hierarchical structure and SD hyperparameters.

Hi,Paul,thanks for your quick response. I had looked at that example before and my codes were modified from the cumulative loss payments example (as you saw in my last reply). Unforturntely, I am still confusing how to model a SD hyperparameters. I failed several times. May you please modify my codes directly, considering a SD hyperparameters of alpha (e.g. prior(normal(0.3, SD), nlpar = “alpha”, SD <- prior(normal(0.1,0.05))?

If you do not have time, just leave this alone and I will close this topic.

Thanks.

```
bf(dt ~ (beta * (1 - alpha) * 5 + d0^(1-alpha))^(1/(1-alpha)),
beta ~ 1, alpha ~ 1 + (1 | group),
nl = TRUE)
```

where `group`

is the variable `alpha`

is supposed to vary over.

1 Like