Circular mean

Last updated

In mathematics and statistics, a circular mean or angular mean is a mean designed for angles and similar cyclic quantities, such as times of day, and fractional parts of real numbers.

Contents

This is necessary since most of the usual means may not be appropriate on angle-like quantities. For example, the arithmetic mean of 0° and 360° is 180°, which is misleading because 360° equals 0° modulo a full cycle. [1] As another example, the "average time" between 11 PM and 1 AM is either midnight or noon, depending on whether the two times are part of a single night or part of a single calendar day.

The circular mean is one of the simplest examples of directional statistics and of statistics of non-Euclidean spaces. This computation produces a different result than the arithmetic mean, with the difference being greater when the angles are widely distributed. For example, the arithmetic mean of the three angles 0°, 0°, and 90° is (0° + 0° + 90°) / 3 = 30°, but the vector mean is arctan(1/2) = 26.565°. Moreover, with the arithmetic mean the circular variance is only defined ±180°.

Definition

Since the arithmetic mean is not always appropriate for angles, the following method can be used to obtain both a mean value and measure for the variance of the angles:

Convert all angles to corresponding points on the unit circle, e.g., to . That is, convert polar coordinates to Cartesian coordinates. Then compute the arithmetic mean of these points. The resulting point will lie within the unit disk but generally not on the unit circle. Convert that point back to polar coordinates. The angle is a reasonable mean of the input angles. The resulting radius will be 1 if all angles are equal. If the angles are uniformly distributed on the circle, then the resulting radius will be 0, and there is no circular mean. (In fact, it is impossible to define a continuous mean operation on the circle.) In other words, the radius measures the concentration of the angles.

Given the angles a common formula of the mean using the atan2 variant of the arctangent function is

Using complex arithmetic

An equivalent definition can be formulated using complex numbers:

.

In order to match the above derivation using arithmetic means of points, the sums would have to be divided by . However, the scaling does not matter for and , thus it can be omitted.

This may be more succinctly stated by realizing that directional data are in fact vectors of unit length. In the case of one-dimensional data, these data points can be represented conveniently as complex numbers of unit magnitude , where is the measured angle. The mean resultant vector for the sample is then:

The sample mean angle is then the argument of the mean resultant:

The length of the sample mean resultant vector is:

and will have a value between 0 and 1. Thus the sample mean resultant vector can be represented as:

Similar calculations are also used to define the circular variance.

Properties

The circular mean,

The distance is equal to half the squared Euclidean distance between the two points on the unit circle associated with and .

Example

A simple way to calculate the mean of a series of angles (in the interval [0°, 360°)) is to calculate the mean of the cosines and sines of each angle, and obtain the angle by calculating the inverse tangent. Consider the following three angles as an example: 10, 20, and 30 degrees. Intuitively, calculating the mean would involve adding these three angles together and dividing by 3, in this case indeed resulting in a correct mean angle of 20 degrees. By rotating this system anticlockwise through 15 degrees the three angles become 355 degrees, 5 degrees and 15 degrees. The arithmetic mean is now 125 degrees, which is the wrong answer, as it should be 5 degrees. The vector mean can be calculated in the following way, using the mean sine and the mean cosine :

Implementation

In this python code we use day hours to find circular average of them:

importmathdefcircular_mean(hours):# Convert hours to radians# What is the 15?! (24*15=360)radians=[math.radians(hour*15)forhourinhours]# Calculate the sum of sin and cos valuessin_sum=sum([math.sin(rad)forradinradians])cos_sum=sum([math.cos(rad)forradinradians])# Calculate the circular mean using arctan2mean_rad=math.atan2(sin_sum,cos_sum)# Convert the mean back to hoursmean_hour=(math.degrees(mean_rad)/15)%24returnmean_hour# Example usage:hours=[0,12,18]mean_hour=circular_mean(hours)print("First Circular mean:",round(mean_hour,2))hours=[0,12]mean_hour=circular_mean(hours)print("Second Circular mean:",round(mean_hour,2))hours=[0,0,12,12,24]mean_hour=circular_mean(hours)print("Third Circular mean:",round(mean_hour,2))

Generalizations

Spherical mean

A series of N independent unit vectors are drawn from a von Mises–Fisher distribution. The maximum likelihood estimates of the mean direction is simply the normalized arithmetic mean, a sufficient statistic: [2]

Weighted spherical mean

A weighted spherical mean can be defined based on spherical linear interpolation. [3]

See also

Related Research Articles

In geometry, a solid angle is a measure of the amount of the field of view from some particular point that a given object covers. That is, it is a measure of how large the object appears to an observer looking from that point. The point from which the object is viewed is called the apex of the solid angle, and the object is said to subtend its solid angle at that point.

In mechanics and geometry, the 3D rotation group, often denoted SO(3), is the group of all rotations about the origin of three-dimensional Euclidean space under the operation of composition.

<span class="mw-page-title-main">Inverse trigonometric functions</span> Inverse functions of the trigonometric functions

In mathematics, the inverse trigonometric functions are the inverse functions of the trigonometric functions. Specifically, they are the inverses of the sine, cosine, tangent, cotangent, secant, and cosecant functions, and are used to obtain an angle from any of the angle's trigonometric ratios. Inverse trigonometric functions are widely used in engineering, navigation, physics, and geometry.

In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation in Euclidean space. For example, using the convention below, the matrix

