centroids {sda}R Documentation

Group Centroids, (Pooled) Variances, and Powers of the Pooled Correlation Matrix

Description

centroids computes group centroids and optionally the pooled mean and pooled variance, the group specific variances, and powers of the pooled correlation matrix.

Usage

centroids(x, L, mean.pooled=FALSE, var.pooled=TRUE, var.groups=FALSE, 
  powcor.pooled=FALSE, alpha=1, shrink=FALSE, verbose=TRUE)

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.
mean.pooled Estimate the pooled mean.
var.pooled Estimate the pooled variances.
var.groups Estimate all group-specific variances.
powcor.pooled Estimate pooled correlation matrix (taken to the power of alpha).
alpha exponent for the pooled correlation matrix (default: alpha=1).
shrink Use empirical or shrinkage estimator.
verbose Provide some messages while computing.

Details

If option shrink=TRUE then the shrinkage estimators var.shrink from Opgen-Rhein and Strimmer (2007) and cor.shrink from Sch"afer and Strimmer (2005) are used.

Value

centroids returns a list with the following components:

samples a vector containing the samples sizes in each group,
means the empirical group means,
mean.pooled the pooled empirical mean,
var.pooled a vector containing the pooled variances,
var.groups a matrix containing the group-specific variances, and
powcor.pooled a matrix containing the pooled correlation matrix to the power of alpha (if all correlations are zero a vector containing only the is returned to save space).
alpha exponent for the pooled correlation matrix.

Author(s)

Korbinian Strimmer (http://strimmerlab.org).

See Also

var.shrink, powcor.shrink.

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)

## show pooled mean
centroids(X, Y, mean.pooled=TRUE)

## compute group-specific variances
centroids(X, Y, var.groups=TRUE)

## and inverse pooled correlation
centroids(X, Y, var.groups=TRUE, powcor.pooled=TRUE, alpha=-1)

## use shrinkage estimator for variances and correlations
centroids(X, Y, var.groups=TRUE, powcor.pooled=TRUE, alpha=-1, shrink=TRUE)

[Package sda version 1.1.0 Index]