C# Class Accord.Statistics.Circular

Set of statistics functions operating over a circular space.
This class represents collection of common functions used in statistics. The values are handled as belonging to a distribution defined over a circle, such as the Accord.Statistics.Distributions.Univariate.VonMisesDistribution.
Mostrar archivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
AngularDeviation ( double angles ) : double

Computes the Angular Deviation of the given angles.

AngularDeviation ( double samples, double length ) : double

Computes the circular angular deviation of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

AngularDeviation ( int samples, double cos, double sin ) : double

Computes the Angular Deviation of the given angles.

CentralMoments ( double angles, int order ) : Complex

Computes the complex circular central moments of the given circular angles.

Concentration ( double angles ) : double

Computes the concentration (kappa) of the given angles.

Concentration ( double angles, double mean ) : double

Computes the concentration (kappa) of the given angles.

Distance ( double x, double y ) : double

Computes the angular distance between two angles.

Distance ( double x, double y, double length ) : double

Computes the distance between two circular samples.

Distance ( double cosx, double sinx, double cosy, double siny ) : double

Computes the angular distance between two angles.

Kurtosis ( double angles ) : double

Computes the circular kurtosis of the given circular angles.

Mean ( double angles ) : double

Computes the Mean direction of the given angles.

Mean ( double samples, double length ) : double

Computes the circular Mean direction of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Mean ( int samples, double cos, double sin ) : double

Computes the Mean direction of the given angles.

Median ( double angles ) : double

Computes the circular Median direction of the given angles.

Median ( double samples, double length ) : double

Computes the circular Median of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

NoncentralMoments ( double angles, int order ) : Complex

Computes the complex circular non-central moments of the given circular angles.

Quartiles ( double angles, DoubleRange &range, bool wrap = true ) : double

Computes the circular quartiles of the given circular angles.

Quartiles ( double angles, DoubleRange &range, double median, bool wrap = true ) : double

Computes the circular quartiles of the given circular angles.

Quartiles ( double samples, double length, DoubleRange &range, bool wrap = true ) : double

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Quartiles ( double samples, double length, DoubleRange &range, double median, bool wrap = true ) : double

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Quartiles ( double angles, double &q1, double &q3, bool wrap = true ) : double

Computes the circular quartiles of the given circular angles.

Quartiles ( double samples, double length, double &q1, double &q3, bool wrap = true ) : double

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Quartiles ( double samples, double length, double &q1, double &q3, double median, bool wrap = true ) : double

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Resultant ( double angles ) : double

Computes the mean resultant vector length (r) of the given angles.

Resultant ( double samples, double length ) : double

Computes the resultant vector length (r) of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Resultant ( int samples, double cos, double sin ) : double

Computes the mean resultant vector length (r) of the given angles.

Skewness ( double angles ) : double

Computes the circular skewness of the given circular angles.

StandardDeviation ( double angles ) : double

Computes the Standard Deviation of the given angles.

StandardDeviation ( double samples, double length ) : double

Computes the circular standard deviation of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

StandardDeviation ( int samples, double cos, double sin ) : double

Computes the Standard Deviation of the given angles.

StandardError ( double angles, double alpha ) : double

Computes the standard error of the given angles.

StandardError ( double samples, double length, double alpha ) : double

Computes the circular standard error of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

StandardError ( int samples, double cos, double sin, double alpha ) : double

Computes the standard error of the given angles.

Sum ( double angles, double &cos, double &sin ) : void

Computes the sum of cosines and sines for the given angles.

ToCircular ( this angle, double length, bool wrap = true ) : double

