You are on page 1of 118

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/228391025

Statistical Analysis of Orientation Trajectories via Quaternions with Applications


to Human Motion

Article

CITATIONS READS

11 437

2 authors, including:

Matthew P Reed
University of Michigan
283 PUBLICATIONS   2,477 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Humosim View project

All content following this page was uploaded by Matthew P Reed on 20 December 2013.

The user has requested enhancement of the downloaded file.


Statistical Analysis of Orientation Trajectories via
Quaternions with Applications to Human Motion

by
Su Bang Choe

A dissertation submitted in partial fulfillment


of the requirements for the degree of
Doctor of Philosophy
(Statistics)
in The University of Michigan
2006

Doctoral Committee:
Professor Julian J. Faraway, Chair
Professor Robert W. Keener
Associate Professor Bernard J. Martin
Assistant Professor Ji Zhu
Associate Research Scientist Matthew P. Reed
Su Bang Choe 2006
c

All Rights Reserved
To my parents

ii
ACKNOWLEDGEMENTS

First of all, I’d like to thank Professor Faraway for his advice and guidance

throughtout these many years. His patience and sometimes much needed prodding,

are the main reasons I’ve finally made the finish line. I need to thank the HUMOSIM

laboratory (and its sponsoring partners) for providing me with the analysis problem

that ultimately led to this research. I’d like to also thank my dissertation committee

members for their helpful comments and insightful critique. Collaboration and dis-

cussion with fellow HUMOSIM students — especially, Kyunghan Kim, Woojin Park

and Jing Wang, were important sources of inspiration and I would like to thank them

as well. Finally, I’d like to thank my wife for her love and support without which, I

could not have undertaken this.

iii
TABLE OF CONTENTS

DEDICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii

ACKNOWLEDGEMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi

LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

CHAPTER

I. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

II. Orientation Parameterizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1 Rotation and Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


2.2 Rotation Parameterizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Rotation Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Euler Angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.3 Axis-Angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.4 Quaternions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

III. Statistical Analysis of Orientations . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.1 Human Kinematic Data: Links, Joints and Co-ordinate Frames . . . . . . . 21


3.2 The “Angle of Rotation” Metric for Orientations and the “Mean” Orientation 25
3.3 The Tangent Mapping Approach . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3.1 Exponential and Logarithm maps for Quaternions . . . . . . . . . . 29
3.3.2 Distribution Theory on the Tangent Space . . . . . . . . . . . . . . 32
3.3.3 Joint Range of Motion Limits . . . . . . . . . . . . . . . . . . . . . 34
3.3.4 Interpolation and Smoothing . . . . . . . . . . . . . . . . . . . . . 36
3.3.5 Hemisphere Commonization and Data Concentration: The Slerp
Residual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.6 Functional Regression Modelling of Orientation Trajectories . . . . 43
3.4 The Constraint Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.4.1 Distribution Theory on S 3 . . . . . . . . . . . . . . . . . . . . . . . 52
3.4.2 Interpolation and Smoothing on S 3 . . . . . . . . . . . . . . . . . . 53
3.4.3 Regression Models on S 3 . . . . . . . . . . . . . . . . . . . . . . . . 56
3.4.4 The Quaternion ANOVA model —QANOVA . . . . . . . . . . . . 57
3.4.5 Simulated Power Study . . . . . . . . . . . . . . . . . . . . . . . . . 62

IV. Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

iv
4.1 An Orientation Trajectory Model for the Right Hand in Unladen Reaches . . 67
4.1.1 Purpose of Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.1.2 Description of Experiment . . . . . . . . . . . . . . . . . . . . . . . 67
4.1.3 Data Preparation and Fitting of the Speed-Adjusted Slerp Residual
Functional Regression Model . . . . . . . . . . . . . . . . . . . . . 73
4.1.4 Functional QANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.1.5 Joint Limit Estimation . . . . . . . . . . . . . . . . . . . . . . . . . 86

V. Discussion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

APPENDICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

v
LIST OF FIGURES

Figure

2.1 Illustration of roll, pitch and yaw with a 3D sailboat obtained from the Orientlib
package in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.2 Illustration of a gimbal with three rings . . . . . . . . . . . . . . . . . . . . . . . . 13

3.1 Illustration of the HUMOSIM linkage system. The reference posture shows the
human figure standing erect, facing forward and holding the arms outstretched to
the sides parallel to the ground with palms facing downward. Each body segment’s
local co-ordinate system is shown aligned with the global co-ordinate system marked
as “X0-Y0-Z0” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.2 Illustration of the exponential map and the logarithm map which allows us to move
between quaternions which are on the surface of the sphere to points on the tangent
space taken at the identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.3 Illustration of the Tangent Gaussian distribution in lower dimensions. . . . . . . . 33

3.4 Illustration of the potential problem in using the flipping algorithm on an orien-
tation trajectory that exists on the boundary between hemispheres. The original
trajectory starts in the upper hemisphere and curves down to the lower hemisphere
before returning back to the upper hemisphere. Using the flipping algorithm we
would flip our “smile” on the lower hemisphere to the other side of the sphere to
create a “frown” on the upper hemisphere. . . . . . . . . . . . . . . . . . . . . . . . 40

3.5 Illustration of the slerp model and the slerp residuals. The slerp model(a) gives the
shortest trajectory on the sphere between two points. The slerp residuals (b) are
the rotations, shown as arrows, that take us from the slerp trajectory to the actual
observed trajectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

3.6 Plots of power versus θ for the one-way functional QANOVA simulation study. We
have two curves for the two different term orderings and a curve for the likelihood
ratio test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

3.7 Plots of power versus θ for the second simuation study. We have three curves for
the different QANOVA term orderings and one for the likelihood ratio test. . . . . 66

4.1 Illustration of how the user will place target “hand-prints” for the human model to
reach to. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

vi
4.2 Illustration of experiment setup. (a) Each cluster consists of five blocks. The blocks
were color-coded and the subject was asked to grip the block with the thumb on a
selected color side. (b)Three clusters were placed at different heights on a tower.
(c)The tower was then placed in four positions: 45◦ to the left, forward, 45◦ to the
right, 90◦ to the right. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

4.3 Illustration of placement of optical markers (shown as circles) and electromagnetic


sensors (shown as squares) on a subject . . . . . . . . . . . . . . . . . . . . . . . . 71

4.4 Illustration of the marker positions for the HUMOSIM linkage system. For our
experiment we will not have any of the markers below the hip. . . . . . . . . . . . 72

4.5 “Handplot” of the neutral orientation. The conical cylinder shows the forearm
aligned parallel to the x-axis. The hand is, in turn, aligned to the fore arm with
the palm facing downwards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

4.6 Histograms of the difference in the start cutoff points and end cutoff points between
rotational and translational motion defined as ∆ = Rotation − Translation. The
units are the number of frames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

4.7 Plot of a typical angular speed profile. . . . . . . . . . . . . . . . . . . . . . . . . . 78

4.8 Illustration of spherical co-ordinates r, θ, φ. Adapted from Weisstein (2006) . . . . 80

4.9 Picture depicting the local orientation of the hand with respect to the forearm
(forearm remains stationary), a “handplot”, for a reach where the first order model
fit showed a 10◦ DTW difference with the actual observed trajectory. The speed-
adjusted slerp trajectory is also shown. The frames are equally spaced in the time
domain. Most of the noticeable difference occurs in the second and third frames. . 82

4.10 Plot of 5th, 50th and 95th percentile DTW distance for the first order model and the
slerp model by Rdist class. The Rdist variable measures the angle of rotation metric
between the orientation of the hand at the target with the “neutral” orientation.
We grouped the data into 20 separte classes based on the Rdist. . . . . . . . . . . . 84

4.11 Ellipsoidal Joint Range of Motion Limit estimated from our terminal local orientations 89

4.12 25 sampled points from our Ellipsoidal Joint Range of Motion Limit . . . . . . . . 89

4.13 Handplots of the 25 sampled points from our Ellipsoidal Joint Range of Motion
Limit. Using a matrix index to identify a plot, e.g. [2,4] is the plot that is on the
second row and fourth column, we identify those that appear to be impossible —
[1,4], [2,1] and [2,4], and those that appear not to be on the joint limit boundary
— [3,3] and [3,4] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

4.14 Plot of mahalanobis distance versus weight of subject. Males are indicated by “M”
and females are indicated by “F”. The regression line for males is given by the solid
line while the one for females is given by the dashed line. It appears as if wrist
flexibility increases with weight for females while the opposite holds true for males. 92

5.1 Combined reach trajectory predicted by our model to a target from the HUMOSIM
experiment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

vii
LIST OF TABLES

Table

4.1 Anthropometry of subjects in Terminal Hand Orientation and Effort Reach Study,
2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

4.2 DTW distance as compared to actual observed local quaternion trajectory . . . . . 81

4.3 DTW distance for the different models when data are subdivided by angular dis-
tance to target orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

viii
CHAPTER I

Introduction

The study of object motion in three dimensional space occurs in a wide variety

of areas. Examples can be found in human kinematics, plate tectonics, and even

vectorcardiography, but one can easily think of other instances where such data

occur. Any rigid object moving through three dimensional space will have six degrees

of freedom associated with its motion: three for its position in space and three for its

orientation. Positional data are likely to be more familiar, especially if represented

using Cartesian co-ordinates. The space of such co-ordinates is Euclidean IR3 and

linear algebra techniques for working in such a space are taught at an elementary

college level.

Orientation data are more complex, however, and some introduction is required.

The orientation of any rigid body can be thought of as the end product of a rota-

tion of some reference frame in IR3 and is represented as such. The standard way

of representing rotations is by way of rotation matrices (sometimes called Direction

Cosine Matrices), but alternatives exist. One such alternative parameterization us-

ing Euler angles is popular as these angles are easier to visualize, but this form of

parametrization suffers from a few problems. Another method involves the use of

quaternions, a form of hyper-complex number first introduced by Hamilton (1866).

1
2

In chapter 2 we introduce these competing parameterizations and explain why the

quaternion parameterization was chosen.

Much of the statistical literature related to orientation focuses exclusively on ro-

tation matrices including some theoretical (see Downs (1972), Khatri and Mardia

(1977)) and applied work (see Chang (1986)). This literature is inter-related with

results obtained from directional statistics (see Bingham (1974), Watson (1983), Jupp

and Mardia (1989), Mardia and Jupp (2000)) and can be considered as a corollary of

it. Prentice (1986) was the first to introduce quaternions for statistical analysis. His

work focused on translating the existing theory on rotation matrices to the quater-

nion parameterization; converting the orientation problem back to a directional one

but in a higher dimension. Still, the statistical literature in this area is sparse, but

the computer graphics and animation field has produced a wealth of resources. The

rising popularity of video games, computer-animated films and computer-generated

special effects has resulted in a substantial amount of study of orientation repre-

sentations. Shoemake (1985) introduced quaternions as a method for representing

orientations to the computer graphics world. Much of the work that followed was

geared towards creating better and faster interpolation algorithms which was impor-

tant for animation applications.

The current research is focused on applications in the area of human kinematics.

Specifically we seek to predict human motion via a statistical model under a range of

input conditions. Motion data can be analyzed as functions over time, which requires

the adaptation of functional analysis techniques (see Ramsay and Silverman (1997))

for use with orientation data. Functional regression analysis of orientation data, as

a result, is a key concept of this research. This work can be used in areas besides

human kinematics as most orientation data result from the study of some object’s
3

motion. These new methods are described in Chapter 3 along with relevant work

from the literature that these methods draw upon.

The data and impetus for this research comes from the Human Motion Simula-

tion Laboratory (HUMOSIM) at the University of Michigan. Over the years the

lab has accumulated a large motion capture database (over 72,000 motions) from

numerous studies of test-oriented human motion. A wide variety of individuals have

participated such that we can assess the effects of body dimensions, gender and age.

A majority of the motions are load-transfers and reach tasks. By considering body

segments such as the hand or the head as objects moving through three dimensional

space, we can use the methods in chapter 3 to model the orientation trajectory of

the segment during a motion. In chapter 4, we describe the orientation trajectory

model for the right hand in unladen reach motions as an application of our methods.

The purpose of the model is to predict the orientation trajectory of the right hand

for a variety of reach tasks given a beginning and target orientation, as well as a

subject’s anthropometric information. This model forms part of the “HUMOSIM

Framework”, a modular approach to human motion simulation.


CHAPTER II

Orientation Parameterizations

In this chapter we will describe the mathematical theory behind the concepts of

three-dimensional spatial rotation and orientation. There are many ways to param-

eterize rotations, each with its own set of advantages and disadvantages. To fully

understand these issues we will describe spatial rotation from the beginning starting

with Euler’s Theorem. We will describe four parameterizations that are popular in

the human motion/animation field. These are:

1. Rotation Matrix

2. Euler Angles

3. Axis-Angle

4. Quaternions

We will pay particular attention to quaternions, our parameterization of choice,

providing a detailed introduction to the quaternion hyper-complex algebra. The

other three are described briefly with particular emphasis on interpolation, metrics,

ease-of-use and robustness. Based on these criteria, we explain why quaternions are

best suited for our purposes.

4
5

2.1 Rotation and Orientation

We live and operate in a three dimensional world and since we interact with

rigid body objects everyday the concept of spatial rotation and orientation is highly

intuitive. Unfortunately, the mathematics involved are not and will need some ex-

planation.

First of all we need to distinguish between rotation and orientation. Many peo-

ple use these terms interchangeably but there is a subtle difference. Rotation is a

transformation that changes one vector to another such that:

• The magnitude of the vector is preserved.

• The handedness of the vector is preserved which, in mathematical terms, means

that the direction of the cross products of the basis vectors are preserved i.e.

there is no reflection.

Orientation is the attitude of a rigid body in space and is expressed as a rotation

with respect to a fixed co-ordinate frame. Thus an orientation can be thought of as

the end product of a rotation from some other reference orientation.

Euler’s Rotation Theorem states that every orientation can be described as a

rotation by some angle θ about some fixed axis a. In other words we can obtain any

orientation by a single rotation from any other orientation. The axis provides us

with the direction and the angle provides us with the magnitude.

We can see that this angle can serve us nicely as a distance metric between orien-

tations and is in fact the natural group metric for rotations. One further result we

can use from Euler’s Rotation Theorem is that there are three degrees of freedom

associated with spatial rotations — two for the axis1 and one for the angle.
1 since length does not matter it can be represented as two angles i.e. spherical coordinates
6

Concatenating rotations2 needs to be handled carefully because rotation is non-

commutative. To illustrate this, form three orthogonal axes with your right hand

with your thumb pointing upward, your index finger pointing forward and your

middle finger pointing to the left. Rotate 90 degrees counter clockwise around your

thumb axis and your index finger should now be pointing to the left. Next, rotate

90 degrees counter clockwise around your middle finger and the end result is that

your index finger will be pointing downward. If we were to swap the order of the two

rotations and do the middle finger rotation first (index finger will point downward)

followed by the thumb rotation we will in the end have our index finger pointing to

the left, obtaining a different end orientation.

2.2 Rotation Parameterizations


2.2.1 Rotation Matrix

A 3 × 3 matrix M is considered a rotation matrix if and only if:

(2.1) MT M = I,

(2.2) det M = +1.

The first condition implies that a rotation matrix is orthogonal, i.e. it consists of

orthogonal column vectors each of unit magnitude. The set of all 3 × 3 orthogonal

matrices are denoted as O(3) (an example of a Steifel manifold3 ) where the SO

stands for special orthogonal. There are two possible subsets of O(3) — one for

those matrices with det = +1 and another for those with det = −1. The latter are

sometimes known as rotoinversion matrices as they change the handedness of the

vector it is applied to. The former preserves handedness and this subset it denoted

as SO(3).
2 Concatenation involves performing multiple rotations on the same object
3 The Steifel manifold Vr (IRp ) is the space of p × r matrices X such thatVr (IRp ) = {X : XT X = Ir }
7

A rotation matrix M ∈ SO(3) will transform a vector x ∈ IR3 to a new vector

(2.3) y = Mx

by rotating it and preserving its magnitude.

If we know the basis for the newly rotated space with respect to the original basis

we can easily create the rotation matrix —the basis vectors form the columns of the

matrix, i.e.,
 
 | | | 
 
(2.4) M =  x̂new ŷnew ẑnew
 

 
 
| | |

where x̂new , ŷnew and ẑnew are the rotated basis column vectors.

Concatenation is handled through matrix multiplication. If M1 is the first rotation

to be applied and M2 is the second then the resulting combined rotation matrix is

given by

(2.5) M21 = M2 M1

Note that since we are using column vectors the order of rotation is read from

right to left. Non-commutativity can easily be seen mathematically as

(2.6) M2 M1 6= M1 M2

It is not straight-forward to relate a rotation matrix to Euler’s Rotation Theorem.

The axis of rotation can be obtained from performing an eigen decompostion of

the matrix. The axis is given as the eigenvector associated with the unit eigenvalue.
8

The other two eigenvectors are complex and thus will have complex eigenvalues. The

angle of rotation can be obtained using a somewhat circuitous method. We take an

arbitrary unit vector x ∈ IR3 and then rotate it using our rotation matrix to obtain

y = Mx. The rotation angle is then given by

(2.7) θ = arccos(x · y)

The main advantage of the matrix representation is its mathematical robustness.

This stems from the fact that rotations are defined by this representation. As a result

it is the only parameterization that will uniquely represent a given rotation, i.e. there

is a 1-to-1 mapping between SO(3) and the space of rigid body rotations. Another

