| separation_rows | R Documentation |
This function identifies the rows in a design matrix/structure vector matrix that are associated for separation. It calls lower level functions if given an argument or chooses based on the response type.
separation_rows(object, ...)
## Default S3 method:
separation_rows(object, ...)
## S3 method for class 'factor'
separation_rows(object, X, model = NULL, rational = FALSE, ...)
## S3 method for class 'character'
separation_rows(object, X, model = NULL, rational = FALSE, ...)
## S3 method for class 'logical'
separation_rows(object, X, model = NULL, rational = FALSE, ...)
## S3 method for class 'numeric'
separation_rows(object, X, model = NULL, rational = FALSE, ...)
## S3 method for class 'integer'
separation_rows(object, X, model = NULL, rational = FALSE, ...)
## S3 method for class 'matrix'
separation_rows(object, rational = FALSE, ...)
## S3 method for class 'formula'
separation_rows(
object,
data,
model = NULL,
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, ...)
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. |
data |
either a standard data frame, list or environment (or object
coercible by Alternatively, |
contrasts |
an optional list. See the |
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_worker 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 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).
A list with the components:
offrows the submatrix of the matrix (X,y) with the rows responsible for separation
index the index of the rows responsible for separation
For model = "sl" it is a list of these lists for each category.
## Binary data
data(csepdat1)
outc<-csepdat1$y
desma<-cbind("(Intercept)"=1,csepdat1[,2:ncol(csepdat1)])
separation_rows(outc, X = desma, model = "b")
# Nominal data
# Baseline-category link
data(qcsepdatm)
y<-qcsepdatm$y
X<-cbind(1,qcsepdatm[,2:ncol(qcsepdatm)])
separation_rows(y, X = X, model = "bcl")
# Ordinal data
data(qcsepdato)
yo<-qcsepdato$y
Xo<-qcsepdato[,2:ncol(qcsepdato)]
# Sequential link
separation_rows(yo, Xo, model = "sl")
# Ordered stereotype
separation_rows(yo, Xo, model = "os")
# Adjacent-category link
separation_rows(yo, Xo, model= "acl")
# Cumulative link
separation_rows(yo, Xo, model = "cl")
# 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.