| checksep | R Documentation |
This function checks for (quasi-) complete separation by calling the appropriate low-level functions.
checksep(
y,
X,
S,
rational = FALSE,
model = c("bcl", "b", "cl", "acl", "sl", "osm"),
backend = c("rcdd", "ROI"),
solver = NULL
)
check_separation(..., rational, backend, solver, quick)
## Default S3 method:
check_separation(
y,
X,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'matrix'
check_separation(
S,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'formula'
check_separation(
formula,
data,
model = c("bcl", "b", "cl", "acl", "osm", "sl"),
rational = FALSE,
contrasts = NULL,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'osm'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'clm'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'polr'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'multinom'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'glm'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'bracl'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
## S3 method for class 'brmultinom'
check_separation(
object,
rational = FALSE,
backend = c("rcdd", "ROI"),
solver = NULL,
quick = FALSE,
...
)
y |
a categorical outcome vector |
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 polynominals). |
S |
a matrix of structure vectors |
rational |
should rational arithmetic be used |
model |
model string. One of "bcl", "b", "cl", "acl", "osm", "sl". |
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". |
... |
arguments for the generic: For pre-fit |
quick |
boolean flag whether the quick linear program is to be used or the full fledged one (default is FALSE). |
formula |
An object of class ‘"formula"’ (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’ in |
data |
Either a standard data frame, list or environment (or object coercible by as.data.frame to a data frame) containing variables in the model. If not found in |
contrasts |
contrasts: an optional list. See the |
object |
model object |
The function uses either a response vector y and a design matrix X, or a structure vector matrix S. If S is given, y and X and model are ignored.
check_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 low-level function checksep with it.
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/matrix given as rational numbers in the rcdd definition this is recognized but the formula does not get expanded and is taken literally, so e.g. variables in formula must match exactly with the column names in data, or factors need to be converted to dummies before that (wouldn't be possible in the rational format in any other way anyway).
a Boolean; either 'TRUE' if we detected separation or 'FALSE' if not.
data(csepdat1)
# pre fit
outc<-csepdat1$y
desma<-cbind("(Intercept)"=1,csepdat1[,2:ncol(csepdat1)])
check_separation(y = outc, X = desma)
# post fit
m1 <- stats::glm(y~x1+x2,data=csepdat1,family=binomial())
check_separation(m1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.