The biwt package includes a base function to compute multivariate location, scale, and correlation estimates based on Tukey's biweight M-estimator. Using the base function, the computations can be applied to a large number of observations to create either a matrix of biweight distances or biweight correlations.
The primary functions in the biwt package are:
biwt.estbiwt_estbiwt.corbiwt_corbiwt_cor_matrixbiwt_dist_matrixRunning the following lines of code in R will install this package from Github:
library(devtools)
devtools::install_github(repo = "hardin47/biwt")
See documentation.pdf for information on how to use this package. A portion of the example given in the documentation is reproduced below for convenience.
set.seed(4747)
samp.data <- MASS::mvrnorm(30, mu=c(0,0,0),
Sigma=matrix(c(1,.75,-.75,.75,1,-.75,-.75,-.75,1),
ncol=3))
r<-0.2 # breakdown
biwt.cor(samp.data[,1:2], r=.2)$biwt.cor
biwt.cor(samp.data[,c(1,3)], r=.2)$biwt.cor
biwt.cor(samp.data[,c(2,3)], r=.2)$biwt.cor
biwt.cor(samp.data, r=.2)
biwt.cor.matrix(samp.data, r=.2)
biwt.dist.matrix(samp.data, r=.2, absval=TRUE)
biwt.dist.matrix(samp.data, r=.2, absval=FALSE)
See DESCRIPTION for information.
Johanna Hardin