diagsep_b: Detailed separation diagnostic for binary outcomes.

View source: R/diagsep.R

diagsep_bR Documentation

Detailed separation diagnostic for binary outcomes.

Description

This function checks whether there is (quasi-) complete separation, which type if any, gives the dimension of the recession cone, lists the number of columns in the design matrix that give rise to the separation as well as the columns names and lists the rows in X for which we have separation.

Usage

diagsep_b(y, X, rational = FALSE, backend = c("rcdd", "ROI"), solver = NULL)

Arguments

y

the binary outcome variable. Works best if it is a factor or ordered factor but can also be numeric, boolean or character. We coerce to factor internally.

X

a design matrix, e.g. generated via a call to 'model.matrix'. This means we expect that X already contains the desired contrasts for factors (e.g., dummies) and any other expanded columns (e.g., for polynomials).

rational

should rational arithmetic be used.

backend

which backend to use for the linear program. Can be "rcdd" (default and only option for rational=TRUE) or "ROI".

solver

the solver to be used in the backend. Defaults to "DualSimplex" for "rcdd" and the first LP solver returned by 'ROI_applicable_solver()' for "ROI".

Value

an object of class 'sepmod' that is a list with the components:

  • separation boolean whether there is separation ('TRUE' means separation)

  • septype which type of separation (or not). A string of either "Overlap", "Quasi-Complete Separation" or "Complete Separation".

  • reccdim dimension of recession cone

  • offrows offending rows in X

  • nr.offcols number of columns of X that have separation

  • offcols columns of X that have separation

Examples

data(csepdat1)
y<-csepdat1$y
X<-cbind(1,csepdat1[,2:ncol(csepdat1)])
diagsep_b(y,X) #separation

divoRce documentation built on April 28, 2026, 3:01 a.m.

Related to diagsep_b in divoRce...