mediancenter | R Documentation |
It calculates the mediancenter (or geometric median) of multivariate data.
mediancenter(x)
x |
a matrix or data frame. As usual, rows are observations and columns are variables. |
The mediancenter for a sample of multivariate observations is computed using a steepest descend method combined with bisection. The mediancenter invariant to rotations of axes and is useful as a multivariate generalization of the median of univariate sample.
A list containing the following named components:
median |
an estimate for the mediancenter of the data. |
iter |
the number of iterations performed, it is negative if a degenerate solution is found. |
Gower, J.C. (1974). Algorithm AS 78: The mediancentre. Applied Statistics 23, 466-470.
cov.wt
, median
.
x <- cbind(1:10, c(1:3, 8:5, 8:10))
z <- mediancenter(x)$median # degenerate solution
xbar <- colMeans(x)
plot(x, xlab = "", ylab = "")
points(x = xbar[1], y = xbar[2], pch = 16, col = "red")
points(x = z[1], y = z[2], pch = 3, col = "blue", lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.