PamUtils

## Class BearingMean

• java.lang.Object
• PamUtils.BearingMean

• ```public class BearingMean
extends java.lang.Object```
Calculate the mean of a load of angles in degrees.

This is tricky, since the mean of 359 and 1 is 0, so the first thing to do is to try to find the centre of where most angles are, then we calculate all angles relative to that reference point, and finally, get the mean.

Strategy is to calculate a unit vector for each bearing, then take the mean vector. If all bearings cancel each other out, then the bearing returned will be NaN.

function has been put into a class like this so that it can go further and calculate the standard deviation as well should it feel like it.

Author:
Doug Gillespie.
• ### Constructor Summary

Constructors
Constructor and Description
`BearingMean(double[] bearings)`
• ### Method Summary

Methods
Modifier and Type Method and Description
`double` `getBearingMean()`
`double` `getBearingR()`
Magnitude of resultant vector r.
`double` `getBearingSTD()`
Get the standard deviation about the mean.
`double` `getBearingSTD2()`
The standard deviation of as defined by Zar (1999) sqrt(2*(1-R))
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### BearingMean

`public BearingMean(double[] bearings)`
• ### Method Detail

• #### getBearingMean

`public double getBearingMean()`
Returns:
the bearingMean
• #### getBearingSTD

`public double getBearingSTD()`
Get the standard deviation about the mean.
Returns:
the standard deviation about the mean.
• #### getBearingR

`public double getBearingR()`
Magnitude of resultant vector r. This quantity is used for calculating circular variance, circular standard deviation
Returns:
R - the magnitude of the resultant vector
• #### getBearingSTD2

`public double getBearingSTD2()`
The standard deviation of as defined by Zar (1999) sqrt(2*(1-R))
Returns:
Circular standard deviation