biwt-package {biwt} | R Documentation |
A package to compute the biweight mean vector and covariance & correlation matrices
Description
Compute multivariate location, scale, and correlation estimates based on Tukey's biweight weight function.
Details
Package: | biwt |
Type: | Package |
Version: | 1.0 |
Date: | 2009-07-20 |
License: | GPL-2 |
LazyLoad: | yes |
The two basic functions (1) calculate multivariate estimates of location and shape based on Tukey's biweight, and (2) compute correlations based on the biweight. The correlation functions also have options to output the data as a correlation matrix or a distance matrix (typically one minus the correlation or one minus the absoulte correlation). Once the output is in a distance matrix, it can easily be converted (as.dist() ) to an object of the class "dist" which stores the lower triangle of the correlation matrix in a vector. Many clustering algorithms take as input objects of the class "dist".
Author(s)
Jo Hardin jo.hardin@pomona.edu
Maintainer: Jo Hardin jo.hardin@pomona.edu
References
Hardin, J., Mitani, A., Hicks, L., VanKoten, B.; A Robust Measure of Correlation Between Two Genes on a Microarray, BMC Bioinformatics, 8:220; 2007.
See Also
Examples
### To calculate the multivariate location vector and scale matrix:
samp.data <- t(mvrnorm(30,mu=c(0,0),Sigma=matrix(c(1,.75,.75,1),ncol=2)))
samp.bw <- biwt.est(samp.data)
samp.bw
samp.bw.var1 <- samp.bw$biwt.sig[1,1]
samp.bw.var2 <- samp.bw$biwt.sig[2,2]
samp.bw.cov <- samp.bw$biwt.sig[1,2]
samp.bw.cor <- samp.bw$biwt.sig[1,2] /
sqrt(samp.bw$biwt.sig[1,1]*samp.bw$biwt.sig[2,2])
samp.bw.cor
### To calculate the correlation(s):
samp.data <- t(mvrnorm(30,mu=c(0,0,0),
Sigma=matrix(c(1,.75,-.75,.75,1,-.75,-.75,-.75,1),ncol=3)))
# To compute the 3 pairwise correlations from the sample data:
samp.bw.cor <- biwt.cor(samp.data, output="vector")
samp.bw.cor
# To compute the 3 pairwise correlations in matrix form:
samp.bw.cor.mat <- biwt.cor(samp.data)
samp.bw.cor.mat
# To compute the 3 pairwise distances in matrix form:
samp.bw.dist.mat <- biwt.cor(samp.data, output="distance")
samp.bw.dist.mat
# To convert the distances into an object of class `dist'
as.dist(samp.bw.dist.mat)