Last chance! 50% off unlimited learning
Sale ends in
geo_median(P, tol = 1e-07, maxiter = 200)
x_i
-coordinates in the ith column.p
the coordinates of the solution
point, d
the sum of distances to all the sample points, reltol
the relative tolerance of the iterative process, and niter
the
number of iterations.
If the dimension is 1 (one column), the median will be returned.
L1linreg
# Generate 100 points on the unit sphere in the 10-dim. space
set.seed(1001)
P <- rands(n=100, N=9)
( sol <- geo_median(P) )
# $p
# [1] -0.009481361 -0.007643410 -0.001252910 0.006437703 -0.019982885 -0.045337987
# [7] 0.036249563 0.003232175 0.035040592 0.046713023
# $d
# [1] 99.6638
# $reltol
# [1] 3.069063e-08
# $niter
# [1] 10
Run the code above in your browser using DataLab