Learn R Programming

rotations (version 0.1)

gradient.search: Gradient optimization for rotation data

Description

Gradient based optimization for user defined central orientation of a rotation sample.

Usage

gradient.search(sample, error, minerr = 1e-05,
    start = mean(sample), theta = NULL)

Arguments

sample
sample of rotations.
error
user defined function to observed distance between sample and estimate, has to have parameters for the sample and the estimate.
minerr
minimal distance to consider for convergence.
start
starting value for the estimation.
theta
size of the grid considered.

Value

  • list of
    • Shat estimate of the main direction
    • iter number of iterations necessary for convergence
    • theta final size of the grid
    • minerr error used for convergence
    • error numeric value of total sample's distance from main direction

Examples

Run this code
# minimize L1 norm:
L1.error <- function(sample, Shat) {
  sum(dist(sample, Shat, method="intrinsic", p=1))
}

cayley.sample <- ruars(n = 10, rangle = rcayley, nu = 1, space = 'SO3')
SL1 <- gradient.search(cayley.sample, L1.error, start=id.SO3)
# visually no perceptible difference between median estimates 
# from in-built function and gradient based search 
# (for almost all starting values)
plot(cayley.sample, center=SL1$Shat, show_estimates="all")

Run the code above in your browser using DataLab