50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

rotations (version 1.6.1)

mean: Mean rotation

Description

Compute the sample geometric or projected mean.

Usage

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

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

Arguments

x

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

type

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

epsilon

stopping rule for the geometric-mean.

maxIter

maximum number of iterations allowed for geometric-mean.

...

additional arguments.

Value

Estimate of the projected or geometric mean of the sample in the same parametrization.

Details

This function takes a sample of 3D rotations (in matrix or quaternion form) and returns the projected arithmetic mean denoted \bmS^P or geometric mean \bmS^G according to the type option. For a sample of n rotations in matrix form \bmRiSO(3),i=1,2,,n, the mean-type estimator is defined as \bmS^=argmin\bmSSO(3)i=1nd2(\bmRi,\bmS) where d is the Riemannian or Euclidean distance. For more on the projected mean see moakher02 and for the geometric mean see manton04. For the projected mean from a quaternion point of view see tyler1981.

tyler1981, moakher02, manton04

See Also

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

Examples

Run this code
# NOT RUN {
Rs <- ruars(20, rvmises, kappa = 0.01)

# Projected mean
mean(Rs)

# Same as mean(Rs)
project.SO3(colMeans(Rs))

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

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

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

# Same thing with quaternion form
Qs <- as.Q4(Rs)
mean(Qs)
mean(Qs, type = "geometric")
rot.dist(mean(Qs))
rot.dist(mean(Qs, type = "geometric"))
# }

Run the code above in your browser using DataLab