Spline on e.g. etavalue in the event model using stan_js

Dear all,

We’re preparing a study in which we’d like to use the joint-modelling framework, expecting a somewhat U-shaped effect of the biomarker.

I can’t seem to find any mentioning of this in the documentation or the vignette, but I was wondering if it’s possible to model etavalue (from the longitudinal model) with a spline in the event model. Building on the first example in ?stan_jm, I’m thinking something along the lines of this:

library(rstanarm)
library(mgcv)

f1 <- stan_jm(formulaLong = logBili ~ year + (1 | id), 
              dataLong = pbcLong,
              formulaEvent = Surv(futimeYears, death) ~ sex + trt + s(etavalue), 
              dataEvent = pbcSurv,
              time_var = "year",
              chains = 1, cores = 1, seed = 12345, iter = 1000)

Cheers,
Ben