| diagnose_separation | R Documentation |
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/S for which we have separation.
diagnose_separation(object, ...)
## Default S3 method:
diagnose_separation(object, ...)
## S3 method for class 'factor'
diagnose_separation(
object,
X,
model = NULL,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'character'
diagnose_separation(
object,
X,
model = NULL,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'logical'
diagnose_separation(
object,
X,
model = NULL,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'numeric'
diagnose_separation(
object,
X,
model = NULL,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'integer'
diagnose_separation(
object,
X,
model = NULL,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'matrix'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'formula'
diagnose_separation(
object,
data,
model = NULL,
rational = FALSE,
contrasts = NULL,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'osm'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'clm'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'polr'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'multinom'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'glm'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'bracl'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
## S3 method for class 'brmultinom'
diagnose_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
...
)
object |
an R object. Supported inputs:
|
... |
further arguments passed to the methods or lower-level functions. |
X |
a design matrix, e.g. generated via a call to
|
model |
character string specifying the model class to be fitted. One of:
If missing or |
rational |
logical; should rational arithmetic be used? |
backend |
character string specifying the backend for the linear
program. One of |
solver |
character string specifying the solver used by the
backend. Defaults to |
data |
either a standard data frame, list or environment (or object
coercible by Alternatively, |
contrasts |
an optional list. See the |
diagnose_separation is an S3 generic function.
For developers: If a method should be provided for the generic,
it is best to have that method create a matrix of structure vectors
S and use the generic with the matrix.
The formula method is for standard data frames and formulas that
work the same way as when used with glm. It does
not support extended formulas, and may not work for functions that do
formula processing differently.
For a data frame or matrix given as rational numbers in the rcdd definition, this is recognized but the formula does not get expanded and is taken literally. Consequently:
variables in formula must match exactly with the column
names in data;
factors need to be converted to dummies beforehand (which would not be possible in the rational format in any other way anyway).
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 rows associated with separation
nr.offcols number of columns of the design matrix that have separation
offcols columns associated with separation
For model = "sl" an object of class 'sepmod_sl'. It is a list or the above lists with the elements corresponding to each category.
data(qcsepdatm)
## Binary data
data(csepdat1)
outc<-csepdat1$y
desma<-cbind("(Intercept)"=1,csepdat1[,2:ncol(csepdat1)])
c1<- diagnose_separation(outc, X = desma, model = "b")
print(c1)
print(c1, "full")
# Nominal data
# Baseline-category link
data(qcsepdatm)
y<-qcsepdatm$y
X<-cbind(1,qcsepdatm[,2:ncol(qcsepdatm)])
diagnose_separation(y, X = X, model = "bcl")
# Ordinal data
data(qcsepdato)
yo<-qcsepdato$y
Xo<-qcsepdato[,2:ncol(qcsepdato)]
# Sequential link
diagnose_separation(yo, Xo, model = "sl")
# Ordered stereotype
diagnose_separation(yo, Xo, model = "os")
# Adjacent-category link
diagnose_separation(yo, Xo, model= "acl")
# Cumulative link
diagnose_separation(yo, Xo, model = "cl")
#post fit
if (require('nnet')) {
m1 <- nnet::multinom(y ~ x1 + x2, data = qcsepdatm)
diagnose_separation(m1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.