esraMath
Class Statistics

java.lang.Object
  extended byesraMath.Statistics

public class Statistics
extends java.lang.Object

Author:
Vincent Kraeutler, Moritz Winger

Nested Class Summary
 class Statistics.Cluster
          litttle helper class for the clustering algorithm
 
Constructor Summary
Statistics()
           
 
Method Summary
static double average(double[] values)
           
static double[] bin(double[] values, double lower, double upper, int nBins)
           
static java.util.ArrayList cluster(double[][] matrix, double clusterCutoff, int clusterSizeCutoff)
          cluster analysis
static double[][][] gridDensities3D(double[] gridOrigin, double[] gridDimensions, int[] nGridPoints, double[][] points, double[] weights)
           
static double[] leastsquare(double[] x, double[] y)
          Linear Regression to set of {xi, yi} tuples.
static double max(double[] values)
           
static double min(double[] values)
           
static double[][] reweight(double[][] pos, double[] weights)
           
static double[][] rmsdMatrix(double[][][] trajectory)
          computes the rmsd matrix for a trajectory.
static double[][] smoothen(double[][] matrix, int size)
          reduce the size of a matrix by averaging over blocks.
static double stddev(double[] values, double average)
          A naive implementation for calculating a naive measure for the standard deviation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Method Detail

min

public static double min(double[] values)
Parameters:
values -
Returns:
the minimum value

max

public static double max(double[] values)
Parameters:
values -
Returns:
the maximum value

bin

public static double[] bin(double[] values,
                           double lower,
                           double upper,
                           int nBins)
Parameters:
values -
lower -
upper -
nBins -
Returns:
a distribution (with resolution nBins) of the values

average

public static double average(double[] values)
Parameters:
values -
Returns:
the average of values

stddev

public static double stddev(double[] values,
                            double average)

A naive implementation for calculating a naive measure for the standard deviation.

σx = (&Sigmai=1,..,N (xi - xa)2 / N)0.5

Parameters:
values -
average -
Returns:
the standard deviation

leastsquare

public static double[] leastsquare(double[] x,
                                   double[] y)
Linear Regression to set of {xi, yi} tuples.

Parameters:
x - array of x-values
y - array of y-values
Returns:
ab array[2] = {a, b} of slope (a) and intersect (b)

reweight

public static double[][] reweight(double[][] pos,
                                  double[] weights)
Parameters:
pos -
weights -
Returns:
the reweighted positions

smoothen

public static final double[][] smoothen(double[][] matrix,
                                        int size)
reduce the size of a matrix by averaging over blocks.

Parameters:
matrix - the input matrix
size - the size of the output matrix
Returns:
the smoothened matrix

rmsdMatrix

public static double[][] rmsdMatrix(double[][][] trajectory)
computes the rmsd matrix for a trajectory. assumes the centers of mass of all frames have already been shifted to the origin (i.e. no translational fit needed anymore).

Parameters:
trajectory -
Returns:
the rmsd matrix

cluster

public static java.util.ArrayList cluster(double[][] matrix,
                                          double clusterCutoff,
                                          int clusterSizeCutoff)
cluster analysis

Parameters:
matrix - the cluster matrix
clusterCutoff - if abs(matrix[ii][jj]) < clusterCutoff then ii and jj are neighbors.
clusterSizeCutoff - stop clustering once cluster sizes reach this number
Returns:
an ArrayList of clusters

gridDensities3D

public static double[][][] gridDensities3D(double[] gridOrigin,
                                           double[] gridDimensions,
                                           int[] nGridPoints,
                                           double[][] points,
                                           double[] weights)