public class StatUtils extends Object
Constructor and Description |
---|
StatUtils() |
Modifier and Type | Method and Description |
---|---|
static double[] |
autocorr(double[] data,
int maxk)
Computes autocorrelation up to maxk for the time series data.
|
static double[] |
autoCorrelate(double[] signal,
int windowlength,
int windowshift)
This static class does the autocorrelation for the given float vector.
|
static double[] |
autocov(double[] data,
int maxk)
Computes autocovariance up to maxk for the time series data.
|
static double |
avg(double[] v)
Compute average of all values in vector v.
|
static double |
correl(double[] a,
double[] b)
Compute the correlation of a vector with another vector b.
|
static double[] |
crossCorrelation(double[] x,
double[] y,
int N,
int startLag,
int endLag)
Return a new array that is the cross-correlation of the two argument
arrays, starting and ending at user-specified lag values.
|
static double |
crossCorrelationAt(double[] x,
double[] y,
int N,
int lag)
Return the cross-correlation of two arrays at a certain lag value.
|
static double[] |
randomBernoulli(double p,
int N)
Return a new array of Bernoulli random variables with a given probability
of success p.
|
static double[] |
randomExponential(double lambda,
int N)
Return a new array of exponentially distributed doubles with parameter
lambda.
|
static double[] |
randomGaussian(double mean,
double standardDeviation,
int N)
Return a new array of Gaussian distributed doubles with a given mean and
standard deviation.
|
static double[] |
randomPoisson(double mean,
int N)
Return a new array of Poisson random variables (as doubles) with a given
mean.
|
static double[] |
randomUniform(double a,
double b,
int N)
Return a new array of uniformly distributed doubles ranging from a to b.
|
static float[] |
residuals(float[] a,
float[] b)
Compute residuals of b versus a.
|
static double |
stdev(double[] v)
Compute stdev (SQRT(var)) of all values in vector v.
|
static double |
sum(double[] v)
Compute average of all values in vector v.
|
static double |
sum(float[] v)
sum(1) computes summation of all values in vector v.
|
static double |
sum(float[][] m)
sum(1) computes summation of all values in matrix m.
|
static double |
sum(float[] v,
float[] mask)
sum(2) computes the sum of the elements of vector v only where the mask
value is not 0.
|
static double |
var(double[] v)
Compute variance of all elements in vector v.
|
static double[] |
zeromean(double[] v)
Zero the mean of all elements of v.
|
public static double[] autoCorrelate(double[] signal, int windowlength, int windowshift)
float[]
- signal - the signal vector.int
- windowlength - the length of correlation build with the
summaration loop. Corresponds to lag-maxint
- windowshift - the length of the summaration lopp. Corresponds
to Npublic static double avg(double[] v)
v
- a vector of float[]public static double sum(float[] v)
v
- a vector of float[]public static double sum(float[][] m)
v
- a vector of float[]public static double sum(float[] v, float[] mask)
v
- a float[] vector.mask
- a float[] with a value of ! 0 for all elements of v that are
valid.public static double sum(double[] v)
v
- a vector of float[]public static double stdev(double[] v)
v
- a vector of float[]public static double correl(double[] a, double[] b)
a
- a float[] vector.b
- a float[] vector of same length.public static double var(double[] v)
v
- a vector of float[]public static float[] residuals(float[] a, float[] b) throws IllegalArgumentException
a
- a float[] vectorb
- a float[] vector.IllegalArgumentException
public static double[] autocov(double[] data, int maxk)
public static double[] autocorr(double[] data, int maxk)
public static double[] zeromean(double[] v)
v
- a vector.public static final double[] crossCorrelation(double[] x, double[] y, int N, int startLag, int endLag)
x
- The first array of doubles.y
- The second array of doubles.N
- An integer indicating the number of samples to sum over.startLag
- An int indicating at which lag to start (may be negative).endLag
- An int indicating at which lag to end.public static double crossCorrelationAt(double[] x, double[] y, int N, int lag)
x
- The first array of doubles.y
- The second array of doubles.N
- An integer indicating the number of samples to sum over. This
must be non-negative, but large numbers are ok because this
routine will not overrun reading of the arrays.lag
- An integer indicating the lag value (may be negative).public static final double[] randomBernoulli(double p, int N)
p
- The probability, which should be a double between 0.0 and 1.0.
The probability is compared to the output of
java.lang.Random.nextDouble(). If the output is less than p,
then the array element will be 1.0. If the output is greater
than or equal to p, then the array element will be 0.0.N
- The number of elements to allocate.public static final double[] randomExponential(double lambda, int N)
lambda
- The lambda, which may not by 0.0.N
- The number of elements to allocate.public static final double[] randomGaussian(double mean, double standardDeviation, int N)
mean
- The mean of the new array.standardDeviation
- The standard deviation of the new array.N
- The number of elements to allocate.public static final double[] randomPoisson(double mean, int N)
mean
- The mean of the new array.N
- The number of elements to allocate.public static double[] randomUniform(double a, double b, int N)
a
- A double indicating the lower bound.b
- A double indicating the upper bound.N
- An int indicating how many elements to generate.Jas4pp 1.5 © Java Analysis Studio for Particle Physics