Arguments
x
A matrix containing the data set. Note that
the rows are sample observations and the columns
are variables.
L
A factor with the group labels.
lambda.var
Shrinkage intensity for the variances. If not specified it is
estimated from the data, see details below. lambda.var=0
implies no shrinkage
and lambda.var=1
complete shrinkage.
lambda.freqs
Shrinkage intensity for the frequencies. If not specified it is
estimated from the data. lambda.freqs=0
implies no shrinkage (i.e. empirical frequencies)
and lambda.freqs=1
complete shrinkage (i.e. uniform frequencies).
var.groups
Estimate group-specific variances.
centered.data
Return column-centered data matrix.
verbose
Provide some messages while computing.
Examples
# load sda library
library("sda")
## prepare data set
data(iris) # good old iris data
X = as.matrix(iris[,1:4])
Y = iris[,5]
## estimate centroids and empirical pooled variances
centroids(X, Y, lambda.var=0)
## also compute group-specific variances
centroids(X, Y, var.groups=TRUE, lambda.var=0)
## use shrinkage estimator for the variances
centroids(X, Y, var.groups=TRUE)
## return centered data
xc = centroids(X, Y, centered.data=TRUE)$centered.data
apply(xc, 2, mean)
## useful, e.g., to compute the inverse pooled correlation matrix
powcor.shrink(xc, alpha=-1)