How to make a gradient coefficient depend on a non-linear function

Think I’ve found a solution, yet to be run.

  1. When using set_nl(TRUE) one has to be explicit for all parameters, not just the non-linear ones.
  2. Used the (1|ID1|SUBJID) syntax to ensure the correlation structure is in there, which is implicit when formulating the linear case (related post).
get_prior(data = dataset,
           family = gaussian(),
           formula = bf(logPD | cens(cen1) ~ popnintercept + CLR*studyday) +
             lf(popnintercept + CLR ~ 1 + (1|ID1|SUBJID)) +
             nlf(-CLR ~ (a1 * totperwkperkg^h)/(b + totperwkperkg^h) + a2) +
             lf(a1 + b + h + a2 ~ 1 + (1|ID1|SUBJID)) +
             set_nl(nl = TRUE)
)

The result gives the following, including a warning of Replacing initial definitions of parameters 'CLR' as CLR is now just a dummy variable.

                prior class      coef  group resp dpar         nlpar lb ub       source
               lkj(1)   cor                                                     default
               lkj(1)   cor           SUBJID                               (vectorized)
 student_t(3, 0, 2.5) sigma                                           0         default
               (flat)     b                                       a1            default
               (flat)     b Intercept                             a1       (vectorized)
 student_t(3, 0, 2.5)    sd                                       a1  0         default
 student_t(3, 0, 2.5)    sd           SUBJID                      a1  0    (vectorized)
 student_t(3, 0, 2.5)    sd Intercept SUBJID                      a1  0    (vectorized)
               (flat)     b                                       a2            default
               (flat)     b Intercept                             a2       (vectorized)
 student_t(3, 0, 2.5)    sd                                       a2  0         default
 student_t(3, 0, 2.5)    sd           SUBJID                      a2  0    (vectorized)
 student_t(3, 0, 2.5)    sd Intercept SUBJID                      a2  0    (vectorized)
               (flat)     b                                        b            default
               (flat)     b Intercept                              b       (vectorized)
 student_t(3, 0, 2.5)    sd                                        b  0         default
 student_t(3, 0, 2.5)    sd           SUBJID                       b  0    (vectorized)
 student_t(3, 0, 2.5)    sd Intercept SUBJID                       b  0    (vectorized)
               (flat)     b                                        h            default
               (flat)     b Intercept                              h       (vectorized)
 student_t(3, 0, 2.5)    sd                                        h  0         default
 student_t(3, 0, 2.5)    sd           SUBJID                       h  0    (vectorized)
 student_t(3, 0, 2.5)    sd Intercept SUBJID                       h  0    (vectorized)
               (flat)     b                            popnintercept            default
               (flat)     b Intercept                  popnintercept       (vectorized)
 student_t(3, 0, 2.5)    sd                            popnintercept  0         default
 student_t(3, 0, 2.5)    sd           SUBJID           popnintercept  0    (vectorized)
 student_t(3, 0, 2.5)    sd Intercept SUBJID           popnintercept  0    (vectorized)