I can do a stan_clogit
with a restricted cubic spline like
dat <- infert[order(infert$stratum), ] # order by strata
post <- stan_clogit(case ~ rms::rcs(age) + spontaneous + induced +
(1 | education), strata = stratum,
data = dat, subset = parity <= 2, QR = TRUE)
but using mgcv::s()
does not seem to work with stan_clogit
. Perhaps that could be fixed. I realize that you would rather call stan_gamm4
with a clogit likelihood but that seems more difficult since it internally goes through mgcv::jagam
these days.