Learn R Programming

rotations (version 1.6.5)

median: Median rotation

Description

Compute the sample projected or geometric median.

Usage

# S3 method for SO3
median(
  x,
  na.rm = FALSE,
  type = "projected",
  epsilon = 1e-05,
  maxIter = 2000,
  ...
)

# S3 method for Q4 median( x, na.rm = FALSE, type = "projected", epsilon = 1e-05, maxIter = 2000, ... )

Value

Estimate of the projected or geometric median in the same parametrization.

Arguments

x

\(n\times p\) matrix where each row corresponds to a random rotation in matrix form (\(p=9\)) or quaternion (\(p=4\)) form.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

type

string indicating "projected" or "geometric" type mean estimator.

epsilon

stopping rule.

maxIter

maximum number of iterations allowed before returning most recent estimate.

...

additional arguments.

Details

The median-type estimators are defined as $$\widetilde{\bm{S}}=argmin_{\bm{S}\in SO(3)}\sum_{i=1}^nd(\bm{R}_i,\bm{S}).$$ If the choice of distance metric \(d\) is Riemannian then the estimator is called the geometric median, and if the distance metric in Euclidean then it is called the projected median. The algorithm used in the geometric case is discussed in hartley11 and the projected case is in stanfill2013.

hartley11 stanfill2013

See Also

mean.SO3, bayes.mean, weighted.mean.SO3

Examples

Run this code
Rs <- ruars(20, rvmises, kappa = 0.01)

# Projected median
median(Rs)

# Geometric median
median(Rs, type = "geometric")

# Bias of the projected median
rot.dist(median(Rs))

# Bias of the geometric median
rot.dist(median(Rs, type = "geometric"))

Qs <- as.Q4(Rs)

# Projected median
median(Qs)

# Geometric median
median(Qs, type = "geometric")

# Bias of the projected median
rot.dist(median(Qs))

# Bias of the geometric median
rot.dist(median(Qs, type = "geometric"))

Run the code above in your browser using DataLab