# Logistic regression with complete separation AND repeated measures

Consider a typical logistic regression on data with a binary response $$Y$$, and some predictor variables $$X$$'s.

I understand that when the event is rare, or in the case of complete separation, one could apply the Firth correction, for example in SAS:

proc logistic data=mydata descending;
class x1;
model y=x1 / firth;
run;


Recently I encountered a situation where repeated measures were made for all subjects ($$\text{time}=1,2,3)$$. All $$X$$'s such as race and gender would be considered time-invariant. Only the binary response $$Y$$ might change over time.

With three rows per participant, I can then fix a mixed model or GEE (with repeated statements in SAS) to account for the repeated measures.

But what can I do in case of a rare event or complete separation now with repeated measures? After some research, it seems that the Firth correction is only available in proc logistic, which I believe does not handle repeated measures.

In such cases I would personally go with a Bayesian model and an informative prior on the $$\beta$$'s. Using R, such model could look like this:

library(brms)

# Specify an informative prior to handle separation
prior_info <- c(
set_prior("normal(0, 1.5)", class = "b", coef = "predictor")
)

# Specify the model using brm
model <- brm(outcome ~ predictor + (1 | subject_id),
data = mydata,
family = bernoulli(),
prior = prior_info
)
# Plot conditional effects
conditional_effects(model)


There's lots of information on priors for logistic regressions. This gets you started: https://discourse.mc-stan.org/t/default-priors-for-logistic-regression-coefficients-in-brms/13742

If you go this route you might need to adjust the prior to make it work on your specific example.

Alternatively, it seems that PROC NLMIXED seems to be able to implement a "Penalized Likelihood Logistic Regression for Sparse Data Using Data Priors".

Or this one from the same author: https://www.lexjansen.com/phuse-us/2020/as/AS14_ppt.pdf

I don't know enough about PROC NLMIXED to further commment on this though.

• Thank you so much for the informative answer. I was pretty surprised that I could not find R or SAS documentation that deals with BOTH complete separation and repeated measures. I found a similar question asked 8 years ago: stats.stackexchange.com/questions/178754/… Commented Feb 19 at 5:01
• @RonaldCarlos happy you found it useful! Commented Feb 23 at 15:37