clr(x)_j = log(x_j / (prod_l x_l)^(1/D)); the spatial median of the clr scores minimises sum_i ||clr(x_i) - m|| and is found by the Weiszfeld iteration m <- sum_i y_i/d_i / sum_i 1/d_i. The estimate is mapped back to the simplex by the inverse clr.
References
Filzmoser and Hron (2008), Mathematical Geosciences 40(3), 233-248; clr is Aitchison's transform and the spatial median is Weiszfeld's (1937).
Examples
M <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)
Clrmedian(M)
#> $median
#> [1] 0.1365659 0.3345167 0.5289174
#>
#> $clrmed
#> [1] -0.7499683 0.1459115 0.6040568
#>
#> $objective
#> [1] 0.3814209
#>
#> $clrmean
#> [1] -0.7499683 0.1459115 0.6040568
#>
#> $n
#> [1] 2
#>
#> $D
#> [1] 3
#>
#> $steps
#> [1] 100
#>
#> $method
#> [1] "Spatial median in clr coordinates (Weiszfeld iteration)"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
