Stan_clogit error

I have created a 1 to 5 matched case-control data set using MatchIt.

The characteristics of the variables in a stan_clogit model are:
Hypoglycemic60 fct
Emergency fct
ElixCount int
AdmissionType fct
BypassDuration dbl
IntraopVasoplegia fct
IntraopHypoglycemic fct
IntraopHypotensive fct
IntraopInotropeVasopressor fct
EBLClass fct
PRBCClass fct
ElixCount int
Strata fct

There are 183 cases and 915 matched controls.

The data has been sorted by the strata = Strata argument.

The model is called with:

CardiacHypoglycemic60.matchit.stanreg <- stan_clogit(
  formula =
  Hypoglycemic60 ~
    Emergency +
    ElixCount +
    AdmissionType +
    BypassDuration +
    IntraopVasoplegia +
    IntraopHypoglycemic +
    IntraopHypotensive +
    IntraopInotropeVasopressor +
    EBLClass +
  strata = Strata,
  data = CardiacHypoglycemic60.matchit.df


R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

rstanarm 2.21.1

There are 24 cpus and 126 GB ram.

When the pids are launched a warning message is sent:

non-list contrasts argument ignored

Sampling starts and terminates abnormally with the message:

stan_clogit Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, : ?sum? not meaningful for factors site:

This is reproducible.

I am unable to debug the warning message and the fatal termination of sampling.


1 Like

I presume you cannot share the data to let me investigate in more detail? A good way to investigate would be to remove the model terms one by one and see which one brings the error and the look whether there is something weird about it.

I’ve seen a similar error elsewhere that was related to some preprocessing rstanarm did on factors - I would definitely check that the factor does in fact have more than one level or whether it is not completely determined by other predictors.

You may also want to try to run with the latest rstanarm which you can get via
Repository for distributing (some) stan-dev R packages | r-packages (we are having some trouble moving current Stan packages to CRAN which we hope to resolve, but we are not there yet).

Best of luck with your model!


I appreciated your message.

No, I am not allowed to move the data from the stats server.

I tried your suggestions.

I used a single variable (two level factor) in the model. No missing values. No empty additional factor levels.

I did this with two different variables.

Same result for both variables with warning message

“non-list contrasts argument ignored”

When the 4th chain finishes, the same error message

“stan_clogit Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, : ?sum? not meaningful for factors site:

It appears that I am using the correct model language and accepting all default arguments.

What don’t I understand about how to call a stan_clogit model?


I had assumed that the class of response variable used in the standard clogistic regression function would be accepted in stan_clogit function. clogistic accepts factors. stan_clogit doesn’t. Once I had reformated to numeric, stan_clogit ran without difficulty.

Problem solved except for the warning message “non-list contrasts argument ignored”.


1 Like

Good catch! If you want to open an issue at the rstanarm GitHub repo we’ll definitely consider adding support for factors. I think it makes sense to allow them.

This is safe to ignore and will be fixed in the next release (already fixed on GitHub).

1 Like