Dear all,
I’ve used rstanarm::stan_clogit to estimate the effect of a certain intervention on mortality. In short, our design is a matched risk-set case-control study with 1 case and 5 controls per risk set/stratum. I used rms::rcs as suggested previously but I’m now struggling a bit with getting conditional effects of the splines. brms (which has the nice conditional_effects function) doesn’t support the conditional logistic likelihood, as far as I know, which is why I’m sticking with rstanarm. It is possible to re-cast the conditional logistic regression as a Cox regression, but that requires defining the strata, and I can’t seem to find out how to do that in brms.
I feel like I’m missing something obvious, but since I’m quite stuck, I wanted to reach out to the community and hopefully get some pointers on moving forwards with this.
So, to continue with the example from my other post:
library(dplyr)
library(rstanarm)
library(rms)
dat <- arrange(infert, stratum) %>%
filter(parity <= 2) # yields 1 case and 2 controls per stratum
post <- stan_clogit(case ~ rcs(age) + spontaneous + induced,
strata = stratum, data = dat, QR = TRUE)
As per the posterior_predict documentation,
Drawing from the posterior predictive distribution at interesting values of the predictors also lets us visualize how a manipulation of a predictor affects (a function of) the outcome(s).
All good, but the Details section specifies,
For models estimated with
stan_clogit, the number of successes per stratum is ostensibly fixed by the research design. Thus, when doing posterior prediction with new data, thedata.framepassed to thenewdataargument must contain an outcome variable and a stratifying factor, both with the same name as in the originaldata.frame. Then, the posterior predictions will condition on this outcome in the new data.
My question is, then, if I wanted to see how age affects the outcome (e.g. over a grid in [18:45]) for women with spontaneous = 0 and induced = 0, how would I go about it? That is, what newdata should I give the posterior_predict? Or am I completely off track and need to do something else? I’m running rstanarm v2.18.2.
Cheers,
Ben