advantage is the familiarity of matrix algebra as it forms part of all early level linear

algebra courses. Much of the literature that exists for orientation statistics deals

exclusively with the matrix parameterization.

Unfortunately there are some disadvantages of using this representation. First

of all, we are using nine parameters to describe something with three degrees of

freedom. This means there are six constraints — three to maintain unit length of

the columns and three to enforce mutual orthogonality. This inherent inefficiency

can lead to data storage issues especially in human motion where just a single motion

file is the size of an entire dataset in many fields.

There are computational issues as well. For instance, performing numerous con-

catenations could lead to round-off error accumulating to such an extent that the re-

sulting matrix is no longer in SO(3). We will have to use re-normalization algorithms

such as the Gram-Schmidt which are not straightforward and can be computationally

expensive if we have to do them frequently.

Due to the numerous constraints, interpolation of matrices is also difficult and the

fact that SO(3) is not a vector space makes most interpolators which use the convex
9

sum:

(2.8) αM1 + (1 − α)M2

not work as the interpolated matrices would not be in SO(3).

2.2.2 Euler Angles

Euler angles represents rotation by first factorizing the rotation into a series of

three sequential rotations around the principal axes (x,y,z) and then enumerating

the three angles involved. These rotations in matrix form are as follows:
 
 1 0 0 
 
(2.9) Mx =  0 cos α sin α  ,
 
 
 
0 − sin α cos α
 
 cos β 0 − sin β 
 
(2.10) My =  0 ,
 
 1 0 
 
sin β 0 cos β
 
 cos γ sin γ 0 
 
(2.11) Mz =  − sin γ cos γ 0 .
 
 
 
0 0 1

where α is the angle around the x-axis, β is the angle around the y-axis and γ is the

angle around the z-axis.

Any sequence of these three rotations such that no two consecutive rotations are

around the same axis can be deemed as a possible Euler angle definition and is known

in the literature as an Euler angle set. There are twelve such sets in all — the first

six use all three principal axes and are sometimes known as Cardan angles: XYZ,

YZX, ZXY, ZYX, XZY and YXZ while the other six have its first and last rotations
10

about the same axis: XYX, YZY, ZXZ, XZX, XYX and YXY and are read in the

order the rotation is applied.

There exists yet another distinction that tends to cause confusion and it is in the

way the principal axes are treated. To illustrate this we will use the XYZ Euler

angle set as an example. One way to implement this set is to think of the three

principal axes to be fixed globally and thus the object is rotated through the global

x-axis then the global y-axis and finally the global z-axis. The other way is to treat

the principal axes as fixed to the object itself and thus these axes themselves rotate

with the object. So using this local axes method we would rotate the object first

around its own x-axis then around the y-axis which has changed due to the previous

x rotation and finally around the resulting z-axis obtained after the y rotation.

One can easily show that the local axes XYZ set is the same as the global axes

ZYX set. Note once again that these are read in the order the rotations are applied

which is opposite the order in which the matrices are multiplied.

Let Rz be the matrix representing rotation around the global z-axis, Ry be the

one for the global y-axis and finally Rx be the one for the global x-axis in the global

axes ZYX set. Other than the first rotation, both subsequent rotations will require

change of basis operators such that we rotate in the axes of the original frame. Thus

we obtain the following:

(2.12) Rz = Mz ,

(2.13) Ry = Mz My M−1
z ,

(2.14) Rx = Mz My Mx M−1 −1
y Mz .

When we then multiply these rotation matrices together to perform the rotation
11

we prove the result.

(2.15) Rx Ry Rz = Mz My Mx .

We will only refer to the local axes sets when we refer to Euler angles in the future.

There is no method by which concatenation can be performed using Euler angles

and we will need to convert to another parameterization to do so.

Euler angles are even more difficult to relate to Euler’s theorem than rotation

matrices. One way to do so is to convert the Euler angles to rotation matrices first.

Since obtaining the rotation angle is so difficult many people just use the Euclidean

distance metric by treating the Euler angle triple as a vector. This is clearly erroneous

however as the space of Euler angles is S × S × S (S is a unit circle) not IR3 . Not

only is there a problem when the angle goes through a discontinuity such as from 2π

to 0, but it also ignores the rotational order and thus the inherent coupling between

the Euler angle components. For this reason this metric can be used only for those

orientations that are in very close proximity to each other.

Euler angles are easy to interpret and visualize and it is because of this that

they are still widely used today. For example in human motion analysis we can

interpret the Euler angles in terms of sagittal, transverse and axial motion. Such a

factorization of the orientation aids in analyzing and describing the different postures

of the human body. In aeronautics, the angles are described as roll, pitch and yaw

(see figure 2.1) and are used to describe the orientation of aircraft during flight.

An important problem with using Euler angles is due to an apparent strength - it is

a minimal representation (three numbers for three degrees of freedom). All minimal

parameterizations of SO(3) suffer from a co-ordinate singularity which results in a

loss of a rotational degree of freedom in the representation. For example, let us


12

Figure 2.1: Illustration of roll, pitch and yaw with a 3D sailboat obtained from the Orientlib package
in R

consider the XYZ set. Any rotation where the Y angle is π/2 results in the z-axis

aligning with the original x-axis. This alignment of the axes causes the final Z angle

to be redundant as any resulting orientation could have been obtained initially using

an appropriate X rotation and thus the loss of a degree of freedom.

This phenomenon is known in the literature as gimbal lock which is a term that

originates from a physical device known as a gimbal (see figure 2.2). This device

is made up of three orthogonal concentric rings and is a physical realization of the

Euler angle set. Gimbal mounted gyroscopes are often used in aircraft attitudes

sensors. The gyro will stay in a fixed orientation with respect to the earth regardless

of the plane and the gimbal rings will rotate as the plane moves to keep this gyro

in place. Sensors are then placed on the rings to measure the Euler angles. Gimbal

lock occurs when the middle ring lies flat with the outer ring thus causing the inner

ring’s axis of rotation to be equal to the outer ring’s. Any further rotations along the

original inner ring axis cannot be accomplished without resetting the gimbal causing

the gimbal rings to wildly fluctuate whenever it operates near the singularity.

Any interpolation scheme based on treating the angles as a vector and using the
13

Figure 2.2: Illustration of a gimbal with three rings

convex sum will behave badly due to the inherent coupling that exists in the Euler

angles. In fact any attempt at factorization of SO(3) to independent components

will fail. We can show this by performing any rotation around two of the principal

axes, say the x-axis and the y-axis. If we eigen decompose the resulting rotation

matrix we will see that there will be z-axis component to the rotation axis even

though we only did an “XY” rotation. Interpolation at or near gimbal lock can lead

to numerical instability.

2.2.3 Axis-Angle

The axis-angle representation is a direct interpretation of Euler’s Rotation Theo-

rem in that we use the unit axis of rotation (a) and the angle of rotation (θ). Thus

we have three parameters4 to measure three degrees of freedom and thus is a minimal
4 The axis of rotation can be represented in spherical co-ordinates as only direction is needed
14

representation of the rotation group.

Obviously by its nature we can directly obtain the angle metric from the param-

eterization. It also represents the action of rotation in the most direct way possible

making it very intuitive.

Like Euler angles we cannot concatenate rotations using the axis-angle represen-

tation and so conversion to either matrix or quaternions is required. Round-off error

can be handled for the unitary axis of rotation by normalizing but not for the angle.

Multiplicity is a problem with this representation and we need to bound the angle

θ in [−π, π) so as to solve the problem of all multiples of 2π being the same angle.

This, however, does not entirely solve the problem as we still have that (a, θ) and

(−a, −θ) both represent the same rotation. The “zero” rotation or identity can be

represented with θ = 0 regardless of the axis of rotation allowing an infinite possible

identities.

Methods to solve the multiplicity problem will cause discontinuities to exist and

interpolation schemes will suffer because of it. Naive methods where we treat the

axis-angle as a four vector are obviously flawed, but no reasonable alternatives exist.

2.2.4 Quaternions

Quaternions were discovered by Sir William Rowan Hamilton, an Irish mathe-

matician in 1843. He extended the idea of complex numbers so that he could carry

out multiplication and division on triples of real numbers and it is from his discovery

of quaternions that vector algebra came into being.

Quaternions are a four dimensional extension of complex numbers with three di-

mensions being imaginary and the other being real. Such higher dimensional complex

numbers are known as hyper-complex with quaternions (four) and Cayley numbers

(eight) being the most well-known. As such, many of the properties of quaternion
15

algebra can be deduced by logically extending the well known properties of complex

algebra.

Quaternions can be written in several different ways and it is helpful to know

them all as each form is useful.

(2.16) q = [v, w]

(2.17) = [(x, y, z), w]

(2.18) = [x, y, z, w]

(2.19) = i x + j y + k z + w.

where x, y, z, w ∈ IR, v ∈ IR3 , i 2 = j 2 = k 2 = ijk = −1.

The last form shows the classical complex number form with i , j and k being the

three imaginary numbers with pairs multiplying as in a cross-product:

(2.20) ij = −ji = k ,

(2.21) jk = −kj = i ,

(2.22) ki = −ik = j .

Hamilton called the real part w the scalar and the imaginary triple v = (x, y, z) the

vector. A pure quaternion is one where w = 0 and can be used to represent a three

vector. Likewise a scalar quaternion has v = 0 and can be used to represent a scalar.

Even though we sometimes write a quaternion as a four dimensional vector, the

usual vector algebra cannot be used. Addition and subtraction of quaternions is

straight-forward, commutative and performed component-wise. There are two well

known methods for vector multiplication: the cross product and the dot product,

each yielding a different type of result. The quaternion product is an amalgamation

of these two and as such is non-commutative due to the cross-product term.


16

Addition

(2.23) q1 + q2 = [v1 , w1 ] + [v2 , w2 ]

(2.24) = [v1 + v2 , w1 + w2 ].

Multiplication

(2.25) q1 ∗ q2 = [v1 , w1 ] ∗ [v2 , w2]

(2.26) = [v1 × v2 + w1 v2 + w2 v1 , w1 w2 − v1 · v2 ].

Other important operations, reminiscent of those found in complex number theory,

include the conjugate, norm (or magnitude) and inverse.

Conjugate

(2.27) q∗ = [v, w]∗

(2.28) = [−v, w]

Norm/Magnitude

(2.29) kqk2 = q ∗ q∗

(2.30) = w2 + v · v

(2.31) = w 2 + x2 + y 2 + z 2

Inverse

q∗
(2.32) q−1 =
kqk

Like complex numbers, quaternions can be put in polar form:

θ
(2.33) q = rev̂ 2
 
θ θ
(2.34) = r v̂ sin , cos
2 2
17

θ
where r is the magnitude of the quaternion, 2
is the angle (we explain why we have
θ
2
instead of θ in the next paragraph) and v̂ is the axis which is a unit three vector or

a pure unit quaternion. The above formula can easily be proved by using the power

series expansion of the exponential and then using the fact that v̂2 = −1.

De Moivre’s theorem of powers for complex numbers can be similarly extended

for quaternions giving us:

θ
(2.35) qt = r t eta 2
 
t θ θ
(2.36) = r a sin t , cos t
2 2

So how can quaternions be used to parametrize rotation in IR3 ? First of all,

we restrict ourselves to a multiplicative subgroup of quaternions by enforcing unit

magnitude as this is all that is required for rotation parameterization and furthermore

will not change the scale of the object being rotated5 . Let x be a vector in IR3 and

suppose we wish to rotate this about an axis a by an angle θ. Then the rotation

formula in quaternions would be of the form:

(2.37) y = q ∗ x ∗ q−1

where q = a sin 2θ , cos θ2 and y is the rotated vector and both x and y are in pure


quaternion form. Thus to rotate a vector x we need to put it in quaternion form and

then multiply to the left with the rotation quaternion and multiply to the right by
θ
its conjugate. This“double” multiplication is the reason why we have 2
instead of θ

in our quaternion parameterization.

The identity quaternion given by:

(2.38) qI = (0, 0, 0, 1)
5 From now on all quaternions will be unit unless otherwise indicated.
18

is the unit scalar quaternion — it plays the role of the identity matrix, i.e., it rep-

resents a zero rotation. Like the matrix the identity quaternion has the following

properties:

(2.39) q ∗ qI = qI ∗ q = q

(2.40) q ∗ q−1 = q−1 ∗ q = qI

Another property of this formula is that q and −q would produce the same rota-

tion and thus we have a problem of double-coverage. As mentioned previously, the

only parameterization that does not suffer from multiplicity is the rotation matrix.

Although we acknowledge the quaternion multiplicity, it can be handled using some

straight-forward techniques that are described in section 3.3.5.

Concatenation of rotations is handled similarly to that of matrices due to the

non-commutative nature of quaternion multiplication. Thus if we wish to rotate by

q1 followed by q2 . By the quaternion rotation formula we have:

(2.41) y = q2 ∗ (q1 ∗ x ∗ q−1 −1


1 ) ∗ q2

(2.42) = (q2 ∗ q1 ) ∗ x ∗ (q2 ∗ q1 )−1

It is useful to look at the unit quaternions from a geometric and topological point

of view as it provides us with a fair amount of intuition as to how the unit quaternions

work. If we think of unit quaternions as unit vectors in IR4 then the space of unit

quaternions is the surface of a four dimensional hypersphere denoted as S 3 (the 3

stands for the three degrees of freedom that exists for this surface and not the number

of dimensions which is four) in the literature. Thus the double coverage problem can

be interpreted as antipodal symmetry as q and −q are antipodes or, in other words,

on direct opposite sides of the sphere.


19

The main advantage of the quaternion representation is that it does not suffer

from a co-ordinate singularity. This can be explained through what is known as the

“Hairy Ball Theorem” in topology. It states that if we have a ball covered with hair

we cannot comb the hair such that all the hairs lie flat on the surface of the ball.

In other words, it is impossible to create a continuous tangent vector space on the

surface of a sphere with an even number of degrees of freedom. The corollary to this

is that it is possible to do this for spheres with odd degrees of freedom. Since unit

quaternions live on S 3 we can move smoothly on the surface of the sphere without

encountering any discontinuities.

Quaternions can be thought of as a more efficient representation than rotation ma-

trices as it uses four numbers instead of nine. Quaternion multiplication requires less

calculation than matrix multiplication6 and as such algorithms for quaternions run

almost five times faster than those for rotation matrices. Numerical round-off errors

are much more easily handled with quaternions requiring simple re-normalization as

opposed to matrices that require re-orthonormalization through Gram-Schmidt or

other such computationally expensive methods.

The perceived disadvantage of quaternions are that they are difficult to interpret.

However, quaternions in polar form makes it trivial to relate it to Euler’s Theorem

with the axis and angle easily obtained. The problem lies in the fact that quaternions

are unfamiliar to a majority of people as they are seldom taught in basic college level

math courses. By using the geometric interpretation of quaternions one can avoid

thinking of them as a “black box”.

The major problem we face when using quaternions is that they live on the surface

of a hypersphere and thus we cannot use the familiar Euclidean vector space methods,
6 Quaternion multiplication requires 16 scalar multiplies while matrix multiplication requires 81.
20

statistical or otherwise. This is a problem inherent in the rotation group and is not

just as a result of choosing quaternions as our parameterization method. This will be

discussed in more detail in the next chapter where we introduce orientation statistics

and formulate methods to model quaternion data.

2.2.5 References

The information presented in this chapter were taken from many different sources.

Much of the information in the section on quaternions was obtained from Shoemake

(1985), (1987) and from the man who discovered them, Hamilton (1866). There are

also references that look at all the parameterizations: Buss (2003) and Goldstein

(1980). Two websites that have a wealth of information are: Baker (2006) and Weis-

stein (2006).
CHAPTER III

Statistical Analysis of Orientations

In this chapter we will introduce statistical methods for analyzing orientation

data using the quaternion method of parameterization with an emphasis on human

motion. A detailed description of this type of data precedes the statistical analysis.

We then introduce the natural metric for orientation data as well as the concept of

a mean orientation.

We consider two possible approaches to handling quaternion data:

1. The “Tangent Mapping” approach where we map our quaternions from S 3 onto

a tangent space.

2. The “Constraint” approach where we stay in S 3 and consider it a constrained

subspace of IR4 .

We describe both approaches and derive statistical models for each.

3.1 Human Kinematic Data: Links, Joints and Co-ordinate Frames

Before we dive into the statistical analysis we need to introduce the type of data

that we are trying to model and describe some of the issues involved.

The human body can be modeled conceptually as a chain of rigid links or seg-

ments connected together by joints. These segments represent body parts which are

21
22

considered to be rigid in that they are considered not to bend or stretch. The joints

connect these segments and allow rotational movement between segments. Depend-

ing on the joint, we have up to three rotational degrees of freedom available for a

particular body segment.

How many links and joints there are depends on the particular linkage system

used which needs to be chosen by the experimenter. The linkage system also effects

the number of rotational degrees of freedom each joint allows. For example, let us

consider the arm, which is made up of the hand linked to the forearm via the wrist

joint and the forearm linked to the upper arm via the elbow joint. Intuitively, we

would allow three degrees of freedom for the orientation of the hand as we can move

it up or down, left or right as well as twist it along the axis of the forearm. The

twist, however, does not really occur at the wrist joint but rather along the forearm

due to the action of the tendons. It is thus possible to allow the twist to occur at

the elbow thus giving the elbow and the wrist two degrees of freedom each rather

than the usual three for the wrist and one for the elbow.

