# Compute a location estimate of a two-dimensional dataset.
data(bloodfat)
result <- sprojmedian(x = bloodfat)
plot(bloodfat, pch = 16)
points(result$max, col = "red", pch = 18, cex = 1.5)
# Options for the underlying sprojdepth routine may be passed
# using the options argument.
result <- sprojmedian(x = bloodfat,
options = list(type = "Rotation",
ndir = 1000
)
)
plot(bloodfat, pch = 16)
points(result$max, col = "red", pch = 18, cex = 1.5)
# One may also compute the depth values of the observations in the data
# separately. This avoids having to recompute them when computing the median.
depth.result <- sprojdepth(x = bloodfat)
result <- sprojmedian(x = bloodfat,
sprojection.depths = depth.result$depthX)
Run the code above in your browser using DataLab