View source: R/models_gipsQDA.R
| gipsqda | R Documentation |
Quadratic discriminant analysis (QDA) using covariance matrices projected via the gips framework to enforce permutation symmetry and improve numerical stability.
gipsqda(x, ...)
## S3 method for class 'formula'
gipsqda(formula, data, ..., subset, na.action)
## Default S3 method:
gipsqda(x, grouping, prior = proportions,
nu = 5, MAP = TRUE, optimizer = NULL, max_iter = NULL, ...)
## S3 method for class 'data.frame'
gipsqda(x, ...)
## S3 method for class 'matrix'
gipsqda(x, grouping, ..., subset, na.action)
x |
(required if no formula is given as the principal argument) a matrix or data frame containing the explanatory variables. |
... |
Arguments passed to or from other methods. |
formula |
A formula of the form |
data |
An optional data frame, list or environment from which variables
specified in |
grouping |
(required if no formula is given) a factor specifying the class for each observation. |
prior |
The prior probabilities of class membership. Must sum to one and have length equal to the number of groups. |
nu |
Degrees of freedom parameter used internally by covariance projection. |
MAP |
Logical; if |
optimizer |
Character string specifying the optimization method used
for covariance projection. If |
max_iter |
Maximum number of iterations for stochastic optimizers. |
subset |
An index vector specifying the cases to be used in the training sample. (NOTE: must be named.) |
na.action |
A function specifying the action to be taken if |
This function is a minor modification of qda, replacing
the classical sample covariance estimators by projected covariance matrices
obtained using project_covs().
Quadratic discriminant analysis models each class with its own covariance
matrix. In gipsqda, these covariance matrices are projected using the
gips framework, which enforces permutation symmetry and mitigates
singularity and overfitting in high-dimensional or small-sample settings.
Classification can be performed using plug-in, predictive, debiased,
or leave-one-out cross-validation rules via predict.gipsqda.
An object of class "gipsqda" containing the following components:
prior: prior probabilities of the groups
counts: number of observations in each group
means: group means
scaling: group-specific scaling matrices derived from the
projected covariance matrices
ldet: log-determinants of the projected covariance matrices
lev: class labels
N: total number of observations
optimization_info: information returned by the covariance
projection optimizer
call: the matched call
The function may be called with either a formula interface or with a matrix
and grouping factor. Arguments subset and na.action, if used,
must be named.
Chojecki, A., et al. (2025). Learning Permutation Symmetry of a Gaussian Vector with gips in R. Journal of Statistical Software, 112(7), 1–38. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v112.i07")}
Venables, W. N. and Ripley, B. D. (2002). Modern Applied Statistics with S. Fourth edition. Springer.
qda, predict.gipsqda,
gipslda, lda
tr <- sample(1:50, 25)
train <- rbind(iris3[tr, , 1], iris3[tr, , 2], iris3[tr, , 3])
test <- rbind(iris3[-tr, , 1], iris3[-tr, , 2], iris3[-tr, , 3])
cl <- factor(c(rep("s", 25), rep("c", 25), rep("v", 25)))
z <- gipsqda(train, cl)
predict(z, test)$class
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.