jhplot.math
Class StatisticSample
- java.lang.Object
-
- jhplot.math.StatisticSample
-
public class StatisticSample extends java.lang.Object
A package to create random 1D and 2D arrays.
-
-
Constructor Summary
Constructors Constructor and Description StatisticSample()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static double[][]
correlation(double[][] v)
Correlationstatic double[][]
correlation(double[][] v1, double[][] v2)
Correlation coefficient, covariance(v1, v2) / Math.sqrt(variance(v1) * variance(v2)static double
correlation(double[] v1, double[] v2)
Correlation coefficient, covariance(v1, v2) / Math.sqrt(variance(v1) * variance(v2)static double[][]
covariance(double[][] v)
Covariancestatic double[][]
covariance(double[][] v1, double[][] v2)
Covariancestatic double
covariance(double[] v1, double[] v2)
Covariancestatic double
mean(double[] v)
Get mean valuestatic double[]
mean(double[][] v)
Get meanstatic double[]
randomBeta(int m, double a, double b)
1D Random Beta distributionstatic double[][]
randomBeta(int m, int n, double a, double b)
Random beata distributionstatic double[]
randomCauchy(int m, double mu, double sigma)
1D Cauchy PDFstatic double[][]
randomCauchy(int m, int n, double mu, double sigma)
2D Cauchy PDFstatic double[]
randomChi2(int m, int d)
1D array with random numbersstatic double[][]
randomChi2(int m, int n, int d)
2D array with Chi2static double[]
randomDirac(int m, double[] values, double[] prob)
1D array with Dirac random valuesstatic double[][]
randomDirac(int m, int n, double[] values, double[] prob)
2D array with Dirac random valuesdouble[][]
randomDoubleArray(int rows, int columns, AbstractDistribution dist)
Build 2D integer array list with integer numbers from input random number generatorDoubleArrayList
randomDoubleArrayList(int Ntot, AbstractDistribution dist)
Build double array list with integer numbers from input random number generatorstatic double[]
randomExponential(int m, double lambda)
1D array with exponential numbersstatic double[][]
randomExponential(int m, int n, double lambda)
2D array with exponential random distributionstatic int[]
randomInt(int m, int i0, int i1)
Random array with integersstatic int[][]
randomInt(int m, int n, int i0, int i1)
Random 2D array with integersint[]
randomIntArray(int Ntot, Binomial dist)
Build integer array list with integer numbers from input random number generatorint[][]
randomIntArray(int rows, int columns, AbstractDistribution dist)
Build 2D integer array list with integer numbers from input random number generatorIntArrayList
randomIntArrayList(int Ntot, AbstractDistribution dist)
Build integer array list with integer numbers from input random number generatorstatic double[]
randomLogNormal(int m, double mu, double sigma)
1D array with random Log-normal valuesstatic double[][]
randomLogNormal(int m, int n, double mu, double sigma)
2D Log-normal distributionstatic double[]
randomNormal(int m, double mu, double sigma)
1D array with Gaussian numbersstatic double[][]
randomNormal(int m, int n, double mu, double sigma)
2D array with Gaussian numbersstatic int[]
randomPoisson(int m, double mean)
Build an array with Poisson distributionstatic double[]
randomRejection(int m, Expression fun, double maxFun, double min, double max)
Build 1D array using analytic function.static double[][]
randomRejection(int m, int n, Expression fun, double maxFun, double min, double max)
Build 2D random array using analytic function.static double[]
randomTriangular(int m, double min, double max)
1D array with Triangular random PDFstatic double[]
randomTriangular(int m, double min, double med, double max)
1D array for Triangularstatic double[][]
randomTriangular(int m, int n, double min, double max)
2D array for Triangular random PDFstatic double[][]
randomTriangular(int m, int n, double min, double med, double max)
2D array for Triangularstatic double[]
randomWeibull(int m, double lambda, double c)
1D Weibullstatic double[][]
randomWeibull(int m, int n, double lambda, double c)
2D Weibullstatic double[]
randUniform(int m, double min, double max)
2D array with uniform valuesstatic double[][]
randUniform(int m, int n, double min, double max)
2D array with random uniform valuesstatic double
stddeviation(double[] v)
Standard deviationstatic double[]
stddeviation(double[][] v)
Standard deviationstatic double
variance(double[] v)
Variancestatic double[]
variance(double[][] v)
Variance
-
-
-
Method Detail
-
randomInt
public static int[][] randomInt(int m, int n, int i0, int i1)
Random 2D array with integers- Parameters:
m
- Rowsn
- Columnsi0
- Min valuei1
- max value- Returns:
- 2D array
-
randomInt
public static int[] randomInt(int m, int i0, int i1)
Random array with integers- Parameters:
m
- array sizei0
- min valuei1
- max value- Returns:
- array
-
randUniform
public static double[] randUniform(int m, double min, double max)
2D array with uniform values- Parameters:
m
- Total numbermin
- Min valuemax
- Max value- Returns:
- array
-
randUniform
public static double[][] randUniform(int m, int n, double min, double max)
2D array with random uniform values- Parameters:
m
- Rowsn
- Columnsmin
- Min valuemax
- Max value- Returns:
- array
-
randomDirac
public static double[][] randomDirac(int m, int n, double[] values, double[] prob)
2D array with Dirac random values- Parameters:
m
- Rowsn
- Columnsvalues
- Values for functionprob
- Probabilities- Returns:
- array
-
randomDirac
public static double[] randomDirac(int m, double[] values, double[] prob)
1D array with Dirac random values- Parameters:
m
- Total numbervalues
- array with values for the functionprob
- probability- Returns:
- array
-
randomPoisson
public static int[] randomPoisson(int m, double mean)
Build an array with Poisson distribution- Parameters:
mean
- mean of Poisson distribution
-
randomNormal
public static double[][] randomNormal(int m, int n, double mu, double sigma)
2D array with Gaussian numbers- Parameters:
m
- Rowsn
- Columnsmu
- meansigma
- standard deviation- Returns:
- array
-
randomNormal
public static double[] randomNormal(int m, double mu, double sigma)
1D array with Gaussian numbers- Parameters:
m
- Total numbermu
- meansigma
- standard deviation- Returns:
- array
-
randomChi2
public static double[][] randomChi2(int m, int n, int d)
2D array with Chi2- Parameters:
m
- Rowsn
- Columnsd
- degrees of freedom- Returns:
- array
-
randomChi2
public static double[] randomChi2(int m, int d)
1D array with random numbers- Parameters:
m
- Total numberd
- degree of freedoms- Returns:
- array
-
randomLogNormal
public static double[][] randomLogNormal(int m, int n, double mu, double sigma)
2D Log-normal distribution- Parameters:
m
- Rowsn
- Columnsmu
- meansigma
- sigma- Returns:
- array
-
randomLogNormal
public static double[] randomLogNormal(int m, double mu, double sigma)
1D array with random Log-normal values- Parameters:
m
- total numbermu
- meansigma
- sigma- Returns:
- array
-
randomExponential
public static double[][] randomExponential(int m, int n, double lambda)
2D array with exponential random distribution- Parameters:
m
- Rowsn
- Columslambda
- lambda- Returns:
- array
-
randomExponential
public static double[] randomExponential(int m, double lambda)
1D array with exponential numbers- Parameters:
m
- total numberslambda
- lambda- Returns:
- array
-
randomTriangular
public static double[][] randomTriangular(int m, int n, double min, double max)
2D array for Triangular random PDF- Parameters:
m
- Rowsn
- Columnsmin
- Minmax
- max- Returns:
- array
-
randomTriangular
public static double[] randomTriangular(int m, double min, double max)
1D array with Triangular random PDF- Parameters:
m
- total numbermin
- Minmax
- max- Returns:
- array
-
randomTriangular
public static double[][] randomTriangular(int m, int n, double min, double med, double max)
2D array for Triangular- Parameters:
m
- Rowsn
- Columnsmin
- Minmed
- Medianmax
- Max- Returns:
- array
-
randomTriangular
public static double[] randomTriangular(int m, double min, double med, double max)
1D array for Triangular- Parameters:
m
- total numbermin
- Minmed
- Medianmax
- Max- Returns:
- array
-
randomBeta
public static double[][] randomBeta(int m, int n, double a, double b)
Random beata distribution- Parameters:
m
- Rowsn
- Columnsa
- alphab
- beta- Returns:
- array
-
randomBeta
public static double[] randomBeta(int m, double a, double b)
1D Random Beta distribution- Parameters:
m
- total numbera
- alphab
- beta- Returns:
- array
-
randomCauchy
public static double[][] randomCauchy(int m, int n, double mu, double sigma)
2D Cauchy PDF- Parameters:
m
- Rowsn
- Columsmu
- Meansigma
- Sigma- Returns:
- array
-
randomCauchy
public static double[] randomCauchy(int m, double mu, double sigma)
1D Cauchy PDF- Parameters:
m
- total numbermu
- meansigma
- sigma- Returns:
-
randomWeibull
public static double[][] randomWeibull(int m, int n, double lambda, double c)
2D Weibull- Parameters:
m
- Rowsn
- Columnslambda
- lambdac
- C- Returns:
- array
-
randomWeibull
public static double[] randomWeibull(int m, double lambda, double c)
1D Weibull- Parameters:
m
- Rowslambda
- lambdac
- C- Returns:
- array
-
randomRejection
public static double[][] randomRejection(int m, int n, Expression fun, double maxFun, double min, double max)
Build 2D random array using analytic function. First build F1D, than get parse (getParse()) and use it as input for this method.- Parameters:
m
- Number of pointsfun
- ParseFunction (get it as getParse() for F1D)maxFun
- max of the functionmin
- Min value in Xmax
- Max value in X
-
randomRejection
public static double[] randomRejection(int m, Expression fun, double maxFun, double min, double max)
Build 1D array using analytic function. First build F1D, than get parse (getParse()) and use it as input for this method.- Parameters:
m
- Number of pointsfun
- ParseFunction (get it as getParse() for F1D)maxFun
- max of the functionmin
- Min value in Xmax
- Max value in X
-
mean
public static double mean(double[] v)
Get mean value- Parameters:
v
- vector
-
mean
public static double[] mean(double[][] v)
Get mean- Parameters:
v
- 2D array- Returns:
-
stddeviation
public static double stddeviation(double[] v)
Standard deviation- Parameters:
v
- vector- Returns:
-
variance
public static double variance(double[] v)
Variance- Parameters:
v
-- Returns:
- vector
-
stddeviation
public static double[] stddeviation(double[][] v)
Standard deviation- Parameters:
v
-- Returns:
-
variance
public static double[] variance(double[][] v)
Variance- Parameters:
v
- vector- Returns:
-
covariance
public static double covariance(double[] v1, double[] v2)
Covariance- Parameters:
v1
- first vectorv2
- second vector- Returns:
-
covariance
public static double[][] covariance(double[][] v1, double[][] v2)
Covariance- Parameters:
v1
- first 2D arrayv2
- second 2D array- Returns:
-
covariance
public static double[][] covariance(double[][] v)
Covariance- Parameters:
v
-- Returns:
-
correlation
public static double correlation(double[] v1, double[] v2)
Correlation coefficient, covariance(v1, v2) / Math.sqrt(variance(v1) * variance(v2)- Parameters:
v1
- first vectorv2
- second vector- Returns:
-
correlation
public static double[][] correlation(double[][] v1, double[][] v2)
Correlation coefficient, covariance(v1, v2) / Math.sqrt(variance(v1) * variance(v2)- Parameters:
v1
- first vectorv2
- second vector- Returns:
-
correlation
public static double[][] correlation(double[][] v)
Correlation- Parameters:
v
-- Returns:
-
randomIntArrayList
public IntArrayList randomIntArrayList(int Ntot, AbstractDistribution dist)
Build integer array list with integer numbers from input random number generator- Parameters:
Ntot
- total numbersdist
- input random number distribution- Returns:
- array
-
randomIntArray
public int[] randomIntArray(int Ntot, Binomial dist)
Build integer array list with integer numbers from input random number generator- Parameters:
Ntot
- total numbersdist
- input random number distribution- Returns:
- array
-
randomIntArray
public int[][] randomIntArray(int rows, int columns, AbstractDistribution dist)
Build 2D integer array list with integer numbers from input random number generator- Parameters:
rows
- rowscolums
- columnsdist
- input random number distribution- Returns:
- array
-
randomDoubleArray
public double[][] randomDoubleArray(int rows, int columns, AbstractDistribution dist)
Build 2D integer array list with integer numbers from input random number generator- Parameters:
rows
- rowscolums
- columnsdist
- input random number distribution- Returns:
- array
-
randomDoubleArrayList
public DoubleArrayList randomDoubleArrayList(int Ntot, AbstractDistribution dist)
Build double array list with integer numbers from input random number generator- Parameters:
Ntot
-dist
-- Returns:
- array
-
-
DMelt 3.0 © DataMelt by jWork.ORG