We obtain our data via the use of motion capture for which we place markers

on certain landmark points on a subject’s body and use cameras or other sensors to

track the location of these markers as the subject performs prescribed tasks. Our

raw human motion data consists of the marker positions recorded in fixed frequency

intervals with respect to an arbitrary global co-ordinate system set up by the motion

capture device. From these marker positions we calculate the positions of the joint

centers corresponding to the linkage system that we are using. Data from each

individual frame are called posture data and a series of posture data over time are

called motion data.

The orientation of a particular body segment can be obtained with respect to the
23

Figure 3.1: Illustration of the HUMOSIM linkage system. The reference posture shows the human
figure standing erect, facing forward and holding the arms outstretched to the sides
parallel to the ground with palms facing downward. Each body segment’s local co-
ordinate system is shown aligned with the global co-ordinate system marked as “X0-
Y0-Z0”
24

global co-ordinate system or the co-ordinate system induced by the segment that

directly precedes it in the chain called the local co-ordinate system (see figure 3.1).

We denote a quaternion that represents the orientation of a segment with respect

to the global co-ordinate system as a global quaternion and similarly for a local

quaternion. The global quaternion for each segment is calculated from the marker

locations. The simplest way to do this is to form a rotation matrix using the basis

vectors that form the co-ordinate system of the segment. We can then convert1 this

to obtain the global quaternion. As an example suppose we have two segments A

and B with B preceding A in the chain. Let us denote the global quaternion for A

as G G
A q and the global quaternion for B as B q. This can be read as the quaternion for

segment “subscript” with respect to the co-ordinate system “superscript”. Once we

have these we can obtain the local quaternion of A with respect to the co-ordinate

system of B by:

B B
(3.1) Aq = Gq ∗G
A q

G ∗ G
(3.2) = Bq ∗ A q.

Whether we choose to use global or local quaternions, we extract the orientation

from each posture in the motion and create an orientation trajectory for that segment.

These trajectories, which will vary in length depending on the speed at which the

motions are performed, will then form our response. This choice is an important one

however, with advantages and disadvantages on both sides. We will discuss these in

the next chapter when we perform an example analysis and model the orientation

trajectory of the right hand during reaching tasks.


1 See Appendix for the various conversion algorithms between rotation parameterizations.
25

3.2 The “Angle of Rotation” Metric for Orientations and the “Mean”
Orientation

It is obviously important for a distance metric to be defined for us to move ahead in

statistically modeling and analyzing orientation data. As mentioned in the previous

chapter, Euler’s Rotation Theorem provides us with a natural angle of rotation metric

between orientations. Since we have made the choice of using quaternions as our

parameterization method we need to be able to obtain this metric from them.

Let q1 and q2 be two quaternions representing different orientations. Then the

rotation required to go from q1 to q2 is given by:

(3.3) qnew = q∗1 ∗ q2

From the previous chapter we know that the angle of rotation can be obtained

from the scalar component of a quaternion and thus if we apply this to the new

quaternion we calculated we get2 :

(3.4) θnew = 2 arccos |scalar(qnew )|

(3.5) = 2 arccos |scalar(q∗1 ∗ q2 )|

(3.6) = 2 arccos |w1w2 + v1 · v2 |

(3.7) = 2 arccos |q1 · q2 |

Thus the angle of rotation metric for quaternions is also the angle formed between

them at the origin. Since S 3 has unit radius this can also be thought of as the length

of the shortest geodesic between them.3


2 Absolute values are taken so as to remove the antipodal symmetry property. This way it will always return the

angle from the closer antipode.


3 The geodesic is defined as a locally length minimizing curve. On the sphere the geodesic is a great circle linking

the two points on the hypersphere.


26

With this metric we can now define a mean or average orientation. In normal

p-dimensional Euclidean space the mean can be defined as:


n
X
(3.8) x̄ = arg minp |xi − x|2
x∈IR
i=1

We can describe the mean orientation in an analogous way with Euclidean distance

replaced with the angle of rotation metric. For the quaternion parameterization this

becomes:
n
X
(3.9) q̄ = arg min3 arccos |qi · q|2 .
q∈S
i=1

Buss and Fillmore (2001) describes an iterative solution to this minimization. As

with all iterative algorithms there are issues with speed and accuracy. We shall call

this the “Minimum Distance” mean.

Prentice (1989) described an alternate method of obtaining this mean which he

derived from the mean rotation matrix. Suppose we have a sample of n orientations in

rotation matrix form i.e. X1 , . . . , Xn from SO(3) and we are interested in obtaining

the mean orientation. A naive estimator would be the element-wise arithmetic mean,
n
1X
(3.10) X̄ = Xi
n i=1
 
i i i
n 
 x11 x12 x13 
1 X 
(3.11) =
 i
 x21 xi22 xi23

n

 
i=1  
xi31 xi32 xi33
 
1
Pn i 1
Pn i 1
Pn i
 n i=1 x11 n i=1 x12 n i=1 x13 
 
Pn Pn Pn
(3.12) =  1
xi21 1
xi22 1
xi23
 
i=1 i=1 i=1
n n n

 
 Pn Pn Pn 
1 1 1
n i=1 xi31 n i=1 xi32 n i=1 xi33

where xijk is the jkth element of the ith sample matrix. Unfortunately this estimator

is not a rotation matrix. To solve this problem we need to decompose this mean
27

matrix into matrix polar form. The following definition is taken from Downs (1972).

Definition. Let F be a 3×3 square non-singular matrix. The matrix M.K is called

a polar form of F, with M the polar component and K the elliptical component, where

(1)F = MK, (2)MT M = I, det(M) = 1 and (3)K is symmetric positive-definite.

There exists a relationship between matrix polar forms and least squares in that

M = arg minX tr{(F − X)T (F − X)} for all X ∈ SO(3). As FT F and XT X are

constant, this is equivalent to M = arg maxX =tr(FT X).

To numerically evaluate the decomposition of F into its matrix polar form requires

us to first of all look at its singular value decomposition,

(3.13) F = ∆Dφ Γ

where ∆ and Γ are rotation matrices and Dφ =diag(φ1, φ2 , φ3 ) is positive definite

with φ1 > φ2 > φ3 being the singular values of F. The polar component is then

M = ∆Γ and the elliptical component is K = ∆Dφ ∆T .

The arithmetic mean, X̄ = n1 ni=1 Xi, is not a rotation matrix as stated previ-
P

ously. However if we were to put it in polar form X̄ = M.K, the polar component

M is a rotation matrix. In fact, it is the rotation matrix that is closest in the least

squares sense to X̄.

One can show that


n
1X
(3.14) tr(X̄T M) = 4mT ( qi qTi )m − 1
n i=1

where q1 , . . . , qn ∈ S 3 are the quaternion representations of X1 , . . . , Xn ∈ SO(3)

and m is the quaternion corresponding to M. From this it can be proved that m

is the eigenvector corresponding to the largest eigenvalue of the moment of inertia


28

matrix
n
1X
(3.15) I= qi q′i
n i=1

It is difficult to gain any intuition from this “Eigenvector” mean and attempts to find

a meaningful interpretation from the literature were unsuccessful. We also could not

find in the literature if there was a relationship between the minimum distance mean

and the eigenvector mean. We were able to prove that they are, in fact, identical.

The first step to the proof is to recognize that:


n
X
(3.16) q̄ = arg min3 arccos |qi · q|2
q∈S
i=1
n
X
(3.17) = arg max3 (qi · q)2
q∈S
i=1

The next step is to use the Lagrange multiplier to solve this equation under the

constraint that the solution lies in S 3 . We rewrite the equation by expressing the

dot product as an inner product of the quaternions expressed as vectors in IR4 . Thus

we have:
n
X
(3.18) f (q) = (qT qi )2 + λ(qT q − 1)
i=1
n
X  T
(q qi )(qTi q) + λ(qT q − 1)

(3.19) =
i=1
n
!
X
(3.20) = qT qi qTi q + λ(qT q − 1)
i=1
(3.21) = q Iq + λ(qT q − 1)
T

Differentiating with respect to q:


(3.22) f (q) = 2Iq + 2λq
∂q

which when equated to zero leads us the eigenvector equation Iq = λq. Maximization

of the objective function will occur when q = e1 the eigenvector associated with the
29

largest eigenvalue, thus proving the result. Now that we know the two are equivalent

the eigenvector method will be preferred over the minimum distance method due to

ease of computation. The only time one would use the latter is that it allows us to

incorporate weights and thus calculate a weighted average.

3.3 The Tangent Mapping Approach

As we have mentioned in the previous chapter, the main problem we face when

working with the quaternion representation of orientation is that we are working in

a non-linear space, which in this case is the surface of a unit 4D hypersphere.

One way we can get around this problem is to make use of a fact from group

theory which states that the surface of a 4D hypersphere is a Lie group. The tangent

space taken at a Lie group’s identity is known as a Lie algebra and the Exponential

map is used to move between the Lie Group and the Lie algebra (see figure 3.2).

The Lie algebra for the space of unit quaternions is Euclidean IR3 and therefore if

we map our unit quaternions onto this tangent space we have essentially a relatively

straight forward method to getting around the non-linearity problem.

3.3.1 Exponential and Logarithm maps for Quaternions

In the previous chapter we saw that the polar form of a quaternion is basically an

exponential of a vector in pure quaternion form:

θ
(3.23) q = ev̂ 2

The logarithm of a quaternion is the inverse of the exponential and is defined as:

θ
(3.24) log q = v̂
2

In fact exponentiation is defined only for pure quaternions and conversely the loga-

rithm of a quaternion always results in a pure quaternion. Since a pure quaternion is


30

Figure 3.2: Illustration of the exponential map and the logarithm map which allows us to move
between quaternions which are on the surface of the sphere to points on the tangent
space taken at the identity

a vector we see that the above definitions give us a way of mapping between vectors

and quaternions.

For the purposes of computation we define the exponential map as:



 [0, 1]

if v=0
(3.25) expmap(v) =
 [v̂sin θ , cos θ ] if v6=0

2 2

where v∈ IR3 , θ = kvk and v̂ = v/θ. We compute the logarithm map by:

v
(3.26) logmap(q) =
sinc 2θ

sin x
where v is the vector part of q and sinc(x) = x
which is known as the sink function

and is defined as x tends to zero4 .


 
4 We θ θ2 θ4
can see this from the Taylor series expansion of the sink — sinc 2
=1+ 24
− 24 ·5!
+ ...
31

As we can see, the exponential and logarithm maps act as almost a conversion

algorithm between quaternions and the axis-angle representation with the exception

that the angle is not explicitly obtained but rather represented by the magnitude of

the axis.

From the above definitions, we notice that work is needed for this mapping to be
θ
unique. The first thing we need to do is restrict 2
to be between [0, π2 ]. Thus the
π
exponential map will take points from a ball of radius 2
to the quaternions. Unfortu-

nately this mapping is unique only for the interior points of the ball; antipodal points

on the surface of the ball represent the same rotation. This is because a rotation of

π about v̂ or −v̂ results in the same orientation. Since the log mapped quaternion

is a minimal representation using just three parameters, it is to be expected that it

would suffer from a singularity. Luckily, this region is well defined as opposed to the

gimbal lock singularity region of Euler angles.

An important property of the exponential map is that it preserves the angle metric

between the identity and each orientation, i.e.

(3.27) klogmap(q) − 0k = arccos |q · qI |

As a by product of this, it also preserves the angle formed at the identity between

longitudinal lines.5 This means that hyper circles or hyper ellipses on S 3 centered

on the identity maps to spheres and ellipsoids on the tangent space.

This tangent mapping approach is a local linear approximation and as such the

further our data is from the identity the more distorted our approximation becomes.

The exponential map does not preserve the angle metric between two quaternions

unless one of them is the identity and the further away from the identity these points
5 Think of longitudinal lines on the Earth. They all lie on great circles that pass through the north and south

poles.
32

are the greater the discrepancy between the angle metric on S 3 and the Euclidean

metric on the tangent space.

The exponential and logarithm map formulae are defined such that the tangent

space is taken at the identity. This is not a problem if our data is centered at the

identity but it is far more likely that this is not the case. To take the tangent space

at a point other than the identity we need to rotate our data such that our tangent

point coincides with the identity. This is essentially a change of coordinate system.

Suppose we have n data points q1 ,. . . , qn and we wish to map these quaternions to

the tangent space taken at q. We need to rotate our data such that q becomes the

identity. The rotation required is the conjugate q∗ and thus we need to multiply6

our data by this conjugate to obtain our rotated data

(3.28) q∗ ∗ q1 , . . . , q∗ ∗ qn .

We can then use our existing formulae to map to and from the tangent space remem-

bering to multiply to the right by q to return to our original co-ordinate system.

A good explanation of the exponential and logarithm maps are given in Grassia

(1998) while explanations of Lie groups and Lie algebras can be found in Weisstein

(2006).

3.3.2 Distribution Theory on the Tangent Space

Coming up with a plausible probability distribution for quaternions native to S 3

is not a simple task but there are some that have been developed, most notably the

Bingham distribution which we will talk about in a later section. We can, however,

describe the likely characteristics such a distribution would take. Suppose we are

looking to model the orientation of the hand when a person initially grasps a door-
6 Quaternion multiplication is non-commutative and so we need to keep track of which side we performed our

multiplication so that we can return to our original co-ordinate system when we map back from our tangent space
33

(a) In 3D (b) In 2D

Figure 3.3: Illustration of the Tangent Gaussian distribution in lower dimensions.

knob before opening a door. We would reasonably expect there to be a single most

probable orientation the hand will take and a continuum of less probable orientations

the further we get from that modal orientation. In such cases a Gaussian distribution

centered at the mode appears to be a reasonable potential candidate.

Antipodal symmetry of quaternions means that the distribution needs to be bi-

modal since q and −q represent the same orientation they should obviously be equally

likely. If we were to visualize S 3 as the earth then we can imagine the North and

South poles being the modes with the distribution being mirror images of each other

above and below the equator. Thus it is possible to restrict ourselves to just one

hemisphere and then flip any quaternion that is in the wrong hemisphere by taking

its antipode.

In the tangent mapping approach, we will use a standard zero-mean trivariate

Gaussian density as our model for the tangent vectors taken at one of the modes.

Thus the density can be written as:

1 1 T Σv
(3.29) f (q; Σ, m) = 3 1 e− 2 v ,
2π |Σ|
2 2
34

where v = logmap(m∗ ∗ q) i.e. the tangent vector of q taken at the mean/mode m∗

and Σ is the covariance matrix which is symmetric and positive definite.7

(3.30) Σ = PDPT ,

Eigen decomposition of Σ gives us the matrix P ∈ SO(3) of eigenvectors which is

conceptually the rotation of the tangent space that is needed to align the principal

axes of the data with that of the tangent space and the D the diagonal matrix of

eigenvalues which can be interpreted as the variances along those axes. This provides

us with some intuition as to what the covariance matrix represents.

Since the exponential map preserves angles at the identity between longitudinal

lines as well as distances of points from the identity, isoprobability contours for this

distribution which are in the from of ellipsoids will map onto hyper-ellipses on S 3

centered at the tangent point. We shall call this the Tangent Gaussian distribution

from now on (see figure 3.3).

3.3.3 Joint Range of Motion Limits

In our application to human motion, we need to consider joint range of motion

limits. All joints in the human body allow only a limited range of orientations.

Even the most flexible joints, such as the wrist, do not allow complete freedom of

movement. We would like a quick and simple method to estimate approximations

of these joint limits, for the purpose of filtering out any implausible orientations

from predictions we make. We concentrate on joints that allow rotations with three

degrees of freedom. Limits for joints with two or less degrees of freedom are easily

found.

The common practice is to create limits using the Euler Angle representations thus

creating one-dimensional limits for each Euler angle. Beyond the obvious problems
7 If we have less than three rotational degrees of freedom Σ will be singular!
35

created by ignoring the interdependency of the Euler angles it would be computa-

tionally expensive to apply our quaternion data as we would first have to convert to

rotation matrices and then to Euler angles before applying the limits. Recent work

by Herda et al. (2002) attempts to estimate this boundary using quaternion fields,

but this is quite complex and it is vital that the data contain nearly all possible

orientations along the boundary of the joint limit as otherwise there will be “gaps”

and “potholes” in the estimate.

Let us consider a conceptual distribution of all possible orientations allowed by

the joint for which we are trying to obtain the limit. It would be centered at a

low-stress, neutral equilibrium orientation and the further we get from this point the

more extreme and less comfortable the orientation would be. We can then equate

comfort of a particular orientation with how “probable” it is — high comfort = high

probability and low comfort = low probability. For simplicity, we approximate the

set of orientations with equal comfort, i.e. comfort contours as hyperellipses on S 3 .

This would then mean that on the tangent space, these limits can be expressed as

3 dimensional ellipsoids. This is unlikely to be true but we are sacrificing accuracy

for simplicity and speed as the purpose of using the limit is as a quick check on

prediction plausibility. These ellipsoidal joint limits can be obtained from data by

using the sample covariance matrix to estimate a Mahalanobis distance limit.

Suppose we wish to find the range of motion limit to a joint that links segment

A with segment B. The first step is to make sure that we are using local quaternion

data of segment A with respect to segment B. For the most part we would not use

global orientations for the limit as it does not isolate the joint in question but rather

provides the accumulated effect of every joint in the body. Thus for datasets with

complex motions that has the figure not only moving its arm but turning,twisting
36

and walking; a global joint range of motion limit could conceivably mean the entire

space of rotations SO(3)!

