Class Statlib

java.lang.Object
org.mbari.jcommons.math.Statlib

public class Statlib extends Object
Since:
2011-12-22
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    correlationCoefficient(double[] I, double[] R)
     
    static double
    crossCorrelation(double[] v1, double[] v2)
     
    static double[]
    deviationFromMean(double[] values)
     
    static double[]
    hist(double[] data, double[] centers, boolean inclusive)
    Bins elements into bins with specified centers
    static double[]
    histc(double[] data, double[] edges)
     
    static double
    mean(double[] values)
    Calculate the mean of an array of values
    static double
    median(double[] values)
     
    static double
    pearsonsCorrelation(double[] x, double[] y)
    Calculate Pearson's correlation coefficient.
    static double
    percentile(double[] values, double percent)
    Retrive the value at some percent.
    static double
    populationStandardDeviation(double[] values)
    Standard deviation is a statistical measure of spread or variability.The standard deviation is the root mean square (RMS) deviation of the values from their arithmetic mean.
    static double
    populationVariance(double[] values)
    Variance: the square of the standard deviation of the population.
    static double
    quartile(double[] values, double lowerPercent)
    Deprecated.
    Use percentile instead
    static double
    standardDeviation(double[] values)
    Standard deviation is a statistical measure of spread or variability.The standard deviation is the root mean square (RMS) deviation of the values from their arithmetic mean.
    static double
    variance(double[] values)
    Variance: the square of the standard deviation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Statlib

      public Statlib()
  • Method Details

    • correlationCoefficient

      public static double correlationCoefficient(double[] I, double[] R)
      Parameters:
      I -
      R -
      Returns:
    • crossCorrelation

      public static double crossCorrelation(double[] v1, double[] v2)
      Parameters:
      v1 -
      v2 -
      Returns:
    • deviationFromMean

      public static double[] deviationFromMean(double[] values)
      Parameters:
      values -
      Returns:
    • mean

      public static double mean(double[] values)
      Calculate the mean of an array of values
      Parameters:
      values - The values to calculate
      Returns:
      The mean of the values
    • median

      public static double median(double[] values)
      Parameters:
      values -
      Returns:
    • pearsonsCorrelation

      public static double pearsonsCorrelation(double[] x, double[] y)
      Calculate Pearson's correlation coefficient. Stole the math from wikipedia, hope it's right ;-) This is also known as the Correlation Coefficient or the Pearson product-moment correlation coefficient
      Parameters:
      x -
      y -
      Returns:
    • populationStandardDeviation

      public static double populationStandardDeviation(double[] values)
      Standard deviation is a statistical measure of spread or variability.The standard deviation is the root mean square (RMS) deviation of the values from their arithmetic mean.

      populationStandardDeviation normalizes values by N, where N is the sample size. This the Population Standard Deviation

      Parameters:
      values -
      Returns:
    • populationVariance

      public static double populationVariance(double[] values)
      Variance: the square of the standard deviation of the population. A measure of the degree of spread among a set of values; a measure of the tendency of individual values to vary from the mean value. populationVariance uses populationStandardDeviation for the standard deviation calculation.
      Parameters:
      values -
      Returns:
    • quartile

      public static double quartile(double[] values, double lowerPercent)
      Deprecated.
      Use percentile instead
      Retrieve the quartile value from an array .
      Parameters:
      values - THe array of data
      lowerPercent - The percent cut off. For the lower quartile use 25, for the upper-quartile use 75
      Returns:
    • percentile

      public static double percentile(double[] values, double percent)
      Retrive the value at some percent. e.g. percentile(a, .5) = median(a)
      Parameters:
      values -
      percent - The percent cut off. For the lower quartile use 0.25, for the upper-quartile use 0.75
      Returns:
      The value the occurs at some percentile
    • standardDeviation

      public static double standardDeviation(double[] values)
      Standard deviation is a statistical measure of spread or variability.The standard deviation is the root mean square (RMS) deviation of the values from their arithmetic mean.

      standardDeviation normalizes values by (N-1), where N is the sample size. This is the sqrt of an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples.

      Parameters:
      values -
      Returns:
    • variance

      public static double variance(double[] values)
      Variance: the square of the standard deviation. A measure of the degree of spread among a set of values; a measure of the tendency of individual values to vary from the mean value.
      Parameters:
      values -
      Returns:
    • hist

      public static double[] hist(double[] data, double[] centers, boolean inclusive)
      Bins elements into bins with specified centers
      Parameters:
      data - The data to bin
      centers - The bins where each value represents a center of a bin. They MUST be ordered or the data will not be valid.
      inclusive -
      Returns:
    • histc

      public static double[] histc(double[] data, double[] edges)