is_separable | R Documentation |
The function is_separable
determines if the two classes Y=1
and Y=-1
are linearly separable using columns of X
.
is_separable(X, Y, add_intercept = FALSE)
X |
Covariate matrix. Each row of |
Y |
A vector of |
add_intercept |
If |
The two classes are separable if there exists a non-zero vector b
that satisfies
y_i x_i^\top b \leq 0
for every observation i
.
Returns 1 if the data is separable and 0 otherwise.
The phase transition for the existence of the maximum likelihood estimate in high-dimensional logistic regression Emmanuel J. Candes and Pragya Sur, Ann. Statist., Volume 48, Number 1 (2020), 27-42.
Linear programming algorithms for detecting separated data in binary logistic regression models, Kjell Konis, Ph.D. thesis, Univ. Oxford.
glm
## Not run:
n <- 1000; p <- 400
X <- matrix(rnorm(n*p, 0, 1), n, p)
Y <- 2 * rbinom(n, 1, 0.5) - 1
is_separable(X, Y, add_intercept = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.