| separation_rows | R Documentation |
This function checks which rows in X/Xstar are responsible for separation on any category. The observations need not separate the same categories.
separation_rows(..., rational)
## S3 method for class 'factor'
separation_rows(y, X, rational = FALSE, ...)
## Default S3 method:
separation_rows(y, X, rational = FALSE, ...)
## S3 method for class 'matrix'
separation_rows(S, rational = FALSE, ...)
## S3 method for class 'formula'
separation_rows(
formula,
data,
model = c("bcl", "b", "cl", "acl", "osm", "sl"),
rational = FALSE,
contrasts = NULL,
...
)
## S3 method for class 'osm'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'clm'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'polr'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'multinom'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'glm'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'bracl'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'brmultinom'
separation_rows(object, rational = FALSE, ...)
seprows(
y,
X,
S,
rational = FALSE,
model = c("bcl", "b", "cl", "acl", "sl", "osm")
)
detect_seprows(
y,
X,
S,
rational = FALSE,
model = c("bcl", "b", "cl", "acl", "sl", "osm")
)
... |
arguments for the generic: For pre-fit |
rational |
should rational arithmetic be used? |
y |
the categorical outcome variable. Can be binary, categorial or ordinal. Works best if it is an ordered or unordered factor but can also be numeric, boolean or character. If y is not a factor, it is treated as a nominal (categorical) outcome. |
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). |
S |
a matrix of structure vectors. If given, |
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 |
model |
what model class is intended to be fitted? Can be any of "b" for binary, "bcl" for baseline-category link, "cl" for cumulative link, "acl" for adjacent-category link. "sl" for sequential link, "osm" for ordered stereotype model. If missing it defaults to cumulative link for ordinal y and baseline-category for everything else. |
contrasts |
contrasts: an optional list. See the |
object |
model object |
separation_rows is S3 generic. 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 seprows 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).
data(qcsepdato)
# pre fit
y<-factor(qcsepdato$y,ordered=TRUE)
X<-cbind("(Intercept)"=1,qcsepdato[,2:ncol(qcsepdato)])
separation_rows(y=y,X=X)
# post fit
if (require('MASS')) {
m1 <- MASS::polr(y~x1+x2, data = qcsepdato)
separation_rows(m1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.