I can get a prior structure and test my formula arg definition for a censored hierarchical linear growth model, grouped by individual by running brms::get_prior()
:
get_prior(data = dataset,
family = gaussian(),
formula = logPD | cens(cen1) ~ 1 + studyday + (1 + studyday | SUBJID)
)
and this returns expected output:
prior class coef group resp dpar nlpar lb ub source
(flat) b default
(flat) b studyday (vectorized)
lkj(1) cor default
lkj(1) cor SUBJID (vectorized)
student_t(3, -0.3, 2.5) Intercept default
student_t(3, 0, 2.5) sd 0 default
student_t(3, 0, 2.5) sd SUBJID 0 (vectorized)
student_t(3, 0, 2.5) sd Intercept SUBJID 0 (vectorized)
student_t(3, 0, 2.5) sd studyday SUBJID 0 (vectorized)
student_t(3, 0, 2.5) sigma 0 default
However I would like the population-level gradient coefficient of studyday (now called CLR) to depend on a non-linear function whose parameters (a1, a2, b & h) I’d like to estimate too. logPD
, cen1
, studyday
, SUBJID
& totperwkperkg
already exist in dataset
.
get_prior(data = dataset,
family = gaussian(),
formula = bf(logPD | cens(cen1) ~ 1 + CLR*studyday + (1 + studyday | SUBJID)) +
nlf(-CLR ~ (a1 * totperwkperkg^h)/(b + totperwkperkg^h) + a2) +
lf(a1 + b + h + a2 ~ 1) +
set_nl(nl = TRUE)
)
but this oddly only returns the non-linear coefficients I wanted and loses the linear coefficients shown above:
prior class coef group resp dpar nlpar lb ub source
student_t(3, 0, 2.5) sigma 0 default
(flat) b a1 default
(flat) b Intercept a1 (vectorized)
(flat) b a2 default
(flat) b Intercept a2 (vectorized)
(flat) b b default
(flat) b Intercept b (vectorized)
(flat) b h default
(flat) b Intercept h (vectorized)
Additionally I’m ignorant on the difference between bf()
& lf()
. bf()
is used to separate functions and seems to always contain the response variable? nlf()
contains the non-linear function?
Operating System: Ubuntu 22.04 LTS
brms Version: 2.17.0