We define the Mahalanobis distance of a quaternion q from the mean/mode

quaternion m as:

1
(3.31) dMah (q) = kD− 2 PT logmap(q ∗ m∗ )k

where D and P are the diagonal matrix of eigenvalues and its corresponding matrix of

eigenvectors, respectively, obtained from decomposing the covariance matrix Σ. Thus

the Mahalanobis distance can be interpreted as the number of standard deviations

away from the mean our data is.

Let γ be the value of this distance that denotes the joint range of motion limit. A

logical estimator of γ is the maximal Mahalanobis distance obtained from our data,

i.e.,

(3.32) γ̂ = max (dMah (q)).


q∈q1 ,...,qn

One needs to keep in mind that this estimator is dependent on the point at which

we take our tangent space m and therefore we need to make sure when we apply this

limit that we are in the correct space.

Obviously, the quality of this estimated limit depends on the quality of the data.

We would ideally like for the data to be a random sample of orientations where the

joint reaches the boundary of its range of motion limit. We will discuss the problems

that arise when this assumption does not hold true when we apply our limit to real

experimental data in chapter four.

3.3.4 Interpolation and Smoothing

The basic fundamental interpolator between two quaternions is the spherical

l inear interpolator or slerp introduced by Shoemake (1985). It interpolates along


37

the shortest geodesic path which in this case would be the great circle arc that goes

through the two quaternions. The slerp between two quaternions q1 and q2 is given

by:

sin(1 − α) θ2 sin α 2θ
(3.33) slerp(q1 , q2 , α) = q1 + q2 ,
sin θ2 sin θ2

where cos 2θ = q1 · q2 . Visualizing this geometrically, we see that the slerp embodies

Euler’s rotation theorem in that it finds the rotation that will take it from the initial

to the final orientation and the interpolation path is obtained by varying the angle

of rotation around the rotation axis.

The slerp interpolator is native to S 3 and is not necessarily preserved on the tan-

gent space, i.e. the slerp interpolation path between two quaternions when mapped

onto the tangent plane does not equal the interpolation path obtained by using

a normal convex sum based linear interpolation between the two tangent mapped

quaternions. It is preserved, however, if either the initial or the final quaternion is

the point at which the tangent space is taken. This is directly due to the fact that

the exponential map preserves the angle of rotation metric of a quaternion from the

identity.

Unfortunately, the likelihood that our motion data contains just two key frames or

postures is basically zero, and the slerp cannot be used to create a smooth interpola-

tion path between more than two. A more complex spline-type approach is required

for this. With the tangent mapping approach we are no longer restricted to the the

surface of the hypersphere, and thus we can call upon an abundance of well-defined

methods. Prentice (1987) also uses this idea, employing the exponential map derived

directly from SO(3), which is also a Lie group and is a higher dimensional extension

of the method by Jupp and Kent (1987).


38

The approach we will be taking is to fit regression splines 8 to our tangent mapped

quaternion trajectories using cubic B-spline basis functions. The reason we make this

choice is two-fold; we reduce the dimensionality of our data and by using an equal

number of uniform knot points, combined with a rescaling of actual time to relative

time, we can circumvent the problem of having varying lengths for the trajectories.

Dimension reduction is a major issue with motion data as a five second motion

captured at a frequency of twenty hertz will lead to a hundred quaternion data

points on our orientation trajectory. This is the method used by Faraway (2000)

except that we have a trivariate response instead of a univariate one.

Let us denote the function we are approximating as q(t). The spline function is

given as a linear combination of m cubic B-spline basis functions, m


P
j=1 pj Ψj (t), and

the objective is to choose control points pj such that we minimize:


"Z m
#2
1 X
(3.34) η(t) = q(t) − pj Ψj (t)dt ,
0 j=1

where t ∈ [0, 1] denotes proportional time. Since we only observe q(t) at fixed

intervals the problem in matrix equation form becomes to minimize:

(3.35) tr(ET E),

where

(3.36) En×3 = Qn×3 − Ψn×m Pm×3 ,

and n denotes the number of frames or postures in the observed trajectory. The

Ψ matrix is made up of the basis function values and its derivation is given in the

appendix . Using least squares, the matrix of spline control points, P, is calculated

as:

(3.37) P = (ΨT Ψ)−1 ΨT Q.


8 This method implies that we are approximating the trajectory and not interpolating it.
39

The raw marker data obtained from the measurement devices tend to have a lot

of noise. Filtering methods are used to smooth the marker data and consequently

produce smooth orientation trajectories. Due to this filtering, sensitivity with the

choice of m is normally not an issue. We want to choose m to be large enough to

capture any true systematic patterns but not so large that it will start capturing any

random noise elements.

3.3.5 Hemisphere Commonization and Data Concentration: The Slerp Residual

The exponential and logarithm map, as we have defined it, is a mapping between
π
one hemisphere of S 3 and a subset of IR3 , namely the ball of radius 2
. Thus we

require the data to be in the hemisphere centered at the point at which the tangent

is taken which we will call the tangent hemisphere. As quaternions are antipodally

symmetric this is not a hard problem: we need only choose the antipode closest to

the tangent point.

Here is a simple, two-step algorithm for achieving this common hemisphere. Sup-

pose that we have posture data q1 , . . . , qn and we wish to take the tangent at q

(normally the mean). The steps are:

1. Calculate q · qi for i = 1, . . . , n.

2. If q · qi < 0 then replace qi with −qi .

This “flipping” method where we take the antipode of quaternions not already

in the tangent hemisphere is suitable for posture data, but there exists a potential

problem with applying it to motion data. Suppose we have an orientation trajectory

that is close to the hemisphere border and that it passes through it. The flipping

algorithm would then result in the sections of the trajectory that were in the non-

tangent hemisphere being flipped to the opposite side of the sphere thus introducing
40

Figure 3.4: Illustration of the potential problem in using the flipping algorithm on an orientation
trajectory that exists on the boundary between hemispheres. The original trajectory
starts in the upper hemisphere and curves down to the lower hemisphere before returning
back to the upper hemisphere. Using the flipping algorithm we would flip our “smile”
on the lower hemisphere to the other side of the sphere to create a “frown” on the upper
hemisphere.

discontinuities to the path, as seen in figure 3.4. This makes it impossible for us

to apply not only the interpolation and spline techniques mentioned previously, but

any functional analysis of trajectory data.

For this reason we introduce the concept of slerp residuals. The slerp interpolator

introduced previously can be thought of as a“straight line” model that creates a

straight trajectory from an initial orientation to a final orientation. We define the

slerp residuals to be the “difference” between the actual orientation trajectory and

the slerp model trajectory. By “difference” we mean the rotation required to take

us from a point on the slerp model trajectory to a corresponding point on the actual

trajectory. This is graphically illustrated in figure 3.5.

Suppose we have an orientation trajectory made up of n observed posture orien-

tations, q1 , . . . , qn . The first step in obtaining our slerp residuals is to calculate our

slerp model trajectory. One possible method for obtaining our trajectory is to use
41

(a) Slerp Model Trajectory (b) Slerp Residuals

Figure 3.5: Illustration of the slerp model and the slerp residuals. The slerp model(a) gives the
shortest trajectory on the sphere between two points. The slerp residuals (b) are the
rotations, shown as arrows, that take us from the slerp trajectory to the actual observed
trajectory

the slerp interpolator to create n equally spaced postures, i.e., the angle between

each subsequent posture orientation is constant. Our slerp trajectory would then be

(3.38)
     
1 2 n−2
q1 , slerp q1 , q2 , , slerp q1 , q2 , , . . . , slerp q1 , q2 , , qn ,
n−1 n−1 n−1

which gives us an orientation trajectory that has a constant rotational speed or a

constant angular speed profile. Such a model is unrealistic as people do not move at

constant speeds unless trying to do so on purpose. However, that is not a problem for

the purpose of calculating slerp residuals. The angular speed profile of the observed

trajectory, q1 , . . . , qn , will be passed on to the slerp residuals as one that is relative

to a constant speed profile.

The purpose of the slerp residuals is not only for us to avoid the potential of

a discontinuity being introduced by the flipping algorithm, but also to reduce the

spread of our data as much as possible by concentrating it around the identity.

This improves the quality of our linear approximation on the tangent plane which

is obviously a desirable objective. The way to maximize the concentration of the


42

slerp residuals is to apply the angular speed profile from our observed trajectory

to our slerp model trajectory. The constant speed slerp model would result in less

concentrated slerp residuals.

Note that we are using an angular speed profile and not a velocity profile. The

slerp interpolator produces orientations from a fixed axis of rotation and so these

two are the same but for our observed trajectory it is unlikely that we have one.

Thus we need to ignore the directional aspect of a velocity profile and use a speed

profile instead. We calculate the angular speed profile of an orientation trajectory,

q1 , . . . , qn , as:

(3.39) si = arccos |qi · qi+1 |

for i = 1, . . . , n − 1.

Using this angular speed profile we create the following speed adjusted slerp model

trajectory:

(3.40) ! !
P2 Pn−2 !
s1 i=1 s i si
q1 , slerp q1 , q2 , Pn−1 , slerp q1 , q2 , Pn−1 , . . . , slerp q1 , q2 , Pi=1
n−1 , qn .
i=1 si i=1 si i=1 si

We now have a slerp model trajectory s1 , . . . , sn , whether it is speed-adjusted or

constant, along with our observed trajectory q1 , . . . , qn and from these we calculate

the slerp residuals as:

(3.41) ri = s∗i ∗ qi ,

for i = 1, . . . , n. As with all quaternion multiplication we need to be cognizant of

the order in which this is done due to non-commutativity.

Since q1 = s1 and qn = sn , we have that r1 = rn = qI , the identity quaternion.

Thus we have, in effect, transformed our data to form slerp residual trajectories
43

that start and end at the identity. The extent to which we have concentrated our

data depends upon how close our slerp model trajectories are to the actual observed

trajectories, but it should result in data that are much less spread out and therefore

entirely remove the incidence of discontinuous trajectories formed by the flipping

algorithm.

The drawback with this residual approach is that we lose information on the

starting and ending orientation of our trajectory. Thus we would need to either

predict these separately or be given this information as input, which is usually the

case. On the other hand, if the task is to predict an orientation trajectory that is

constrained to start and end at specified orientations then this method is the only

viable way of doing so.

3.3.6 Functional Regression Modelling of Orientation Trajectories

Our ultimate goal, as we mentioned in the introduction, is to model the three

degrees of freedom orientation trajectories of certain body segments during human

motion with respect to covariates such as age, anthropometry, gender, target location

and starting and ending orientations. Our approach is to treat these trajectories

as functions and therefore use statistical functional data analysis techniques. The

reference for this sort of analysis is the book by Ramsay and Silverman (1997).

All of the sections in this chapter preceding the current one have dealt with

methods that we need for us to be able to perform a functional regression analysis

of our quaternion orientation trajectories on the covariates listed above. Faraway

(1997) introduces this functional regression model for univariate functions. Suppose

we have n response functions given by y(t) = (y1 (t), . . . , yn (t) and xi being the p-

variate vector of covariates for the ith response function. The functional linear model
44

is then given by:

(3.42) yi (t) = xTi β(t) + ǫi (t).

This is similar to the standard regression model except that the response yi (t), error

term ǫi (t) and vector of regression coefficients β(t) are now all functions. We can

interpret the jth coefficient function βj (t) for j = 1, . . . , p as the effect of the jth

covariate on the entire response function given a fixed level of the other covariates.

We can estimate β(t) using least squares by:

(3.43) β̂(t) = (XT X)−1 XT y(t)

where x is the n × p matrix of covariates whose rows are given by the xi ’s.

A cubic B-spline basis approach is used to approximate the response functions for

the same reasons as those mentioned in section 3.3.4. Thus we have


m
X
(3.44) yi(t) ≈ yik ψk (t).
k=1

We can now use the spline control points yik in place of our functional response yi (t),

in effect converting our problem from a functional to a multivariate one. Thus the

B-spline approximation of the above model can be written as:

(3.45) Yn×m Ψm×1 (t) = Xn×p Bp×mΨm×1 (t) + ǫn×m Ψm×1 (t),

where m is the number of basis functions used and Ψ(t) is the vector of those basis

functions. By factoring out Ψ(t) we obtain:

(3.46) Yn×m = Xn×p Bp×m + ǫn×m ,

which is a multivariate regression model of the spline control points on the covariates.

We then estimate B using standard least squares:

(3.47) B̂ = (XT X)−1 XT Y.


45

As we have stated at the beginning of this chapter, the problem we face with

our quaternion trajectory data is that it is non-linear and therefore we cannot fit a

linear model such as the one we have just described. However, by using the tangent

mapping approach we can linearize our data, thus opening the way for linear models

to be fit. Since this is a local linearization at the tangent point, our approximation

gets worse the further away we get from this tangent point. We would like, ideally,

to have our quaternion trajectories concentrated close to the tangent point.

How accurate and reliable our methods are depends on the spread or variability

of the data that we are working with. In our application of human motion, this vari-

ability will depend in part on how wide a range of orientations the particular body

segment we are modeling can take. The wrist allows, perhaps, the most amount of

flexibility and thus orientation data for the hand will tend to have more variability

than say that of the foot where the ankle allows a markedly smaller range of orienta-

tions. If the variability of the data is such that we have a large number of trajectory

observations close to the tangent hemisphere border we will have to use the slerp

residual method derived previously to concentrate our data.

Let us denote these quaternion trajectories or functions as q(t) = (q1 (t), . . . , qN (t))

where each trajectory observation qi (t) consists of differing numbers of observed pos-

tures (qi1 , . . . , qini ) for all i.

1. The first task is to find the average of all the postures in our data using the

“Eigenvector” method:

(a) Form a 4 × M matrix Q of all our M = n1 + · · · + nN quaternion postures

in column vector form.

(b) Calculate the moment of inertia matrix T = QQT .


46

(c) Perform an eigendecomposition of T.

(d) The mean q̄ is the eigenvector associated with the largest eigenvalue.

2. The mean q̄ is the point at which we will take our tangent.

3. Check on the spread of our data to see if there are any quaternions that are

close to π away from q̄ in terms of our angle of rotation metric, i.e. check if

2 arccos(q̄ · qij ) >= π. If so, we will have to use a slerp residual analysis. If,

as in the case for our model in chapter 4, we are asked to make predictions

for orientation trajectories that start and end at user-defined positions then we

would have to use the slerp residuals.

4. First try the constant speed slerp residuals to see if that is enough to pull our

data away from the hemisphere border. If that is not achieved then we will have

to go with the speed-adjusted slerp residuals.

The reason we would prefer to use the constant speed residuals is because it

allows us to directly convert any eventual predictions we make from our functional

regression model back to a real orientation trajectory. For speed adjusted slerp

residuals, we would need to predict an angular speed profile for us to be able to

convert our predicted residual trajectories back. Whichever method we use, we will

end up with slerp residual trajectories for which we will have to find the mean. Let

us denote these trajectories as R(t) and the mean as r̄.

Let us assume that we have made use of the slerp residuals, otherwise we would

just proceed through the next steps using our original data. The next step is to

use the logarithm map to map our data over to the tangent space taken at q̄ by

first performing a change of co-ordinate system as in (3.28) such that r̄ is set to

be the reference or identity orientation. We obtain our tangent mapped quaternion


47

trajectories V(t) = (v1 (t), . . . , vN (t)) where vi (t) consists of (vi1 , . . . , vini ) and vij =

logmap(rij ) for i = 1, . . . , N and j = 1, . . . , ni .

Following the blueprint for the univariate case we next approximate each trivariate

tangent vector trajectory using m cubic B-spline basis functions to obtain:


m
X
(3.48) vi (t) ≈ pik Ψk (t).
k=1

By (3.37) we see that this unfortunately results in a matrix of control points Pi m×3

for each trajectory due to the multivariate nature of the response. This means that we

would be converting our functional response to a “matrix-variate” response following

the analogy with (3.46).

To get around this problem we stack Pi column-wise to create:


 
 x1 
 .. 
. 
 

 
 

 xm  
   
x1 y1 z1 y1 
 
  
 
.. .. .. .. 
  
v
(3.49) Pi =   → pi =  ,
 
 . . .   . 
   
 
xm ym zm 
 ym  
 
z1 
 

 
 .. 

 . 

 
zm

thus converting the matrix-variate Pi to a 3m-variate vector pvi . Therefore (3.45)

becomes:

(3.50) PvN ×3m Ψv3m×1 (t) = XN ×p Bp×3m Ψv3m×1 (t) + ǫN ×3m Ψv3m×1 (t),
48

where PvN ×3m is a matrix where the vectors pvi T make up the rows and
 
 Ψ1 (t) 
 .. 
.
 
 
 
 
 Ψm (t) 
 
 
 Ψ1 (t) 
 
 
(3.51) v
Ψ3m×1 (t) = 
 .
.

.
 . 
 
 
 Ψm (t) 
 
 
 Ψ1 (t) 
 
 
 .. 

 . 

 
Ψm (t)

Factoring out Ψv3m×1 (t) we get:

(3.52) PvN ×3m = XN ×p Bp×3m + ǫN ×3m ,

which is a standard multivariate regression model just like in (3.46). We assume that

E(ǫi ) = 0 and the cov(ǫi ) = Σ3m×3m . The estimate of B is:

(3.53) B̂ = (XT X)−1 XT Pv ,

and the unbiased estimator of Σ is:

ǫ̂T ǫ̂
(3.54) Σ̂ = ,
N −p

where

(3.55) ǫ̂ = P − XB̂,

is our matrix of residuals.

Prediction for a new set of covariates xnew is given by:

(3.56) vnew (t) = xnew B̂Ψv (t).


49

Work needs to get this back to a predicted orientation trajectory as we will have

to undo all the pre-analysis transformations. We have to go through the following

steps:

1. Use the exponential map to map our predicted tangent vectors data back onto

S 3.

2. Revert back to the original co-ordinate system by multiplying each of our pre-

dicted points by r̄.

3. Convert the predicted slerp residuals back to a real orientation trajectory. Note

that we require the start and end orientation to be either predicted or given

to us. We need to calculate either the constant speed slerp model trajectory

(3.38) or a speed-adjusted slerp model trajectory (3.40)9 depending on what

method we used to get our slerp residuals and then reverse (3.41) to obtain our

predicted orientation trajectory qnew (t).

It seems reasonable to use standard inference techniques of multivariate regression

(see Johnson and Wichern (2002), Rencher (2002)) for comparing nested models ω

and Ω where dim(Ω) = p, dim(ω) = q and p > q. The likelihood ratio test statistic

for testing Hω versus HΩ is given by:

1 |Σ̂Ω |
(3.57) −(N − p − q − (3m − q + 1)) log
2 |Σ̂ω |
(N −p)Σ̃
where Σ̂ = N
is the maximum likelihood estimator of the covariance. For N

large this statistic approximately follows a Chi-squared distribution with 3m(p−q−1)

d.f.

Unfortunately there is a problem with using this, as explained in Shen and Far-
9 We will need to predict an angular speed profile for this or have one provided for us.
50

away (2004).We observe that:


3m
|ΣˆΩ | X λΩ
(3.58) log = log kω
|Σˆω | k=1
λk

where λΩ ω
k and λk are the eigenvalues of Σ̂Ω and Σ̂ω in decreasing order. For large

m, the likelihood ratio test statistic can become dominated by what amounts to
λΩ
unimportant directions of variance due to the fact that log λkω does not get smaller
k

as k becomes larger. Slerp residuals, by definition, are 0 at the start and end and

thus it is almost certain that the first and last few spline control points are all going

to be pretty close to 0. This puts the majority of the interesting variability in the

middle increasing the chance we have only a small number of significant eigenvalues.

Other options, including Wilk’s Lambda, the Lawley-Hotelling trace, the Bartlett-

Nanda-Pillai trace and Roy’s maximum root, all suffer from the same problem.

Shen and Faraway (2004) propose a test similar to the usual F-test employed in

regression which applied to our model becomes:

(rssω − rssΩ )/(p − q) tr(Σ̂ω − Σ̂Ω )/(p − q)


(3.59) F = ≈ ,
rssΩ /(N − p) tr(Σ̂Ω )/(N − p)

whose null distribution can be approximated to an ordinary F distribution with

degrees of freedom:

tr(Σ̂Ω )2 tr(Σ̂Ω )2
(3.60) f1 = (p − q) and f2 = (N − p).
tr((Σ̂Ω )2 ) tr((Σ̂Ω )2 )

If we do, indeed, observe that we only have a small number of significant eigenvalues

then we recommend using this improved testing method which is robust to the choice

of m for our analysis.

Goodness of fit is difficult to assess in our model. We can calculate 3m R2 ’s for

each of our spline control points but this only measures the fit of our model to our

tangent-mapped, speed-adjusted, slerp residual spline data and not with the actual
51

local quaternion trajectory. We would like to measure the model error with respect

to the entire process — tangent mapping, spline fitting and linear modeling.

The best way to tackle this would be to convert our fitted values from our regres-

sion model all the way back to a real trajectory. We can then calculate point-wise a

choice of mean, median or maximal differences between our fitted trajectory and our

observed one and then average it over all trajectories. We can then use the speed-

adjusted slerp model as a yardstick to see how well our model fits the data. Wang

(2006) proposes using dynamic time warping techniques to help remove any differ-

ences due to a timing element that might be involved. This algorithm has seen use in

applications such as voice recognition software and can be represented as an iterative

equation:

DTW (QN −1 , RM )






(3.61) DTW (QN , RM ) = dist (qN , rM ) + min DTW (QN , RM −1)




 DTW (QN −1 , RM −1 )

where Q = q1 , . . . , qN is a trajectory up to the Nth frame and Q = q1 , . . . , qN is the

other trajectory up to the Mth frame. We use our angle of rotation distance metric

as our dist() function.

3.4 The Constraint Approach

The Tangent Mapping approach described in the previous section uses a localized

linear approximation of S 3 . In exchange for computational and mathematical sim-

plicity we lose some accuracy, the extent of which depends on the variability existing

in our data. With the Constraint approach we seek to model and analyze directly

on S 3 by treating it as a constrained subspace of IR4 .

Non-linearity of S 3 is the biggest problem; in the tangent mapping approach we


52

could fit linear models that allowed us to easily relate our scalar covariates with our

linearized response. In the constraint approach this is not possible and we need to

find another way to model the relationship.

3.4.1 Distribution Theory on S 3

The Bingham distribution (see Bingham (1974)) was introduced to model axial

data, that is data where x and −x are indistinguishable. For such data, distributions

must be antipodally symmetric i.e. f (−x) = f (x). As stated previously, quater-

nions represent rotations in IR3 uniquely up to a sign change and so the Bingham

distribution seems a natural fit to model quaternion data (see Prentice (1986)).

Let q be a random unit quaternion from a Bingham distribution denoted B4 (L, A),

then it has the Bingham density

1 T
(3.62) f (q; L, A) = {1 F1 ( , 2, L)}−1 exp{tr(LAqq′ A )}[dq],
2

where [dq] represents the uniform distribution on S 3 , 1 F1 ( 21 , 2, L) is a normalizing

constant10 , A ∈ SO(4) and L = diag(l1 , l2 , l3 , l4 ) with l1 > l2 > l3 > l4 .

The parameters l1 , . . . , l4 determine the relative shape of the distribution. If

l1 + l4 > l2 + l3 then q is said to have a bipolar Bingham distribution where the

probability mass is concentrated at opposite ends of the hypersphere. If l1 + l4 <

l2 + l3 then q is said to have an equatorial or girdle Bingham distribution where

the probability mass is clustered around a great circle. The Watson distribution

(see Watson (1983)) is a special case of the Bingham where the density exhibits

rotational symmetry about an axis11 .

One can also show a close relationship between the Bingham and the multivariate

normal distribution. If q has an N4 (0, Σ) then the conditional distribution of q given


10
1 F1 is the hypergeometric function of matrix argument, see Gupta and Nagar (2000)
11 l > l = l = l leads to a bipolar Watson and l1 = l2 = l3 > l4 leads to an equatorial Watson
1 2 3 4
53

that kqk = 1 is Bingham with ALAT = − 21 Σ−1 .

Maximum likelihood estimation revolves around the moment of inertia matrix

T = n1 ni=1 qi q′i and its eigendecomposition T = ÂΛ̂ÂT where the MLE of A is


P

given by  and the MLE of the elements of L are functionally related to the elements

of Λ̂.

Prentice (1986) proves that if X = µ(x)12 then X has a matrix Von-Mises Fisher

distribution13 if and only if x has a Bingham distribution. From this it can be shown

that M̂ the MLE for the modal matrix M of the matrix Von-Mises Fisher distribution

is related to m̂ = â1 , the eigenvector corresponding to the largest eigenvalue of T by

M̂ = µ(m̂).

Sampling distributions for the Bingham are highly intractable mostly due to the

complexity of the normalizing constant and thus simpler asymptotic results are im-

portant. Most basic and important among these is the fact that for highly concen-

trated populations one can use normal approximations in the tangent spaces to S 3

(see Mardia and Jupp (2000), Rancourt et al. (2000)) which provides some legitimacy

for the tangent mapping approach. Other asymptotic results based on increasing di-

mensionality exist but are not of interest to us as we are interested only in quaternion

data, which has 4 dimensions.

3.4.2 Interpolation and Smoothing on S 3

The slerp introduced in section 3.3.4 is native to S 3 but not useful when we

have three or more points to interpolate. There has been quite a lot of work in

interpolation algorithms for quaternions in the computer animation field and they

can be divided into three main approaches:


12 See appendix for this quaternion to matrix conversion.
13 A probability distribution for rotation matrices, see Khatri and Mardia (1977).
54

1. Geometric Transliteration

2. Arc Blend

3. Differential Equation

The geometric transliteration approach treats the geodesic great circle arc of the slerp

as the equivalent of a line segment and then interprets geometric constructions in

terms of it (see Schlag (1991)). The arc blend approach combines small arc segments

to get a smooth curve and is the cheapest to compute (see Wang and Joe (1993)). The

differential equation approach notes that natural cubic splines minimize acceleration,

and impose the spherical constraint so as to create a calculus of variations problem

which produces an Euler-Lagrange ordinary differential equation formulation with

constraints (see Barr et al. (1992)).

Statisticians have also looked at developing spline techniques for general spherical

data as it is an important component of directional statistics. Much of the early

work was done by Thompson and Clark (1981) and Fisher and Lewis (1985).

As stated before in section 3.3.4, we are more interested in approximating our

trajectory rather than interpolating it and therefore we would like to develop a

S 3 analog of the regression splines we fit for our tangent mapped trajectories. In

section 3.2 we discussed the“minimum distance” approach to calculating the mean

quaternion. Buss and Fillmore (2001) introduced a more generalized method that

allows calculation of a weighted average. They went on further to define a spherical

spline function that made use of this method.

Suppose that q(t) is the quaternion trajectory we are trying to approximate. The

spherical B-spline function is defined as

Xm
(3.63) ◦ pj Ψj (t),
j=1
55

where the pj ’s are the quaternion control points and the Ψj (t)’s are cubic B-spline
P
basis functions. The ◦ notation is taken from Buss and Fillmore (2001) and it

denotes the quaternion weighted average function such that:

Xn n
X
(3.64) ◦ wi qi = arg min3 wi arccos |qi · q|,
i=1 q∈S
i=1
Pn
where wi are the weights such that i=1 wi = 1.

Instead of the integrated square error we have in (3.34) we wish to choose pj ’s

∈ S 3 such that we minimize the integrated angle of rotation error i.e.


Z 1 Xm
(3.65) η(t) = arccos q(t) · ◦ pj Ψj (t) dt.

0 j=1

Since we observe our trajectory as a finite series of n postures q1 , . . . , qn the above

can be approximated by:


n
X  Xm 2
(3.66) η= arccos qi · ◦ pj Ψij ,
j=1
i=1

where |pj | = 1 for j = 1, . . . , m and the absolute value replaced by a square function.

Thus we are faced with a complicated non-linear constrained optimization prob-

lem. The weighted average can only be found using an iterative algorithm. Algo-

rithms such as the Augmented Lagrange Multiplier (ALM) and Sequential Quadratic

Programming (SQP) are viable options and one can code simple versions of these

with some effort. Notice also that first and second derivatives cannot be found ex-

plicitly, making the process even more cumbersome. It is vital to have a good initial

estimate of the control points to lessen the likelihood of the algorithm getting stuck

in a local minimum.

In practice the methods described in section 3.3.4 produce decent fits to the data

and the approach set out here may not be worth the computational time and hassle.

We can, therefore, perform the spline fitting in tangent space then map the spline
56

control points back onto S 3 . Since this is a tangent mapping technique it has the

usual treade-off of accuracy for simplicity and speed.

3.4.3 Regression Models on S 3

Regression analysis for spherical data, i.e., data from S p (The surface of a p + 1

dimensional hypersphere) was developed by Chang (1986) to analyze the motion of

tectonic plates (also known as continental drift) on the Earth surface. For certain

points ui there exist estimates vi of their past position(which have some associated

error) and the task is to find the rotation that links them. In mathematical terms

ui are fixed points (the predictor) on S 2 , vi are independent random points (the

response) such that vi given ui has density g(vi′ Aui ) with respect to the uniform

measure on S 2 . The task is to estimate the rotation matrix A.

Prentice (1989) applied a modification of this analysis technique to orientation

data such that the ui and vi are quaternions instead of directional data on S 2 .

Each vi is considered to be the product of a transformation given by AT1 ui A2 where

A1 , A2 ∈ SO(4). This model is for matched pairs of orientations with vi is considered

as the response and ui as the predictor. We, however, require a model where our

predictors are scalar and so this appraoch is not useful for our purposes.

Rivest developed two statistical methods for analysing orientation data, both of

which were applied to human motion experiments. The first (see Rancourt et al.

(2000)) is a one-way ANOVA-style model for comparing terminal posture data be-

tween six different task locations. The second (see Rivest (2001)) method seeks to

fit a fixed-axis model to a single orientation trajectory. The first model is of more

interest to us as it allows modeling of a quaternion response with a single categorical

variable. We use this as inspiration for our model which we present next.
57

3.4.4 The Quaternion ANOVA model —QANOVA

As we have stated before the major problem we have with the non-linearity of S 3

is that there is no simple arithmetic operation between a scalar and a quaternion that

will keep the result on S 3 . In fact, if we go back to chapter two, the only operation

that produces a unit quaternion is the quaternion product of unit quaternions.

In section 3.3.5 we developed the concept of slerp residuals in which we interpreted

them as the difference between the observed orientation and the slerp predicted

orientation and defined it as (3.41). Inherent in this formulation is the idea that

we can consider multiplication of one quaternion with the conjugate of another as

an analogue of subtraction in linear space. By the same token we can consider a

straight multiplication with no conjugates involved as an analogue of addition. In

other words:

(3.67) x1 + x2 ⇋ q2 ∗ q1

(3.68) x1 − x2 ⇋ q∗2 ∗ q1 .

Non-commutativity of the quaternion product is again an issue and thus we are

presented with a choice of ordering. The particular ordering above represents the

fact that when we use multiple quaternions to rotate vectors, we do the operation

right to left as seen in (2.42).

Analysis of variance or ANOVA has been a basic and fundamental technique

that has been available to statisticians since R.A. Fisher, the “father of statistics”,

introduced it in 1918. With the processing power of modern day computers, the

estimation and fitting of the model is handled automatically and efficiently using

matrix algebra techniques. We sometimes forget that all the parameters in ANOVA

can be estimated using means. Older books on ANOVA such as the one by Scheffe
58

(1959) show us how to estimate parameters for main-effects and interactions using

conditional means. For example, in a two-way ANOVA with interaction we can

define the model as:

(3.69) yijk = ηij + ǫijk

where i = 1, . . . , I, j = 1, . . . , J, k = 1, . . . , K,14 ηij = E(yijk ) and ǫijk are indepen-

dently N(0, σ 2 ). This ηij , which can be interpreted as the true mean response at the

ith level of A and the jth level of B, can then be further split into

(3.70) ηij = µ + αi + βj + γij ,

where

1. µ is the overall mean of the response.

2. αi the main effect of the ith level of factor A.

3. βj is the main effect of the jth level of factor B.

4. γij is the interaction of the ith level of A with the jth level of B.

subject to the following constraints15 :

X
(3.71) αi = 0,
i
X
(3.72) βj = 0,
j
X
(3.73) γij = 0 for all j,
i
X
(3.74) γij = 0 for all i.
j
14 Factor A has I levels; factor B has J levels and each cell has an equal number of replicates given by K.
15 Otherwise the least squares estimates will not be unique.
59

Therefore we have that

(3.75) µ = η.. ,

(3.76) αi = ηi. − η.. ,

(3.77) βj = η.j − η.. ,

(3.78) γij = ηij − ηi. − η.j + η.. ,

where
P
ηij
ij
(3.79) η.. =
I ×J
P
j ηij
(3.80) ηi. =
PJ
i ηij
(3.81) η.j = .
I

The least squares estimate of these parameters are the sample counterparts of the

η’s and thus the ability to calculate sample means is all that is required for estimation

in an ANOVA model.

We know how to calculate sample means of quaternions (see section 3.2) and

combining this with the notion that quaternion multiplication acts as addition and

subtraction on S 3 we have an analogue of the ANOVA for quaternions. We coin this

as the QANOVA. To illustrate this, we describe the two-way QANOVA model as a

comparison to the two-way ANOVA shown above. Let us define the model as:

(3.82) qijk = η ij ∗ ǫijk

where η ij = E(qijk ) and ǫijk are independent and identically distributed centered

at the identity. We can then decompose the η ij into the following:

(3.83) η ij = γ ij ∗ β j ∗ αi ∗ µ,

where
60

1. η ij is the true mean quaternion at level i of factor A and level j of factor B —

the “cell” mean.

2. µ is the overall mean quaternion.

3. αi the main rotational effect of the ith level of factor A. We interpret this as

the excess rotational effect caused by the presence of the ith level of factor A

upon the overall mean quaternion.

4. β j is the main rotational effect of the jth level of factor B.

5. γ ij is the rotational interaction of the ith level of A with the jth level of B.

The interpretation of this interaction is basically similar to that for standard

ANOVA but modified by the fact that the effect is rotational.

Keeping in mind the inherent non-commutativity of this and given the particular

order of terms in (3.83), one possible definition for the parameters is the following:

(3.84) µ = η .. ,

(3.85) αi = η i. ∗ η ∗.. ,

(3.86) β j = η ∗.. ∗ η .j ,

(3.87) γ ij = η ij ∗ η ∗i. ∗ η ∗.j ∗ η .. ,

subject to the following constraints:

X
(3.88) ◦ αi = 0,
i
X
(3.89) ◦ βj = 0,
j
X
(3.90) ◦ γ ij = 0 for all j,
i
X
(3.91) ◦ γ ij = 0 for all i.
j
61

We see that all the parameters are unit quaternions, i.e., µ, α, β, γ ∈ S 3 as the

η’s are basically means that we would estimate using their sample counterparts. We

defined the parameters above in a particular order such that we have “cancellation” of

terms, i.e., each term will cancel out with each conjugate if it exists. This cancellation

is needed for equation 3.83 to hold true. The non-commutativity of the quaternion

product implies again that our estimates will change if we switch the order of the

terms.

Inference can be performed using the angle of rotation metric as a test statistic.

Suppose we wish to compare nested models ω and Ω where dim(Ω) > dim(ω). The

test statistic is then given by


Pn
i=1 arccos q̂Ω ω
i · q̂i
(3.92) t=
n
which represents the mean angular distance between the orientation produced by the

Ω fit with that of the ω fit over all the observations. We would reject the ω or null

model if our test statistic is larger than some critical value. We use a permutation

test procedure to find a critical value at which the size of the test is α. By randomly

permuting the assignment of the factors of interest (those that are in Ω but not in

ω), and fitting our null and alternative QANOVA models each time, we obtain the

null distribution of our test statistic conditioned on the values of η ∈ ω. We then

assign the critical value to be the (1 − α) quantile of this permutation distribution.

We can extend the QANOVA model to a functional one in a relatively straight-

forward manner. By using the techniques laid out in section 3.4.2 we obtain the

quaternion spline coefficients. We then fit identical QANOVA models to all m co-

efficients to get estimates of the mean quaternion spline function for each factor

combination. This is analogous to the functional regression models we fit in the tan-

gent mapping approach. Inference is done by replacing the angle of rotation metric
62

with the DTW metric (3.61) in our test statistic formulation. Thus (3.92) becomes
Pn  
Ω ω
i=1 DTW Q̂i , Q̂i
(3.93) t=
n

where Q̂Ω ω
i is the fitted trajectory under the alternative model and Q̂i is that under

the null model. These fitted trajectories are obtained by converting the fitted spline

coefficients back to data.

Obviously these methods require us to have categorical predictors and we would

need to“factorize” any that are continuous. This in turn produces prediction inter-

polation issues and thus the technique is more useful as an inference tool rather than

as a prediction model.

3.4.5 Simulated Power Study

As we have stated throughout the previous subsection the ordering of the QANOVA

terms affects our estimates. We would like to compare the power of the functional

QANOVA test for different orderings of the model terms. Simulation studies were

conducted based on a subset of the experimental data presented in chapter four. A

detailed description of the experiment and data is found in section 4.1.2.

Briefly, the experiment involved subjects making reaches to an array of targets

and gripping a wooden block. The data we chose for this simulation study was for

reaches made to one of these blocks. There are four possible ways to grip this block

and we want to see if there is a significant “grip” effect. We have 104 observations

in this particular subset of the data.

We need to simulate the response quaternion spline coefficients, and we do this

by taking the following steps:

1. Fit a mean-only model using our functional regression model in the tangent

mapping approach. We then obtain the fitted spline coefficients from this model.
63

2. Fit another model with the factor “grip”. We again obtain the fitted spline

coefficients for this alternative model. We also calculate the estimated 3m × 3m

covariance matrix, Σ̂ from our residuals.

3. Generate independent 3m variate Gaussian error terms that have mean 0 and

covariance Σ̂.

4. Add this error to both the mean-only model coefficients as well as to the model

with the ”grip” factor.

5. Convert these tangent mapped spline coefficients back to quaternions using the

exponential map.

6. Take a weighted spherical average of the mean-only model spline coefficients

with that of the “grip” model spline coefficients using the slerp algorithm. The

weight, θ, runs from 0 (which produces the null fit) to 1 (which produces the

alternative fit).

Thus we set the value of our nuisance parameter, which is the overall mean, as the

fitted mean from the mean-only model.

For each set of simulated data, we fit the null functional QANOVA model such

that the fitted value of the uth quaternion spline coefficient at the ith level of the

“grip” factor is given by

u u u
(3.94) q̂i = µ̂ = η̂ . .

There are only two possible orderings of the terms for the alternative model in this

simple case; the first is

(3.95) u
q̂i = u
µ̂ ∗ u
α̂i = u
η̂ . ∗ u η̂ ∗. ∗ u
η̂ i
64

Power Plots
1
Order 1
0.9 Order 2
Lik ratio
0.8

0.7

0.6

power
0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1
theta

Figure 3.6: Plots of power versus θ for the one-way functional QANOVA simulation study. We have
two curves for the two different term orderings and a curve for the likelihood ratio test.

and the second is

(3.96) u
q̂i = u
α̂i ∗ u µ̂ = u
η̂ ∗. ∗ u
η̂ i ∗ u η̂ .

We conducted the DTW based tests on both orderings and either accepted or rejected

the null model. We calculated the proportion of times we rejected the null out of the

2000 trials and plotted these versus θ (see figure 3.6). When θ is zero this proportion

gives us the size and for all other θ it gives us the power. We used the permutation

critical values for the DTW test (for each ordering) as well as the likelihood ratio test

so that we could set the size for all the tests to be exactly 0.05. We see that for this

simple univariate case the different ordering has no effect on the power. We also used

the likelihood ratio test from the functional regression tangent-mapping approach.

There appears to be very little difference between the methods with perhaps a slightly

lower power for the likelihood ratio test when θ is between 0.1 and 0.6.

We conducted another study on a more complex problem to see if there was a

significant “pod” effect in the presence of a “block” and “grip” effect. Using the
65

same process as before, we have the null functional QANOVA fitted value of the uth

quaternions spline coefficient at the ith level of “pod” (α), the jth level of “block”

(β) and the kth level of “grip” (γ), to be

u u
(3.97) q̂ijk = γ̂ k ∗ u β̂ j ∗ u µ̂

(3.98) = u
η̂ ∗... ∗ u
η̂ ..k ∗ u
η̂ ∗... ∗ u
η̂ .j. ∗ u
η̂ ... .

We then looked at three different orderings for the alternative fits. The first two

have the “pod” effect term added either at the front of the null model ordering or at

the end which is an analagous case to the the simple one-way study we did before.

This gives us

u u u
(3.99) q̂ijk = α̂i ∗ γ̂ k ∗ u β̂ j ∗ u
µ̂

(3.100) = u
η̂ ∗... ∗ u η̂ i.. ∗ u
η̂ ∗... ∗ u
η̂ ..k ∗ u
η̂ ∗... ∗ u
η̂ .j. ∗ u
η̂ ... ,

and

u u u
(3.101) q̂ijk = γ̂ k ∗ β̂ j ∗ u µ̂ ∗ u
α̂i

(3.102) = u
η̂ ∗... ∗ u η̂ ..k ∗ u η̂ ∗... ∗ u η̂ .j. ∗ u η̂ ... ∗ u η̂ ∗... ∗ u η̂ i.. .

The last one was a completely different ordering given by

u u u
(3.103) q̂ijk = β̂ j ∗ µ̂ ∗ u α̂i ∗ u
γ̂ k

(3.104) = u
η̂ ∗... ∗ u η̂ .j. ∗ u η̂ ... ∗ u η̂ ∗... ∗ u η̂ i.. ∗ u
η̂ ∗... ∗ u
η̂ ..k .

The power curve plot in figure 3.7 was then obtained again with the likelihood

ratio test given as a comparison. We see that the power level for the first two

orderings are almost the same, as expected, while the final ordering produces a much

higher power. All three QANOVA methods are more powerful than the likelihood

ratio test.
66

Power Plots
1
Order 1
0.9 Order 2
Order 3
0.8 Lik ratio

0.7

0.6

power
0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1
theta

Figure 3.7: Plots of power versus θ for the second simuation study. We have three curves for the
different QANOVA term orderings and one for the likelihood ratio test.

In the simple case of one-way QANOVA the two orderings have little effect on the

power but it does make a difference for the more complicated scenario. The more

terms we have in the model the exponentially greater the possible orderings become

and thus more difficult to assess which ordering will provide the greatest power.

We still need to discover, first of all, why there is such a discrepancy and whether

there is a systematic method for figuring out which ordering produces the highest

power. Simulation studies of higher order layouts and an exhaustive comparison of

all possible orderings, although time consuming, may be the only way of finding the

optimal order. For readers who are interested in recreating these graphs please send

an e-mail to choes@umich.edu.

Critical values for the QANOVA tests need to be obtained using the permutation

procedure. For main effects this process is simple, but if we wish to test the presence

of interaction effects, it is not so obvious. We need to find a way of adapting the

permutation method for such situations — possibly using a Latin Squares approach.
CHAPTER IV

Application

4.1 An Orientation Trajectory Model for the Right Hand in Unladen


Reaches

In this section we apply the techniques set out in the previous chapter and describe

a model for the right hand that forms part of the HUMOSIM full-body motion

prediction model. This application was the main impetus for my research.

4.1.1 Purpose of Model

The purpose of our model is to predict an orientation trajectory for the right hand

during reaching motions. The hand is considered the end effector in this case and is

not holding any sort of object. The user of this model will provide the starting and

ending location and orientation of the hand (we envision a graphical interface where

the end-user places target “hand prints” — see figure 4.1) as well as information

about the human figure such as age, sex and anthropometry.

4.1.2 Description of Experiment

The data with which the model was built are from an experiment conducted at

the HUMOSIM laboratory in the summer of 2000. The purpose of the experiment

was to assess how the terminal hand orientation affected the entire body posture

during seated motions. Experimental fixtures were built wherein a subject would

67
68

Figure 4.1: Illustration of how the user will place target “hand-prints” for the human model to
reach to.
69

reach to an object placed in different locations and grasp it with the hand in several

rotated orientations.

The experiment task was implemented by presenting a set of five standard grip

blocks clustered on the faces of a cube array. The cube was constructed with each

side face turned 20 degrees to the front to enhance visibility and to tighten the

cluster of blocks. Each cluster or pod represented a spatial locality and each of the

five near faces of the array represented a direction effect. Four hand orientations

for gripping different edges of the five blocks provided an orientation effect. The

edges of the grip blocks were color-coded: Top was green, right was red, bottom

was blue, and left was yellow. Three clusters were stacked and supported from

a post (tower) that was repositioned with respect to the subject to provide four

lateral locations. Figure 4.2 illustrates this experimental setup. This created a

total of 4(tower) × 3(pod) × 5(block) × 4(grip) = 240 possible location/orientation

combinations for the hand of which 210 were deemed reachable. Thus the entire

dataset consisted of 4410 trials.

Twenty subjects were selected to distribute age, sex and height. Table 4.1 shows

a breakdown of these subjects.

A combination of two systems were used for motion-capture: a six-camera “MacRe-

flex” optical tracking system and a five-sensor “Flock of Birds” electromagnetic sys-

tem. Since these were seated reaches, subjects were outfitted with sensors only from

the hip and above. Figure 4.3 shows placement of the sensors. Using a combina-

tion of this motion-capture data and detailed anthropometric measurements taken

from the subjects, the x-y-z coordinate trajectories for each marker location in the

HUMOSIM linkage system (see figure 4.4) were calculated.

All subjects began their reach motions from a “home” position with the right hand
70

(a) Cluster of Grip Blocks (b) Individual Tower

(c) Lateral Arrangement of Tower

Figure 4.2: Illustration of experiment setup. (a) Each cluster consists of five blocks. The blocks were
color-coded and the subject was asked to grip the block with the thumb on a selected
color side. (b)Three clusters were placed at different heights on a tower. (c)The tower
was then placed in four positions: 45◦ to the left, forward, 45◦ to the right, 90◦ to the
right.
71

(a) Front

(b) Back

Figure 4.3: Illustration of placement of optical markers (shown as circles) and electromagnetic sen-
sors (shown as squares) on a subject
72

Figure 4.4: Illustration of the marker positions for the HUMOSIM linkage system. For our experi-
ment we will not have any of the markers below the hip.
73

Table 4.1: Anthropometry of subjects in Terminal Hand Orientation and Effort Reach Study, 2000

Subject M/F Age Weight Height


(yrs) (kg) (cm)
1 M 20 60.9 173.8
2 F 21 67.1 163.1
3 M 22 81.4 185.5
4 F 21 43.6 150.0
5 F 48 61.0 169.9
6 M 33 81.1 176.5
7 M 68 76.8 190.5
8 F 48 67.3 163.9
9 F 70 56.4 151.6
10 F 52 76.6 149.6
11 F 34 59.4 164.3
12 F 54 59.3 160.5
13 M 68 95.1 173.3
14 M 44 87.3 171.3
15 M 49 64.3 166.1
16 M 48 70.5 174.6
17 F 54 58.0 160.6
18 M 35 81.0 186.1
19 M 53 86.0 170.1
20 F 29 87.4 170.1

resting on the right thigh. Subjects also had to push or pull the block after gripping

it but we decided not to differentiate between this as the purpose of our model was

to predict reaching tasks1 . We divided each reach into two distinct trajectories: one

for going toward the target and one for returning to the home position, giving us

a total of 8820 motions. We fit separate models for each: the “Go” model and the

“Return” model.

4.1.3 Data Preparation and Fitting of the Speed-Adjusted Slerp Residual Functional
Regression Model

We calculated the local orientation trajectory of the right hand with respect to

the right forearm using the techniques laid out in section 3.1. The first step for this

was to obtain the rotation matrices with respect to the global coordinate system
1 Analysis seemed to indicate that there was no siginificant difference
74

for both the hand and the forearm. Using the marker nomenclature in figure 4.42 ,

the basis vectors that form the rotation matrices’ columns are given as, first for the

hand:

(rgrip − rwrist)
(4.1) xhand = ,
k(rgrip − rwrist)k
(rhand − rwrist) × (rgrip − rwrist)
(4.2) yhand = ,
k(rhand − rwrist) × (rgrip − rwrist)k
xhand × yhand
(4.3) zhand = .
kxhand × yhand k

and then for the forearm:

(rwrist − relbo)
(4.4) xforearm = ,
k(rwrist − relbo)k
(rwrist − relbo) × (rshoul − relbo)
(4.5) zforearm = ,
k(rwrist − relbo) × (rshoul − relbo)k
zforearm × xforearm
(4.6) yforearm = ,
kzforearm × xforearm k

where × represents the cross product. Using this method of calculation, we define the

identity or reference orientation of the hand to be aligned with the forearm and have

the palm facing downwards. We shall call this the neutral orientation; see figure

4.4. We discovered though that there were instances of instability in the forearm

orientation due to problems with zforearm . This basis vector is calculated as the

normal vector to the plane formed by the forearm and the upper arm. When the arm

is bent at the elbow this plane is well-defined but when the arm is straight the forearm

and the upper arm is aligned and the plane collapses causing the cross-product to

become unstable. With no alternative way to obtain the forearm orientation the

data for such cases had to be dropped. There were additional problems that included

coincident and missing marker positions. All told, the amount of motions that were
2 rshoul, relbo and rwrist are the joint center locations (which are derived) of the right shoulder, elbow and wrist,

respectively. rhand is the location of the electromagnetic marker placed of the back of the right hand. rgrip is a
derived location that represents the grip center or the middle of the palm
75

Figure 4.5: “Handplot” of the neutral orientation. The conical cylinder shows the forearm aligned
parallel to the x-axis. The hand is, in turn, aligned to the fore arm with the palm facing
downwards.

used to produce each model was 3071 for the “Go” model and 3096 for the “Return”

model.

Using the appropriate conversion algorithm (see appendix) these rotation matri-

ces were converted into global quaternions for the hand and the forearm. The local

quaternion trajectory for the hand was then calculated from the resulting global tra-

jectories using (3.1). Depending upon the domain and range of the inverse trigono-

metric functions in the computer software, it is possible that the calculated trajec-

tories will flip between antipodes. Since we have smooth motions and each posture

is only one twentieth of a second apart we can use a simple modification of the flip

algorithm to select the antipode that is closer to the posture preceding it.

The data also needed to be “cut” to remove some of the frames at the beginning,

before the hand begins its rotational motion, and at the end, after the hand has

completed its rotational motion. We need to do this to get rid of this unwanted

source of variability and also to maximize the use of our cubic B-splines so that we
76

do not waste precious parameters on fitting absence of motion. There unfortunately

is no definite rule on how to determine these cut points and that makes this somewhat

arbitrary. As a first step to determining these cuts and for use in the speed-adjusted

slerp, we obtain the angular speed profile (3.39) for each of our observed trajectories.

We define the starting cut point as the frame just before the speed profile first exceeds

5◦ per second and the end cut point as the frame just after the speed profile last falls

below 5◦ per second.

Comparing our rotational cut points with the translational cut points obtained

by Wang (2006), it appears that the hand starts to rotate before translational motion

begins and finish after translation ends. Histograms of the difference between the cut

points are shown in figure 4.6. The difference in the starting point is small enough

such that we can probably attribute it to the fact that we used separate methods

to cut our data but the discrepancy in the endpoint is quite large. Plots of the cut

speed profiles (see figure 4.7) typically show a right skewed shape indicating that

there is a period of fine-tuning of the orientation toward the end of the motion.

We then proceeded to fit our speed-adjusted slerp model to our cut local quater-

nion trajectories using (3.40) and from that, obtained our speed-adjusted slerp resid-

ual trajectories. Since all these start and end at the identity the mean quaternion

was very close to it (around 4◦ different) and so we decided to take the tangent space

at the identity to reduce calculation.

We then fit cubic B-splines to our tangent mapped residuals using (3.34). We

had to restrict the B-spline curves to start and end at the origin 0 due to the nature

of the residual trajectories (see appendix). We used 8 basis functions for our spline

fit as we judged this to be the minimum amount required to provide a good fit to

the data. The use of more basis functions did not produce a substantial increase
77

0.25
0.20
0.15
0.10
0.05
0.0

0 20 40 60

Difference in start cutoff point (no. of frames)

(a) Start
0.06
0.05
0.04
0.03
0.02
0.01
0.0

0 20 40 60 80

Difference in end cutoff point (no. of frames)

(b) End

Figure 4.6: Histograms of the difference in the start cutoff points and end cutoff points between
rotational and translational motion defined as ∆ = Rotation − Translation. The units
are the number of frames.
78

Figure 4.7: Plot of a typical angular speed profile.

in fit and it was deemed to be not worth the increase in dimensionality; see table

4.2. A few trajectories had less than the minimum 14 frames required to fit our

spline. Rather than throw these observations away, we used the slerp algorithm to

interpolate between successive frames so that we doubled the frames available; this

was enough to ensure that all such trajectories had the requisite 14 frames.

Now that we had our response data — the stacked trivariate spline control points

(3.49) we proceeded to consider our explanatory variables. These were:

1. Sex: Sex of subject.

2. Age: Age of subject in years.

3. Weight: Weight in kg.

4. Height: Height in cm.

5. Rdist: Angle of rotation distance of the hand orientation at the target from

the neutral orientation (see figure 4.5). For the “Go” model this would be

obtained from the last observation, qend in each local quaternion trajectory.
79

We use Rdist = arccos(scalar(qend ) where the range is between 0 to π. For the

“Return” model the same formula is applied to the first observation qstart .

6. Radius, Theta, Phi: Spherical co-ordinates of right hand wrist joint at target.

For “Go model we would use the final hand position and for the “Return model

the initial hand position. We set up a Cartesian co-ordinate system such that

the mid-point of the hip (obtained by averaging the left and right hip markers)

is the origin and the x-axis extends to the right of the torso parallel to the

ground, the y-axis extends forward and finally the z-axis extends perpendicular

to the ground. Radius r is the Euclidean distance (in cm) to the right hand

marker location from the midhip. From this we calculate:

y 
(4.7) θ = arctan ,
x !
p
x2 + y 2
(4.8) φ = arcsin .
r

See figure 4.8 for an illustration.

7. Expx, Expy, Expz: This is the orientation of the right hand at the target location

with respect to the forearm. We use the logarithm map to convert these to

tangent vector form. For the“Go model we would use logmap(qend ) and for

the “Return model we would use logmap(qstart ).

Target information was converted from factors — tower, pod, block, grip, to

continuous variables to allow us to make predictions beyond the experimental target

location settings. We also used spherical co-ordinates with respect to the midpoint

of the hip to allow us to predict in instances when the subject moves about such that

the model will be robust to different global coordinate systems.

We used S-plus to fit our model using the “mlm” package. Using the Wilkinson-
80

Figure 4.8: Illustration of spherical co-ordinates r, θ, φ. Adapted from Weisstein (2006)

Rogers notation for specifying models we fit two models:

Spline Coefs ∼ factor(Sex) ∗ (Age+Weight+Height+Rdist+Radius+Theta

+ Phi+Expx+Expy+Expz)

Spline Coefs ∼ factor(Sex) ∗ (poly(Age, Weight, Height, Rdist, Radius, Theta,

Phi, Expx, Expy, Expz, 2))

where the poly(. . . ,2) represents a second order polynomial model. The first model

had 22 regression coefficients to estimate while the second model had 132 due to the

interaction terms. This was done for both the “Go” and the ”Return” model.

In both cases a likelihood ratio test was performed to compare the two nested

models using (3.57) resulting in a p-value that was almost zero. Thus there was a

significant statistical difference between both models. A test of both models against

the mean only model also resulted in a rejection of the null model. Fit however
81

Table 4.2: DTW distance as compared to actual observed local quaternion trajectory

Model Go Return
Spline 8 7.0761◦ 6.5046◦
Spline 10 7.0022◦ 6.3815◦
Spline 12 6.9554◦ 6.3197◦
Slerp 10.7696◦ 11.0869◦
1st order 9.9027◦ 9.9040◦
2nd order 9.2827◦ 9.4976◦

appeared to be poor; adjusted R2 values for each of the 24 spline control points were

very low— the highest of them being around 20% for the first order models and 25%

for the second order models.

We converted our fitted spline control points all the way back to a local quater-

nion trajectory to compare with our observed trajectories. We also looked at the

speed adjusted slerp trajectories as well as the spline fit trajectories. The spline fit

trajectories are, in effect, what we are treating as our observed data when we fit

our functional regression model and would therefore be considered the best we could

possibly do. We looked at spline fits using eight, ten and twelve basis functions to see

if there were substantial improvements to be made with using more basis functions.

This turned out not to be the case. We used the DTW method to make our com-

parisons. Table 4.2 shows the mean DTW distances for each of the fitting methods

compared with the actual observed trajectories.

To illustrate how to interpret these numbers, let us look at the comparison between

the spline fit trajectory and the actual trajectory. The DTW distance indicates that

on average each the orientation of the right hand in each frame of the spline fit

trajectory differs by 7.0761◦ from its counterpart frame from the actual trajectory.

Thus the process of first mapping onto the tangent space and then approximating

using cubic regression splines introduced an error of this magnitude. We also need
82

Figure 4.9: Picture depicting the local orientation of the hand with respect to the forearm (forearm
remains stationary), a “handplot”, for a reach where the first order model fit showed
a 10◦ DTW difference with the actual observed trajectory. The speed-adjusted slerp
trajectory is also shown. The frames are equally spaced in the time domain. Most of
the noticeable difference occurs in the second and third frames.

to note that by definition, all of our fitted trajectories are restricted to be the same

as the actual at the beginning and the end. To get a better idea of how much a 10◦

DTW discrepancy appears in reality we illustrate an example using a “handplot” in

figure 4.9. There appears to be only a small noticeable difference between the actual

and the predicted.

We see that the speed-adjusted slerp fares only slightly worse than the slerp

residual functional regression models. This seems to indicate that whatever source

of variability that remains after the speed-adjusted slerp has been fit does not seem

to depend very much on the explanatory variables we included in our model. The

very low R2 values that we obtained also provide evidence that this is so.
83

Table 4.3: DTW distance for the different models when data are subdivided by angular distance
to target orientation

Model > 115◦ ≤ 115◦


Slerp 11.6479◦ 10.7139◦
1st order 10.1104◦ 9.8896◦
2nd order 10.0377◦ 9.2349◦

We already believed that our speed-adjusted slerp model would be reasonable

model for simple reaches where the target hand orientation was close to the initial

hand orientation. For more extreme reaches we had expected a substantial improve-

ment in prediction ability for our slerp residual model. This however turned out to

be not the case. Using the Rdist variable we subdivided our data to those where

the target orientation was greater than 2 radians or 115◦ different from the initial

position. Table 4.3 shows the comparisons for all our models via the average DTW

distance measure. The slerp performs almost a 1◦ worse for such “extreme” reaches

while the first order model exhibits a fall of less than 0.25◦ so the data does seem to

indicate that the slerp residual model does a little bit better but it is definitely not

the large and noticeable difference that we had expected.

To study this further we grouped the data into twenty separate classes based on

Rdist. We then calculated the 5th, 50th and 95th percentile DTW distance for the

first order model and the slerp model at each class level. A plot of these percentiles

against the Rdist classes are given in figure 4.10. The plot seems to agree with

the conclusion that there does not appear to be a large difference between the slerp

fit and the first order model fit, even for reaches to targets with a large rotational

difference.

The speed-adjusted slerp can be considered the “straight line” model in rotational

terms and since it has no predictors is the simplest model possible. Its simplicity will
84

Rdist vs DTW
0.2

0.18

0.16

0.14

Half DTW distance in radians


Order 1 5%
Order 1 Median
Order 1 95%
0.12 Slerp 5%
Slerp Median
Slerp 95%
0.1

0.08

0.06

0.04

0.02
0 2 4 6 8 10 12 14 16 18 20
Rdist Class (1−20)

Figure 4.10: Plot of 5th, 50th and 95th percentile DTW distance for the first order model and the
slerp model by Rdist class. The Rdist variable measures the angle of rotation metric
between the orientation of the hand at the target with the “neutral” orientation. We
grouped the data into 20 separte classes based on the Rdist.

make it robust for prediction purposes and easy to implement. Since the predictors we

have chosen seem to have little effect on the model we must conclude that either there

are other more effective predictors that we don’t know about or that the remaining

variability is just due to the randomness inherent in human motion. Unfortunately,

we did not have subjects replicating reaches to targets so it is is not possible to assess

this.

4.1.4 Functional QANOVA

We made the assumption that there is no effect on the orientation trajectory due

to whether the subject performed a push or a pull on the block. As an illustration

of the constraint approach and the functional QANOVA we will test this on a small

subset of the data. We look at just the “Go” reaches made to the front tower, middle

pod and center block. This resulted in a total of 104 observed trajectories with at

least 1 reach per subject (except for subject 11) and ranging from 1 observation for
85

subject 20 upto 8 observations for subject 1.

We again use the speed-adjusted slerp residuals as our base data such that any

predictions we make will start and end at the orientations specified by the user. The

first step was to fit spherical regression splines (see section 3.4.2)to our slerp residuals

but found that our ALM optimization program had difficulty in finding a solution.

The use of professional optimization software might have solved this but we did not

have such software available to us. As we mentioned already, the splining method

using the tangent approach produced good fits to the data and we decided to modify

this approach for our QANOVA analysis.

In the tangent mapping approach we had to map all of our trajectories onto a single

tangent space before fitting our spline data. This process introduced on average an

error of 7.0761◦ in DTW distance due mostly to the distortion effects of the tangent

mapping procedure. If we were to map each trajectory onto a separate tangent space

taken at its mean point we can reduce this distortion effect even further. We can do

this since we are going to map our spline control points back onto S 3 which we require

for our QANOVA model. However, we do need to keep track of the mean points for

each trajectory, which makes prediction using this method impossible unless we fit

a separate model for this mean point as well.

Since the purpose of the model was to illustrate the QANOVA method and assess

the existence of the push/pull effect we went ahead with using the modified tangent

splining method. Using the formulation similar to (3.94)—(3.96), we define the first

ordering of the alternative model as

(4.9) u
q̂i = u
µ̂ ∗ u α̂i = u
η̂ . ∗ u
η̂ ∗. ∗ u η̂ i ,
86

and the second ordering as

(4.10) u
q̂i = u
α̂i ∗ u
µ̂ = u
η̂ ∗. ∗ u η̂ i ∗ u
η̂ . ,

where i has two levels — push or pull. The null model is given by

u u u
(4.11) q̂i = µ̂ = η̂ . .

We then calculated the DTW test statistic for both orderings using (3.93), ob-

taining 0.8077 and 0.8119, respectively. The next step was to use the permutation

procedure described in section 3.4.4 to obtain the null distribution of the test statis-

tic and hence the critical value. The critical values for a 5% level test of the two

orderings were obtained to be 2.0117 and 2.0036 and thus we would fail to reject the

null in both cases. This seems to suggest that, at least for this subset of the data,

that we were justified in not differentiating between the push/pull tasks.

4.1.5 Joint Limit Estimation

In section 3.3.3 we set out a quick and simple method for estimating the range

of motion limit for a joint from data using the empirical maximum Mahalanobis

measure. In our experiment we had a wide range of orientations for the right hand

including many that were on or close to the limit. The terminal local orientations

of the hand could potentially be used as data for estimating the joint limit. Unofor-

tunately, we cannot assume that this data follows the required assumption, namely,

that we have a random sample from the joint limit boundary.

There were two potential problems that we faced because of this:

1. The terminal orientations we have were produced, not as a random sampling

of possible hand orientations, but as a result of the layout of the targets per

our experimental design. Thus there is a possible bias in our estimate of the
87

covariance matrix which would affect the general shape of the ellipsoid — the

directions of the three principal axes and the ratio of the three radii.

2. Using the maximal Mahalanobis distance makes our limit sensitive to data prob-

lems. Outliers caused by faulty data would not only affect the shape of the el-

lipsoid but also result in us perhaps choosing too large an isoprobability contour

and thus overestimating our joint limit.

The first problem is difficult to solve. One way to reduce the bias is if we remove

the interior points and keep only those that form the convex hull of our tangent

mapped terminal orientations. This way we remove nearly all of the potential bias

sources and weight each of the exterior extreme orientations equally. The second

problem is easier to handle. Instead of using the maximum sample mahalanobis

distance we could use the ninety-fifth percentile. We could also use a more complex

robust covariance estimate such as that produced by the nearest neighbour variance

estimation method developed by Wang and Raftery (2002).

We used the tangent vectors of the target local orientations taken at the identity—

Expx, Expy and Expz which we already calculated as a covariate for our func-

tional regression model. We then identified the convex hull of these tangent vec-

tors and used just these exterior points for our covariance estimation. We recal-

culated the quaternion mean of the convex hull points, which turned out to be

q̄ = (−0.12843, −0.064967, 0.0070096, 0.98956), such that we could recenter our

tangent gaussian. There were fifty of these points and we looked at each one to

see if any had obvious faults. All were extreme but realistic orientations that were

on or close to the joint limit and thus we decided that we didn’t need to use the

robust covariance estimation method or the 95th percentile mahalanobis distance.


88

We estimated the covariance matrix of our recentered fifty tangent vectors to be:
 
 0.4982 0.0598 0.0266 
 
(4.12) Σ̂ =  0.0598 0.1758
 
 −0.0263 

 
0.0266 −0.0263 0.1286

The sample mahalanobis distances for each of our vectors v1 , . . . , vn is given by:

h i 12
(4.13) dMah (vi ) = viT Σ̂−1 vi

We then obtained the maximal distance γ̂ = 2.3632 and thus the formula for our

ellipsoid is given as:

x21 x22 x23


(4.14) f (x = PT v) = + + = 2.36322
0.78512 1.00852 1.68792

where
 
 −0.1324 −0.1226 −0.9836 
 
(4.15) P =  0.4715
 
 0.8651 −0.1713 

 
0.8719 −0.4864 −0.0567

A plot of the joint limit and the data are given in figure 4.11. To assess the effec-

tiveness of the joint limit we sampled 25 points from the surface of the ellipsoid (see

figure 4.12) and produced handplots for each (see figure 4.13). Unfortunately, we can

see a few orientations that seem impossible3 — [1,4], [2,1] and [2,4], and a few that

do not seem as extreme as one would hope — [3,3] and [3,4]. If the estimated limit

rsults in too many impossible orientations, we can improve upon it simply by using

a lesser empirical quantile of the Mahalanobis distances instead of the maximum.

We can easily check if a potential prediction orientation lies beyond our calculated

limit by performing three simple steps:


3 We use a matrix index-type identifier, e.g. [1,2] is the plot on the first row and second column.
89

Figure 4.11: Ellipsoidal Joint Range of Motion Limit estimated from our terminal local orientations

Figure 4.12: 25 sampled points from our Ellipsoidal Joint Range of Motion Limit
90

Figure 4.13: Handplots of the 25 sampled points from our Ellipsoidal Joint Range of Motion Limit.
Using a matrix index to identify a plot, e.g. [2,4] is the plot that is on the second row
and fourth column, we identify those that appear to be impossible — [1,4], [2,1] and
[2,4], and those that appear not to be
. on the joint limit boundary — [3,3] and [3,4]
91

1. Map the predicted quaternion onto the tangent space centered at q̄.

2. Calculate the mahalanobis distance of this point.

3. Look at the prediction more carefully if the distance is close to the limit given

by γ̂ = 2.3632.

As expected the ellipsoidal shape of our isoprobability contour is too simplistic to

accurately depict the joint limit. The joint limit for the shoulder produced by Herda

et al. (2002) appears to be quite a bit more complex and it would be reasonable to

assume that this is the case for the wrist as well. Still the ellipsoid appears to be a

reasonable approximation and can be used as a quick and effective check to see if a

predicted orientation is close to the joint limit.

We can also study the variability of the joint limits by subject. If we make the

naive assumption that the shape of the limit is the same for everyone4 , then we

can use the maximum mahalanobis distance as a simple univariate measure of how

flexible or “limber” a particular subject’s wrist is. We modeled this with respect to

the sex, age, weight and height of the subject. Only weight and sex appeared to be

significant predictors and the relationship is illustrated in figure 4.12. Interestingly,

it appears that wrist flexibility increases with weight for females while the opposite is

true for males. Our original experimental design had all twenty subjects reaching to

the same set of targets but due to data problems we had to drop some observations.

This means that we cannot really compare the limits between subjects as they were

not produced from the same collection of reach targets.

4 This assumption would exclude the possibility that some people can be more flexible in a certain direction while

being simultaneously less flexible in another.


92

Figure 4.14: Plot of mahalanobis distance versus weight of subject. Males are indicated by “M” and
females are indicated by “F”. The regression line for males is given by the solid line
while the one for females is given by the dashed line. It appears as if wrist flexibility
increases with weight for females while the opposite holds true for males.
CHAPTER V

Discussion and Future Work

We shall now briefly summarize the contributions we have made as a result of this

research:

1. The idea of tangent mapping quaternions is not new (see Grassia (1998)). Many

authors including Prentice (1989), Rancourt et al. (2000) have used this as a

tool for analysis, where the data that they modeled were concentrated enough

such that the distortion effect was minimal. Our method of using slerp residuals

allows us to use the tangent mapping approach when the data are not initially

well concentrated.

2. Previous asymptotic results for the Bingham distribution have shown that we

can approximate highly concentrated Bingham data as normally distributed on

the tangent plane. This result is presented in the literature as basically a tool

for allowing inference to be done on such data. We have presented the tan-

gent Gaussian as a legitimate distribution for orientation data with meaningful

interpretations of the parameters involved.

3. No statistical methods existed for modeling a quaternion response with scalar

predictors. Spherical regression developed by Chang (1986)) and their deviants

(see Prentice (1989), Rivest (2001)) were designed to model pairs of orienta-

93
94

tions where one was considered the response and the other the predictor. Our

quaternion functional regression and QANOVA model allows us to model entire

functions of quaternions with respect to scalar predictors. Simple procedures

based on existing multivariate data analysis techniques such as Wilk’s lambda

and likelihood ratio tests can then be used for inference purposes.

4. The QANOVA model is a multiplicative quaternion analog of the standard

ANOVA model. The model is designed to make inference in the presence of

categorical or factor covariates. Simulation studies have indicated that they are

favorably comparable to the asymptotic likelihood based procedured used in our

funtional regression models.

5. By application of our models to the study of human motion we have discovered

that the hand seems to basically follow a slerp trajectory during reaching tasks

and that differences in anthropometry and target location cannot explain ap-

parent deviations from it. We have also introduced a simple way of estimating

joint range of motion limits based on an empirical Mahalanobis distance mea-

sure. These limits are not meant to be an accurate representation but rather a

quick method for checking the quality of any predictions made from our model.

One way to improve upon our functional regression method would be to use a

better curve fitting procedure. The cubic B-spline approach that we have used is not

the most efficient method of approximating the slerp-residual trajectories. Much of

the “action” occurs in a relatively small portion of the trajectory and thus we are

wasting some of our precious parameters on relatively unimportant sections. Since

our tangent-mapped residuals are in IR3 we could apply the modeling techniques set

out by Wang (2006). The Bezier curves use fewr parameters and might improve the
95

fit.

The lack of uniqueness of the QANOVA estimates caused by the non-commutativity

of the quaternion product is a problem. The greater the number of terms there are

in the model the more variable the estimates will be. Further study needs to be done

to figure out how variable these estimates are and which order would produce the

“best” estimate. We also need to discover why there is such a discrepancy in the

power for different orderings and whether there is a systematic method for figuring

out which ordering produces the highest power. Critical values for the QANOVA

tests need to be obtained using the permutation procedure as we do not have a de-

fined null distribution for the DTW test statistic. For main effects this process is

simple but if we wish to test the presence of interaction effects it is not so obvious.

We need to find a way of adapting the permutation method for such situations.

A major weakness of our hand orientation trajectory model is that all of our data

consisted of reaches that start and end at a “home” position. In our “Go” model we

have no variability at all in our starting orientation and therefore this severely limits

the predictive ability of our model when the user specifies a start orientation that

is far from neutral. This is true for our “Return” model which has no variability in

the final orientation. An ad-hoc blending approach that combined a prediction from

the “Go” model with one from the “Return” model was implemented for predictions

where the initial and target hand orientations were far from neutral. This blending

approach would naturally introduce a tendency toward a neutral orientation in the

middle of the trajectory. Suppose that we have a subject that starts at an awkward

orientation and reaches to a target that is spatially distant but requiring a similarly

awkward posture. If a simple slerp trajectory was fit then we would have the subject

maintaining that awkward posture of the hand throughout the course of the reach.
96

By creating a weighted blend between the slerp model and the combination of the

“Go” and “Return” model1 we can control the amount by which the tendency to

neutral occurs. Still, the absence of real data makes this approach mere conjecture.

We still do not have a viable way of obtaining confidence regions for our predicted

trajectories. Point-wise intervals as used in Faraway (2000) might be viable for

univariate trajectories but not for our trivariate tangent vector trajectories, let alone

our quaternions trajectories. In the regression model we are predicting the spline

control point values and, assuming each is trivariate normal, we expect the confidence

region for each control point to be an ellipsoid. It is difficult to imagine or represent

how the spline curve will change if we vary each control point within its confidence

ellipsoid.

Ultimately we need to combine the orientation trajectory model we have with

the translational aspect of the motion to produce a complete six degree of freedom

prediction model for the hand. Our work and that of Wang (2006) will be combined

along with other parts of the HUMOSIM framework to create a full figure motion

prediction model. We conclude with an illustration (see figure 5.1) of a combined

predicted trajectory of the right hand reaching to the bottom block of the lower pod

on the tower placed 45◦ to the left.

1 actually applied the other way round as the “Return” model predicts a trajectory that starts at a non-neutral

orientation and ends at the neutral and the “Go” model is the other way around.
97

Figure 5.1: Combined reach trajectory predicted by our model to a target from the HUMOSIM
experiment.
APPENDICES

98
99

APPENDICES

The first section of the appendix will cover algorithms that we can use to con-

vert between the various rotation parameterizations. There are numerous reasons

we would wish to do this. We have already seen that the easiest way to obtain the

orientation of an object from landmark location data is to form rotation matrices.

Therefore we would need to convert these matrices to quaternions to continue with

our analysis. The Euler angle representation can be used to better interpret our

results. In an analysis conducted on torso motion of people with spinal cord injuries

and lower back pain we converted predicted orientation trajectories into Euler an-

gles such that we can better assess and interpret the effects of these problems by

decomposing them to sagittal, transverse and axial motion.

The second section will explain how we obtained the spline design matrix or Ψ

matrix in (3.33). The Ψ matrix is made up of the spline basis functions and can be

considered as the model matrix in a regression setting.

Conversion Algorithms

A great reference and the source of the algorithms shown here is Baker (2006).

We will list only those conversions related to the quaternion parameterization:

1. Rotation matrix ↔ quaternions.

2. Euler angles ↔ quaternions.


100

Rotation Matrix ↔ Quaternions

Suppose we have a unit quaternion q = (x, y, z, w) written as a four vector. Then

the matrix form of the rotation represented by q is given as:


 
2
 1 − 2y 2xy − 2zw 2xz + 2yw 
 
µ(q) =  2xy + 2zw 1 − 2x2 − 2z 2 2yz − 2xw .
 
 
 
2xz − 2yw 2yz + 2xw 1 − 2x2 − 2y 2

The above equation is true if we replace q by its antipode −q.

The backward conversion can vary in difficulty depending on whether or not the

matrix is exactly special orthogonal i.e. SO(3). Rounding errors, in particular, could

have occurred during its synthesis and would result in the matrix not being exactly

SO(3). Suppose we have a rotation matrix,


 
 m11 m12 m13 
 
M =  m21 m22 m23 ,
 
 
 
m31 m32 m33

that we wish to convert to a quaternion, q = (x, y, z, w). The algorithm goes as

follows:

1+m11 +m22 +m33


1. If 4
> 0 then
q
1+m11 +m22 +m33
(a) w = 4
,

m23 −m32
(b) x = 4w
,

m31 −m13
(c) y = 4w
,

m12 =m21
(d) z = 4w
,

−m22 −m33
2. else w = 0 and if 2
> 0 then
q
−m22 −m33
(a) x = 2
,
101

m12
(b) y = 2x
,

m13
(c) z = 2x
,

1−m33
3. else x = 0 and if 2
> 0 then
q
1−m33
(a) y = 2
,

m23
(b) z = 2y
,

4. else y = 0 and z = 0.

Euler Angles ↔ Quaternions

As mentioned before Euler angles are defined by their order and thus our conver-

sion algorithms depend on this. Let us assume that we are using the XY Z ordering

for the Euler angles and define the angles as a triple (α, β, γ). If we wish to convert

this particular definition of Euler angles to a quaternion, q = (x, y, z, w), we have:

1. w = cos γ2 cos β2 cos α2 + sin γ2 sin β2 sin α2 ,

2. x = cos γ2 cos β2 sin α2 − sin γ2 sin β2 cos α2 ,

3. y = cos γ2 sin β2 cos α2 + sin γ2 cos β2 sin α2 ,

4. z = sin γ2 cos β2 cos α2 − cos γ2 cos β2 sin α2 .

For the quaternion to Euler angles conversion we have:

2xy+2wz
1. γ = arctan 1−2y 2 −2w 2 ,

2. β = arcsin(−2xz + 2wy),

2xw+2yz
3. α = arctan 1−2x 2 −2y 2 .
102

Spline Design Matrix

Suppose that we observe y1 , . . . , yn from a function y(t) at equally spaced time

points t1 , . . . , tn which is rescaled such that t1 = 0 and tn = 1. We wish to fit

a regression spline to this data using m B-spline basis functions of degree p. For

i = 1, . . . , m, the basis functions can be defined as:



 1 if ki ≤ t < ki+1

Bi,1 (t) =
 0 otherwise

t − ki ki+p+1 − t
Bi,p+1(t) = Bi,p (t) + Bi+1,p (t)
ki+p − ki ki+p+1 − ki+1

where k are known as knot points. If the function yt is constrained such that it starts

and ends at 0,2 then our knot sequence is given by k1 , . . . , km+p+3 where k1 = . . . =

kp+1 = 0 and km+p+3 = . . . = km+2 = 1. Otherwise our knot sequence is given by

k1 , . . . , km+p+1 where k1 = . . . = kp+1 = 0 and km+p+1 = . . . = km = 1. From (3.33)

we have that:

Yn×1 = Ψn×m Pm×1 + ǫn×1 .

In the unconstrained problem, ψij , the ijth element of Ψ is given as:

ψij = Bj,p+1(ti )

where i = 1, . . . , n and j = 1, . . . , m. For the constrained problem we first make a

matrix with two extra columns Ψ∗n×(m+2) . ψij ∗ , the ijth element of this new matrix

is given as:

ψij∗ = Bj,p+1(ti )

where i = 1, . . . , n and j = 1, . . . , m + 2. Our Ψ matrix is then just the Ψ∗ matrix

with the first and last columns removed.


2 Our slerp residual data would be an example of this
BIBLIOGRAPHY

103
104

BIBLIOGRAPHY

Baker, M. (2006). www.euclideanspace.com.


Barr, A., B. Currin, S. Gabriel, and J. Hughes (1992). Smooth Interpolation of Orientations with
Angular Velocity Constraints using Quaternions. Computer Graphics, ACM Press, 313-320.
Bingham, C. (1974). An Antipodally Symmetric Distribution on the Sphere. The Annals of
Statistics, 2, 6, 1201-1225.
Buss, S. (2003). 3D Computer Graphics: A Mathematical Introduction with OpenGL. Cambridge
University Press, UK.
Buss, S. and J. Fillmore (2001). Spherical Averages and Applications to Spherical Splines and
Interpolation. ACM Transactions on Graphics, Vol. 20, No. 2, 95-126.
Chang, T. (1986). Spherical Regression. The Annals of Statistics, Vol. 14, No. 3., 907-924.
Downs, T. (1972). Orientation Statistics. Biometrika, 59, 3, 665-676.
Faraway, J. (1997). Regression Analysis for a Functional Response. Technometics, 39, 254-261.
Faraway, J. (2000). Modelling Reach Motions Using Functional Regression Analysis. SAE Tech-
nical Paper 2000-01-2175.
Fisher, N. and T. Lewis (1985). A Note on Spherical Splines. Journal of the Royal Statistical
Society, Series B(Methodological), Vol. 47, 482-488.
Goldstein, H. (1980). Classical Mechanics. Addison-Wesley, Reading, Mass.
Grassia, F. (1998). Practical Parameterization of Rotations Using the Exponential Map. The
Journal of Graphics Tools, Vol. 3.3.
Gupta, A. and D. Nagar (2000). Matrix Variate Distributions. Chapman and Hall.
Hamilton, W. (1866). Elements of Quaternions. Longmans Green & Co, London.
Herda, L., R. Urtasun, P. Fua, and A. Hanson (2002). Automatic Determination of Shoulder Joint
Limits using Quaternion Field Boundaries. Proceedings of the 5th International Conference on
Automatic Face and Gesture Recognition, IEEE Computer Society, 95-100.
Johnson, R. and D. Wichern (2002). Applied Multivariate Statistical Analysis. Prentice Hall,
New Jersey.
Jupp, P. and J. Kent (1987). Fitting Smooth Paths to Spherical Data. Applied Statistics, 36,
34-46.
Jupp, P. and K. Mardia (1989). A Unified View of the Theory of Directional Statistics, 1975-
1988. International Statistical Review, 57, 3, 261-294.
105

Khatri, C. and K. Mardia (1977). The Von-Mises Fisher Distribution in Orientation Statistics.
Journal of the Royal Statistical Society, Series B(Methodological), Vol. 39, 95-106.
Mardia, K. and P. Jupp (2000). Directional Statistics. John Wiley & Sons LTD.
Prentice, M. (1986). Orientation Statistics Without Parametric Assumptions. Journal of the
Royal Statistical Society. Series B(Methodological), Vol. 48, Issue 2, 214-222.
Prentice, M. (1987). Fitting Smooth Paths to Rotation Data. Applied Statistics, Vol. 36, Issue
3, 325-331.
Prentice, M. (1989). Spherical Regression on Matched Pairs of Orientation Statistics. Journal of
the Royal Statistical Society. Series B (Methodological), Vol. 51, No. 2, 241-248.
Ramsay, J. and B. Silverman (1997). Functional Data Analysis. Springer, New York.
Rancourt, D., L. Rivest, and J. Asselin (2000). Using Orientation Statistics to Investigate Vari-
ations in Human Kinematics. Applied Statistics, 49, 81-94.
Rencher, A. (2002). Methods of Multivariate Analysis. Wiley $ Sons, New York.

Rivest, L. (2001). A Directional Model for the Statistical Analysis of Movement in Three Dimen-
sions. Biometrika, 88, 3, 779-791.
Scheffe, H. (1959). The Analysis of Variance. Wiley & Sons, New York.
Schlag, J. (1991). Using Geometric Construction to Interpolate Orientations with Quaternions.
Graphics Gems II, Academic Press, 377-380.
Shen, Q. and J. Faraway (2004). An F Test for Linear Models with Functional Responses.
Statistica Sinica, Vol. 14, 1239-1257.
Shoemake, K. (1985). Animating Rotation with Quaternion Curves. ACM SIGGRAPH, Vol. 19,
No. 3.
Shoemake, K. (1987). Quaternion Calculus and Fast Animation. ACM SIGGRAPH, Course
Notes on State of the Art Image Synthesis, 101-121.
Thompson, R. and R. Clark (1981). Fitting Polar Wander Paths. Physics of the Earth and
Planetary Interiors, 27, 1-7.
Wang, J. (2006). Statistical Modeling for 3-D Trajectories. PhD Thesis, Department of Statistics,
University of Michigan.
Wang, N. and A. Raftery (2002). Robust covariance estimation via nearest neighbor cleaning.
Journal of the American Statistical Association, 97, 994-1019.
Wang, W. and B. Joe (1993). Orientation Interpolation in Quaternion Space using Spherical
Biarcs. Proceedings of Graphics Interface, pg 24-32, Morgan Kauffman, San Francisco.
Watson, G. (1983). Statistics on Spheres. Wiley & Sons, New York.
Weisstein, E. (2006). mathworld.wolfram.com.
ABSTRACT

Statistical Analysis of Orientation Trajectories via Quaternions with Applications

to Human Motion

by

Su Bang Choe

Chair: Julian J. Faraway

The motion of an object in three-dimensional space can be described and mea-

sured in terms of its location and orientation. The purpose of the work presented

here is to develop statistical methods for modeling the orientation aspect of mo-

tion. The methods use the quaternion parameterization of orientation, the domain

of which is the four dimensional unit hypersphere. This advantages provided by this

parameterization are that it is compact, interpretable and free from coordinate sin-

gularities. The focus is on applying our methods to human motion analysis where

we seek to predict the orientation trajectory of a body segment during a motion task

using covariates such as anthropometry and location and orientation of the body

segment at the start and end of the motion.

There are two approaches to analyzing quaternion data: a tangent mapping ap-

proach that uses the exponential and logarithm maps to approximately linearize
1

the quaternion space and a constraint approach in which we treat the quaternion

space as a constrained subspace of IR4 . Using the former approach, a quaternion

functional regression technique for modeling orientation trajectories is developed.

Existing regression techniques for orientation data had been limited to modeling a

single frame response with a single orientation covariate. This model allows us to re-

late a quaternion functional response with scalar predictors. A plausible probability

distribution for our tangent mapped quaternions is presented along with a quick and

simple method for estimating a joint range of motion limit from existing data. We

also introduce the concept of slerp residuals that provide a way of reducing the error

inherent in the tangent mapping process. Finally, using the constraint approach, we

develop a quaternion ANOVA model (QANOVA) and its functional extension for

making inference decisions about the effect of factor covariates on orientation data.

We illustrate our methodology using experimental data obtained from the HU-

MOSIM laboratory at the University of Michigan. Using this data we analyze and

develop a prediction model for the orientation trajectory of the right hand during un-

laden reach motions. Given the initial and final orientation we use a speed adjusted

spherical linear interpolation, or slerp, to predict the orientation trajectory path be-

tween them. Our functional regression model shows that deviations from this slerp

trajectory cannot be sufficiently explained by anthropometry or target information.

View publication stats

You might also like