Transforms angular data back into circular data (reverts the ToRadians(double[], double, bool) transformation.

ToRadians ( this sample, double length ) : double

Transforms circular data into angles (normalizes the data to be between -PI and PI).

ToRadians ( this samples, double length, bool inPlace = false ) : double[]

Transforms circular data into angles (normalizes the data to be between -PI and PI).

Variance ( double angles ) : double

Computes the Variance of the given angles.

Variance ( double samples, double length ) : double

Computes the circular variance of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.

Variance ( int samples, double cos, double sin ) : double

Computes the Variance of the given angles.

WeightedConcentration ( double angles, double weights ) : double

Computes the Weighted Concentration of the given angles.

WeightedConcentration ( double angles, double weights, double mean ) : double

Computes the Weighted Concentration of the given angles.

WeightedMean ( double angles, double weights ) : double

Computes the Weighted Mean of the given angles.

Private Methods

Method Description
estimateKappa ( double r ) : double

Computes the maximum likelihood estimate of kappa given by Best and Fisher (1981).

This method implements the approximation to the Maximum Likelihood Estimative of the kappa concentration parameter as suggested by Best and Fisher (1981), cited by Zheng Sun (2006) and Hussin and Mohamed (2008). Other useful approximations are given by Suvrit Sra (2009).

References: A.G. Hussin and I.B. Mohamed, 2008. Efficient Approximation for the von Mises Concentration Parameter. Asian Journal of Mathematics & Statistics, 1: 165-169. Suvrit Sra, "A short note on parameter approximation for von Mises-Fisher distributions: and a fast implementation of $I_s(x)$". (revision of Apr. 2009). Computational Statistics (2011). Available on: http://www.kyb.mpg.de/publications/attachments/vmfnote_7045%5B0%5D.pdf Zheng Sun. M.Sc. Comparing measures of fit for circular distributions. Master thesis, 2006. Available on: https://dspace.library.uvic.ca:8443/bitstream/handle/1828/2698/zhengsun_master_thesis.pdf

Method Details

AngularDeviation() public static method

Computes the Angular Deviation of the given angles.
public static AngularDeviation ( double angles ) : double
angles double A double array containing the angles in radians.
return double

AngularDeviation() public static method

Computes the circular angular deviation of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static AngularDeviation ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

AngularDeviation() public static method

Computes the Angular Deviation of the given angles.
public static AngularDeviation ( int samples, double cos, double sin ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
return double

CentralMoments() public static method

Computes the complex circular central moments of the given circular angles.
public static CentralMoments ( double angles, int order ) : Complex
angles double
order int
return Complex

Concentration() public static method

Computes the concentration (kappa) of the given angles.
public static Concentration ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Concentration() public static method

Computes the concentration (kappa) of the given angles.
public static Concentration ( double angles, double mean ) : double
angles double A double array containing the angles in radians.
mean double The mean of the angles, if already known.
return double

Distance() public static method

Computes the angular distance between two angles.
public static Distance ( double x, double y ) : double
x double The first angle.
y double The second angle.
return double

Distance() public static method

Computes the distance between two circular samples.
public static Distance ( double x, double y, double length ) : double
x double The first sample.
y double The second sample.
length double The maximum possible value of the samples.
return double

Distance() public static method

Computes the angular distance between two angles.
public static Distance ( double cosx, double sinx, double cosy, double siny ) : double
cosx double The cosine of the first sample.
sinx double The sin of the first sample.
cosy double The cosine of the second sample.
siny double The sin of the second sample.
return double

Kurtosis() public static method

Computes the circular kurtosis of the given circular angles.
public static Kurtosis ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Mean() public static method

Computes the Mean direction of the given angles.
public static Mean ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Mean() public static method

Computes the circular Mean direction of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Mean ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

Mean() public static method

Computes the Mean direction of the given angles.
public static Mean ( int samples, double cos, double sin ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
return double

Median() public static method

Computes the circular Median direction of the given angles.
public static Median ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Median() public static method

Computes the circular Median of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Median ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

NoncentralMoments() public static method

Computes the complex circular non-central moments of the given circular angles.
public static NoncentralMoments ( double angles, int order ) : Complex
angles double
order int
return Complex

Quartiles() public static method

Computes the circular quartiles of the given circular angles.
public static Quartiles ( double angles, DoubleRange &range, bool wrap = true ) : double
angles double A double array containing the angles in radians.
range AForge.DoubleRange The sample quartiles, as an out parameter.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular angles.
public static Quartiles ( double angles, DoubleRange &range, double median, bool wrap = true ) : double
angles double A double array containing the angles in radians.
range AForge.DoubleRange The sample quartiles, as an out parameter.
median double The angular median, if already known.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Quartiles ( double samples, double length, DoubleRange &range, bool wrap = true ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
range AForge.DoubleRange The sample quartiles, as an out parameter.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Quartiles ( double samples, double length, DoubleRange &range, double median, bool wrap = true ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
range AForge.DoubleRange The sample quartiles, as an out parameter.
median double The median value of the , if already known.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular angles.
public static Quartiles ( double angles, double &q1, double &q3, bool wrap = true ) : double
angles double A double array containing the angles in radians.
q1 double The first quartile, as an out parameter.
q3 double The third quartile, as an out parameter.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Quartiles ( double samples, double length, double &q1, double &q3, bool wrap = true ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
q1 double The first quartile, as an out parameter.
q3 double The third quartile, as an out parameter.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Quartiles() public static method

Computes the circular quartiles of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Quartiles ( double samples, double length, double &q1, double &q3, double median, bool wrap = true ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
q1 double The first quartile, as an out parameter.
q3 double The third quartile, as an out parameter.
median double The median value of the , if already known.
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

Resultant() public static method

Computes the mean resultant vector length (r) of the given angles.
public static Resultant ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Resultant() public static method

Computes the resultant vector length (r) of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Resultant ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

Resultant() public static method

Computes the mean resultant vector length (r) of the given angles.
public static Resultant ( int samples, double cos, double sin ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
return double

Skewness() public static method

Computes the circular skewness of the given circular angles.
public static Skewness ( double angles ) : double
angles double A double array containing the angles in radians.
return double

StandardDeviation() public static method

Computes the Standard Deviation of the given angles.
public static StandardDeviation ( double angles ) : double
angles double A double array containing the angles in radians.
return double

StandardDeviation() public static method

Computes the circular standard deviation of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static StandardDeviation ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

StandardDeviation() public static method

Computes the Standard Deviation of the given angles.
public static StandardDeviation ( int samples, double cos, double sin ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
return double

StandardError() public static method

Computes the standard error of the given angles.
public static StandardError ( double angles, double alpha ) : double
angles double A double array containing the angles in radians.
alpha double The confidence level. Default is 0.05.
return double

StandardError() public static method

Computes the circular standard error of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static StandardError ( double samples, double length, double alpha ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
alpha double The confidence level. Default is 0.05.
return double

StandardError() public static method

Computes the standard error of the given angles.
public static StandardError ( int samples, double cos, double sin, double alpha ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
alpha double The confidence level. Default is 0.05.
return double

Sum() public static method

Computes the sum of cosines and sines for the given angles.
public static Sum ( double angles, double &cos, double &sin ) : void
angles double A double array containing the angles in radians.
cos double The sum of cosines, returned as an out parameter.
sin double The sum of sines, returned as an out parameter.
return void

ToCircular() public static method

Transforms angular data back into circular data (reverts the ToRadians(double[], double, bool) transformation.
public static ToCircular ( this angle, double length, bool wrap = true ) : double
angle this The angle to be reconverted into the original unit.
length double The maximum possible sample value (such as 24 for hour data).
wrap bool /// Whether range values should be wrapped to be contained in the circle. If /// set to false, range values could be returned outside the [+pi;-pi] range. ///
return double

ToRadians() public static method

Transforms circular data into angles (normalizes the data to be between -PI and PI).
public static ToRadians ( this sample, double length ) : double
sample this The sample to be transformed.
length double The maximum possible sample value (such as 24 for hour data).
return double

ToRadians() public static method

Transforms circular data into angles (normalizes the data to be between -PI and PI).
public static ToRadians ( this samples, double length, bool inPlace = false ) : double[]
samples this The samples to be transformed.
length double The maximum possible sample value (such as 24 for hour data).
inPlace bool Whether to perform the transformation in place.
return double[]

Variance() public static method

Computes the Variance of the given angles.
public static Variance ( double angles ) : double
angles double A double array containing the angles in radians.
return double

Variance() public static method

Computes the circular variance of the given circular samples. The minimum possible value for a sample must be zero and the maximum must be indicated in the parameter length.
public static Variance ( double samples, double length ) : double
samples double A double array containing the circular samples.
length double The maximum possible value of the samples.
return double

Variance() public static method

Computes the Variance of the given angles.
public static Variance ( int samples, double cos, double sin ) : double
samples int The number of samples.
cos double The sum of the cosines of the samples.
sin double The sum of the sines of the samples.
return double

WeightedConcentration() public static method

Computes the Weighted Concentration of the given angles.
public static WeightedConcentration ( double angles, double weights ) : double
angles double A double array containing the angles in radians.
weights double An unit vector containing the importance of each angle /// in . The sum of this array elements should add up to 1.
return double

WeightedConcentration() public static method

Computes the Weighted Concentration of the given angles.
public static WeightedConcentration ( double angles, double weights, double mean ) : double
angles double A double array containing the angles in radians.
weights double An unit vector containing the importance of each angle /// in . The sum of this array elements should add up to 1.
mean double The mean of the angles, if already known.
return double

WeightedMean() public static method

Computes the Weighted Mean of the given angles.
public static WeightedMean ( double angles, double weights ) : double
angles double A double array containing the angles in radians.
weights double An unit vector containing the importance of each angle /// in . The sum of this array elements should add up to 1.
return double