`surv_jm` estimates do not match those in `simjm`

Hi All,

I’ve been fitting joint longitudinal models with stan_jm, but wanted to make sure that my model was well-calibrated. I’ve been using simjm (thanks @sambrilleman!) to generate data with known parameter estimates like:

simdata <- simjm(n = 500, 
                 fixed_trajectory = "cubic",
                 random_trajectory = "linear",
                 assoc = "etaslope",
                 return_eta = TRUE)

I’ve then used rstanarm::stan_jm to try and recover the estimates using:

tst_rst <- stan_jm(formulaLong = Yij_1 ~ Z1 + Z2 + poly(tij, degree = 3) + (poly(tij, degree = 3)|id),
                   dataLong = simdata$Long1,
                   formulaEvent = Surv(eventtime, status) ~ Z1 + Z2,
                   dataEvent = simdata$Event,
                   time_var = "tij",
                   id_var = "id",
                   assoc = "etaslope",
                   basehaz = "weibull",
                   chains = 4, cores = 4)

Unfortunately, the estimates that stan_jm returns are markedly different (orders of magnitude), especially with respect to the time variable (though estimates for the various coefficients are also slightly off). I’m assuming this is because my stan_jm model is mis-specified relative to how simjm generates the data, but I can’t tell from the documentation for simjm what I might be doing wrong. Any insight you have would be most appreciated.

In case it is helpful, here is what I mean by the parameters not matching. These are the estimates for time in the longitutdinal submodel from simjm:

$betaLong_linear
[1] -0.25

$betaLong_quadratic
[1] 0.03

$betaLong_cubic
[1] -0.0015

And these are the results from stan_jm:

poly(tij, degree = 3)1 -79.692   1.511
poly(tij, degree = 3)2 -29.112   0.558
poly(tij, degree = 3)3 -16.882   0.564

It’s possible that I’m misunderstanding what the simjm parameters are meant to describe, but I don’t see any output in the stan_jm results that come close to matching these values. Any help would be most appreciated.

An additional update - setting both the fixed_trajectory and random_trajectory to ”linear” and fitting:

tst_rst <- stan_jm(formulaLong = Yij_1 ~ Z1 + Z2 + tij + (tij|id),
                    dataLong = simdata$Long1,
                    formulaEvent = Surv(eventtime, status) ~ Z1 + Z2,
                    dataEvent = simdata$Event,
                    time_var = "tij",
                    id_var = "id",
                    assoc = "etaslope",
                    basehaz = "weibull",
                    chains = 4, cores = 4)

returns estimates that are consistent with the simulated data. Which suggests to me that the there must be some additional information that stan_jm requires to accommodate the other trajectory values as formulaLong = Yij_1 ~ Z1 + Z2 + poly(tij, degree = 3) + (poly(tij, degree = 3)|id) does not return values from simjm when fixed_trajectory = “cubic”, random_trajectory = “cubic”