Learn R Programming

rotations (version 1.6.5)

rotdist.sum: Sample distance

Description

Compute the sum of the \(p^{th}\) order distances between each row of x and S.

Usage

rotdist.sum(x, S = genR(0, space = class(x)), method = "extrinsic", p = 1)

# S3 method for SO3 rotdist.sum(x, S = id.SO3, method = "extrinsic", p = 1)

# S3 method for Q4 rotdist.sum(x, S = id.Q4, method = "extrinsic", p = 1)

Value

The sum of the pth order distance between each row of x and S.

Arguments

x

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

S

the individual matrix of interest, usually an estimate of the mean.

method

type of distance used method in "extrinsic" or "intrinsic"

p

the order of the distances to compute.

See Also

rot.dist

Examples

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

SE1 <- median(Rs)                      #Projected median
SE2 <- mean(Rs)                        #Projected mean
SR2 <- mean(Rs, type = "geometric")    #Geometric mean

#I will use "rotdist.sum" to verify these three estimators minimize the
#loss function they are designed to minimize relative to the other esimators.
#All of the following statements should evaluate to "TRUE"

#The projected mean minimizes the sum of squared Euclidean distances
rotdist.sum(Rs, S = SE2, p = 2) < rotdist.sum(Rs, S = SE1, p = 2)
rotdist.sum(Rs, S = SE2, p = 2) < rotdist.sum(Rs, S = SR2, p = 2)

#The projected median minimizes the sum of first order Euclidean distances
rotdist.sum(Rs, S = SE1, p = 1) < rotdist.sum(Rs, S = SE2, p = 1)
rotdist.sum(Rs, S = SE1, p = 1) < rotdist.sum(Rs, S = SR2, p = 1)

#The geometric mean minimizes the sum of squared Riemannian distances
rotdist.sum(Rs, S = SR2, p = 2, method = "intrinsic") <
                 rotdist.sum(Rs, S = SE1, p = 2, method = "intrinsic")
rotdist.sum(Rs, S = SR2, p = 2, method = "intrinsic") <
                 rotdist.sum(Rs, S = SE2, p = 2, method = "intrinsic")

Run the code above in your browser using DataLab