ldaHmat {subselect} | R Documentation |
Computes total and between-group matrices of Sums of Squares and Cross-Product (SSCP) deviations in linear discriminant analysis. These matrices may be used as input to the variable selection search routines anneal
, genetic
improve
or leaps
.
## Default S3 method: ldaHmat(x,grouping,...) ## S3 method for class 'data.frame': ldaHmat(x,grouping,...) ## S3 method for class 'formula': ldaHmat(formula,data=NULL,...)
x |
A matrix or data frame containing the discriminators for which the SSCP matrix is to be computed. |
grouping |
A factor specifying the class for each observation. |
formula |
A formula of the form 'groups ~ x1 + x2 + ...'
That is, the response is the grouping factor and the right hand side
specifies the (non-factor) discriminators. |
data |
Data frame from which variables specified in 'formula' are preferentially to be taken. |
... |
further arguments for the method. |
A list with four items:
mat |
The total SSCP matrix |
H |
The between-groups SSCP matrix |
r |
The expected rank of the H matrix which equals the minimum between the number of discriminators and the number of groups minus one. The true rank of H can be different from r if the discriminators are linearly dependent. |
call |
The function call which generated the output. |
anneal
, genetic
,
improve
, leaps
, lda
.
##-------------------------------------------------------------------- ## An example with a very small data set. We consider the Iris data ## and three groups, defined by species (setosa, versicolor and ## virginica). data(iris) ldaHmat(iris[1:4],iris$Species)