You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there are two ways to fix model parameters to a constant. The older one is via a constant prior, and this works for any parameter:
prior(constant(3), class = "Intercept", dpar = "kappa")
The newer method is to specify par = some_value, e.g.:
bf(resp ~ 1, kappa = 3)
I find the newer method much more intuitive and it is easier and faster to write. Unfortunately, while the first method works for any parameter, including mu, the second only works for non-mu parameters. For example this:
bf(resp ~ 1, mu = 0, kappa ~ 1)
does not work. The model runs, but mu=0 is ignored and an intercept is still estimated.
Interestingly, if we want to fix it to 0 specifically, both of these work:
Let me look into this. Just a note that the contant() prior approach is actually the newer one while the bf(par = value) approach is much older and I am not even sure I like having the latter version in brms at all or if I may want to deprecate it at some point.
Didn't realize the order, I guess it was newer because I never knew it was possible that way. I like it because it is clearer and shorter. Terms with ~ are estimated, terms with = are fixed, but both are part of the model specification. The constant(value) prior is not really coded as a prior in the underlying Stan code that brms generates, but rather just a fixed variable with that value, which to me is more consistent with the formula approach. But I understand if you prefer the prior approach and decide to deprecated the otherr
Currently there are two ways to fix model parameters to a constant. The older one is via a constant prior, and this works for any parameter:
The newer method is to specify par = some_value, e.g.:
I find the newer method much more intuitive and it is easier and faster to write. Unfortunately, while the first method works for any parameter, including
mu
, the second only works for non-mu parameters. For example this:does not work. The model runs, but mu=0 is ignored and an intercept is still estimated.
Interestingly, if we want to fix it to 0 specifically, both of these work:
resulting in:
I suspect this is not intentional - supressing the intercept results in stan code in which mu is not part of the parameter block, but we have
Nevertheless, it works. But only for the specific case of fixing
mu=0
.Is it possible to allow fixing mu to an arbitrary value via the formula syntax as for other parameters?
The text was updated successfully, but these errors were encountered: