Tools for Working with Rotation Data

Tools for working with rotational data, including simulation from the most commonly used distributions on SO(3), methods for different Bayes, mean and median type estimators for the central orientation of a sample, confidence/credible regions for the central orientation based on those estimators and a novel visualization technique for rotation data. Most recently, functions to identify potentially discordant (outlying) values have been added.


rotations version 1.4

*The Maxwell-Boltzmann distribution function has been added.

  • Vignette has been updated
  • For kappa>200, the matrix-Fisher distribution is extremely difficult to sample from. In previous versions of this package, the matrix-Fisher distribution was replaced by the Cayley distribution for large kappa. Now the Maxwell-Boltzmann distribution is used because it agrees much more closely with the matrix-Fisher distribution than with the Cayley distribution for large kappa.

rotations version 1.3

  • The function discord has been added, which computes a measure of discord for random rotations
  • The previously proposed extrinsic measure of discord is included as well as the novel intrinsic measure
  • Vignette has been updated
  • tail.Q4 and tail.SO3 have been added

rotations version 1.2

  • Proposal central orientation parameter values are now drawn from the distribution specified by the type argument in all of the Bayesian functions
  • Sampling from the von Mises Fisher and matrix Fisher distributions is now done in C++ resulting in a significant speed up
  • method argument in regions function was changed from trans to transformation, a call to match.arg() still allows for trans
  • type argument in regions function has been changed from theory to asymptotic
  • A typo in the (not run) Bayes credible region example has been fixed
  • print method for Q4 objects now respects the digits option

rotations version 1.1

  • The argument interactive' has been added toplot.SO3' and plot.Q4' which, when set toTRUE', creates a sphere in 3D using `rgl' that can be manipulated by the user
  • The options for the method argument of the region functions have been changed to "trans" and "direct" to align with the current names in my dissertation. "trans" is short for "transformation," which is used to access the methods based on a transformation of a directional statistics result while "direct" is used for the methods that rely on theory for SO(3) directly.

rotations version 1.0

  • Vignette added that introduces the package

  • Create a plot.Q4 function that uses plot.SO3 after casting the object to class SO3

  • Updated Bayes sampling method to avoid seg faults
  • The functions SO3 and Q4 have been deprecated. All of their functionality has been moved to as.SO3 and as.Q4

  • angle and axis have been renamed mis.angle and mis.axis, respectively, to avoid naming clashes with the graphics package

  • The period.sep naming convention has been adopted for all functions in package. The functions formerly known as sum_dist, exp_skew, cayley_kappa, fisher_kappa and vmises_kappa are now called rotdist.sum, skew.exp, cayley.kappa, fisher.kappa and vmises.kappa, respectively.

  • dist renamed to rot.dist to avoid clashes with stats package

  • Fixes in documentation for Bayes point estimation

  • print.Q4 and print.SO3 no longer print the object class

  • print.SO3 now names the columns R11 through R33 to signify which element in the matrix each row corresponds to

  • is.SO3 more rigorously tests for conditions of SO3

  • Arithmetic for SO3 objects now is possible for samples of rotations

rotations version 0.2

  • Multiple columns can be supplied to col in plot via grid.arrange. Each requested column is identified by its axis and one legend is printed when applicable. For example col=c(1,3) will print two labelled eyeballs, one for the x- and one for the z-axis.

  • Quaternions are only unique up to their sign, that is if q is a quaternion the q=-q. So == has be redefined such that q==-q will return TRUE.

  • In 'dist' the 'method' argument now accepts the option 'extrinsic' and returns the same result had the 'projected' option been used.

  • The '[' operator has been redefined to maintain the SO3 or Q4 class of the object.

  • Addition + and subtraction - have been redefined for the multiplicative group SO(3). That is, for R1 and R2 in SO(3), R1+R2=R2R1, R1-R2=R2'R1 and -R1=R1'. Similarly for quaternions.

  • The head and str functions have been modified to properly handle objects of class 'SO3' and 'Q4'.

  • Functions for Bayesian analysis

    • Each of the following functions requires the user to supply type, tuneS, tuneK, burnin and B. These arguments determine the transition probability form, tuning parameters for the central orientation, concentration parameter, burnin for the MCMC and total number of draws from the posterior, respectively. Currently only 'Cayley', 'Fisher' and 'Mises' are valid options for type. See the respective help files for more details.
    • The function MCMCSO3 implements a Gibbs-within-MCMC algorithm to get draws from the posterior distributions for the concentration parameter $S$ and concentration parameter $\kappa$. A list of four items is returned: S is a B-by-p matrix where each row corresponds to a draw from the posterior for the central orientation S, kappa is a vector of B draws from the posterior for the concentration parameter $\kappa$ and the transition probabilities for the central orientation and concentration are given by Saccept and Kaccept,respectively.
    • Bayesian point estimates for the central orientation and concentration parameter are given by bayes.mean.
    • Bayesian credible regions have been added to the region by setting method='Bayes'.

rotations version 0.1

  • First CRAN release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.5 by Bryan Stanfill, 2 years ago

Report a bug at

Browse source code at

Authors: Bryan Stanfill <>, Heike Hofmann <>, Ulrike Genschel <>

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports stats, utils, methods, sphereplot

Depends on ggplot2, Rcpp, rgl

Suggests gridExtra, knitr, onion, orientlib, testthat

Linking to Rcpp, RcppArmadillo

See at CRAN