The solar zenith angle is the zenith angle of the sun, i.e., the angle between the sun’s rays and the vertical direction. It is the complement to the solar altitude or solar elevation, which is the altitude angle or elevation angle between the sun’s rays and a horizontal plane. At solar noon, the zenith angle is at a minimum and is equal to latitude minus solar declination angle. This is the basis by which ancient mariners navigated the oceans.

<span class="mw-page-title-main">Tangent half-angle formula</span> Relates the tangent of half of an angle to trigonometric functions of the entire angle

In trigonometry, tangent half-angle formulas relate the tangent of half of an angle to trigonometric functions of the entire angle. The tangent of half an angle is the stereographic projection of the circle onto a line. Among these formulas are the following:

<span class="mw-page-title-main">Directional statistics</span>

Directional statistics is the subdiscipline of statistics that deals with directions, axes or rotations in Rn. More generally, directional statistics deals with observations on compact Riemannian manifolds including the Stiefel manifold.

<span class="mw-page-title-main">Ptolemy's theorem</span> Relates the 4 sides and 2 diagonals of a quadrilateral with vertices on a common circle

In Euclidean geometry, Ptolemy's theorem is a relation between the four sides and two diagonals of a cyclic quadrilateral. The theorem is named after the Greek astronomer and mathematician Ptolemy. Ptolemy used the theorem as an aid to creating his table of chords, a trigonometric table that he applied to astronomy.

von Mises distribution Probability distribution on the circle

In probability theory and directional statistics, the von Mises distribution is a continuous probability distribution on the circle. It is a close approximation to the wrapped normal distribution, which is the circular analogue of the normal distribution. A freely diffusing angle on a circle is a wrapped normally distributed random variable with an unwrapped variance that grows linearly in time. On the other hand, the von Mises distribution is the stationary distribution of a drift and diffusion process on the circle in a harmonic potential, i.e. with a preferred orientation. The von Mises distribution is the maximum entropy distribution for circular data when the real and imaginary parts of the first circular moment are specified. The von Mises distribution is a special case of the von Mises–Fisher distribution on the N-dimensional sphere.

atan2 Arctangent function with two arguments

In computing and mathematics, the function atan2 is the 2-argument arctangent. By definition, is the angle measure between the positive -axis and the ray from the origin to the point in the Cartesian plane. Equivalently, is the argument of the complex number

<span class="mw-page-title-main">Pendulum (mechanics)</span> Free swinging suspended body

A pendulum is a body suspended from a fixed support so that it swings freely back and forth under the influence of gravity. When a pendulum is displaced sideways from its resting, equilibrium position, it is subject to a restoring force due to gravity that will accelerate it back toward the equilibrium position. When released, the restoring force acting on the pendulum's mass causes it to oscillate about the equilibrium position, swinging it back and forth. The mathematics of pendulums are in general quite complicated. Simplifying assumptions can be made, which in the case of a simple pendulum allow the equations of motion to be solved analytically for small-angle oscillations.

There are several equivalent ways for defining trigonometric functions, and the proof of the trigonometric identities between them depend on the chosen definition. The oldest and somehow the most elementary definition is based on the geometry of right triangles. The proofs given in this article use this definition, and thus apply to non-negative angles not greater than a right angle. For greater and negative angles, see Trigonometric functions.

<span class="mw-page-title-main">Biarc</span>

A biarc is a smooth curve formed from two circular arcs. In order to make the biarc smooth, the two arcs should have the same tangent at the connecting point where they meet.

<span class="mw-page-title-main">Limaçon trisectrix</span> Quartic plane curve

In geometry, a limaçon trisectrix is the name for the quartic plane curve that is a trisectrix that is specified as a limaçon. The shape of the limaçon trisectrix can be specified by other curves particularly as a rose, conchoid or epitrochoid. The curve is one among a number of plane curve trisectrixes that includes the Conchoid of Nicomedes, the Cycloid of Ceva, Quadratrix of Hippias, Trisectrix of Maclaurin, and Tschirnhausen cubic. The limaçon trisectrix a special case of a sectrix of Maclaurin.

Landen's transformation is a mapping of the parameters of an elliptic integral, useful for the efficient numerical evaluation of elliptic functions. It was originally due to John Landen and independently rediscovered by Carl Friedrich Gauss.

<span class="mw-page-title-main">Wrapped Cauchy distribution</span>

In probability theory and directional statistics, a wrapped Cauchy distribution is a wrapped probability distribution that results from the "wrapping" of the Cauchy distribution around the unit circle. The Cauchy distribution is sometimes known as a Lorentzian distribution, and the wrapped Cauchy distribution may sometimes be referred to as a wrapped Lorentzian distribution.

In probability theory and directional statistics, a circular uniform distribution is a probability distribution on the unit circle whose density is uniform for all angles.

In probability theory, the central limit theorem states conditions under which the average of a sufficiently large number of independent random variables, each with finite mean and variance, will be approximately normally distributed.

The trigonometry of a tetrahedron explains the relationships between the lengths and various types of angles of a general tetrahedron.

References

  1. Christopher M. Bishop: Pattern Recognition and Machine Learning (Information Science and Statistics), ISBN   0-387-31073-8
  2. Mardia, Kanti; Jupp, P. E. (1999). Directional Statistics. John Wiley & Sons Ltd. ISBN   978-0-471-95333-3.
  3. Buss, Samuel R.; Fillmore, Jay P. (2001). "Spherical averages and applications to spherical splines and interpolation". ACM Transactions on Graphics. Association for Computing Machinery (ACM). 20 (2): 95–126. doi:10.1145/502122.502124. ISSN   0730-0301.

Further reading