f2<-stan_jm(formulaLong =logTSH~time+(time|code),dataLong =dataLong,

formulaEvent = Surv(surv_time,incidenceDM)~sex15_1+age+BMI+fbs+bs2HR+waist+FHD,

dataEvent=data.cox,time_var = “time”,chains=3,iter=1000,assoc=c(“etavalue”,“etaslope”))

SAMPLING FOR MODEL ‘jm’ NOW (CHAIN 1).

Chain 1:

Chain 1: Gradient evaluation took 0.025 seconds

Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 250 seconds.

Chain 1: Adjust your expectations accordingly!

Chain 1:

Chain 1:

Chain 1: Iteration: 1 / 1000 [ 0%] (Warmup)

Chain 1: Iteration: 100 / 1000 [ 10%] (Warmup)

Chain 1: Iteration: 200 / 1000 [ 20%] (Warmup)

Chain 1: Iteration: 300 / 1000 [ 30%] (Warmup)

Chain 1: Iteration: 400 / 1000 [ 40%] (Warmup)

Chain 1: Iteration: 500 / 1000 [ 50%] (Warmup)

Chain 1: Iteration: 501 / 1000 [ 50%] (Sampling)

Chain 1: Iteration: 600 / 1000 [ 60%] (Sampling)

Chain 1: Iteration: 700 / 1000 [ 70%] (Sampling)

Chain 1: Iteration: 800 / 1000 [ 80%] (Sampling)

Chain 1: Iteration: 900 / 1000 [ 90%] (Sampling)

Chain 1: Iteration: 1000 / 1000 [100%] (Sampling)

Chain 1:

Chain 1: Elapsed Time: 2120.88 seconds (Warm-up)

Chain 1: 1086.63 seconds (Sampling)

Chain 1: 3207.51 seconds (Total)

…

…

…

Warning messages:

1: The largest R-hat is 1.09, indicating chains have not mixed.

Running the chains for more iterations may help. See

https://mc-stan.org/misc/warnings.html#r-hat

2: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.

Running the chains for more iterations may help. See

https://mc-stan.org/misc/warnings.html#bulk-ess

3: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.

Running the chains for more iterations may help. See

https://mc-stan.org/misc/warnings.html#tail-ess

summary(f2,“assoc”)

Model Info:

function: stan_jm

formula (Long1): logTSH ~ time + (time | code)

family (Long1): gaussian [identity]

formula (Event): Surv(surv_time, incidenceDM) ~ sex15_1 + age + BMI + fbs + bs2HR +

waist + FHD

baseline hazard: bs

assoc: etavalue (Long1), etaslope (Long1)

algorithm: sampling

priors: see help(‘prior_summary’)

sample: 1500 (posterior sample size)

num obs: 6980 (Long1)

num subjects: 1745

num events: 42 (2.4%)

groups: code (1745)

runtime: 162.1 mins

Estimates:

mean sd 2.5% 25% 50% 75% 97.5%

Assoc|Long1|etavalue -5.380 2.336 -9.712 -6.978 -5.553 -3.879 -0.925

Assoc|Long1|etaslope -45.073 21.607 -87.776 -59.362 -46.655 -30.876 -5.527

Diagnostics:

mcse Rhat n_eff

Assoc|Long1|etavalue 0.681 1.242 12

Assoc|Long1|etaslope 5.998 1.224 13

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).