jdistlib.disttest
Class DistributionTest
- java.lang.Object
-
- jdistlib.disttest.DistributionTest
-
public class DistributionTest extends java.lang.ObjectComparing two distributions
-
-
Constructor Summary
Constructors Constructor and Description DistributionTest()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double[]ansari_bradley_test(double[] x, double[] y, boolean force_exact)Return the two-sided test of Ansari-Bradley.static double[]ansari_bradley_test(double[] x, double[] y, boolean force_exact, TestKind kind)Ansari-Bradley test.static double[]bartlett_test(double[] x, int[] group)Bartlett's teststatic double[]binomial_test(int n_success, int n, double p, TestKind kind)Binomial teststatic double[]diptest_presorted(double[] x)Perform Hartigan's dip test, assuming the minimum test statistics D is zero.static double[]diptest(double[] x)Perform Hartigan's dip test, assuming the minimum test statistics D is zero.static double[]fligner_test(double[] x, int[] group)Fligner-Killeen teststatic double[]kolmogorov_smirnov_test(double[] X, double[] Y)Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided, exact p-value.static double[]kolmogorov_smirnov_test(double[] X, double[] Y, boolean isExact)Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided.static double[]kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind)Compute the Kolmogorov-Smirnov test to test between two distribution, exact p-value.static double[]kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind, boolean isExact)Compute the Kolmogorov-Smirnov test to test between two distribution.static double[]kolmogorov_smirnov_test(double[] X, GenericDistribution dist)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided, exact p-value.static double[]kolmogorov_smirnov_test(double[] X, GenericDistribution dist, boolean isExact)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided.static double[]kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, exact p-value.static double[]kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind, boolean isExact)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution.static double[]kruskal_wallis_test(double[] x, int[] group)Kruskal-Wallis teststatic voidmain(java.lang.String[] args)static double[]mann_whitney_u_test(double[] x, double[] y, double mu, boolean correction, boolean paired, TestKind kind)Mann-Whitney-U teststatic double[]mood_test(double[] x, double[] y)Performs Mood's two-sample test for a difference in scale parameters.static double[]mood_test(double[] x, double[] y, TestKind kind)Performs Mood's two-sample test for a difference in scale parameters.static double[]poisson_test(int num_events, double time, double rate, TestKind kind)Performs an exact test of a simple null hypothesis about the rate parameter in Poisson distributionstatic double[]poisson_test(int num_events1, int num_events2, double time1, double time2, double r, TestKind kind)Comparison of Poisson ratesstatic double[]t_test_paired(double[] x, double[] y, double mu, TestKind kind)Paired t-teststatic double[]t_test(double[] x, double[] y, double mu, boolean pool_var, TestKind kind)Two sample t-teststatic double[]t_test(double[] x, double mu, TestKind kind)One-sample t-teststatic double[]var_test(double[] x, double[] y, double ratio, TestKind kind)Performs an F test to compare the variances of two samples from normal populations.static double[]var_test(double[] x, double[] y, TestKind kind)Performs an F test to compare the variances of two samples from normal populations.static double[]wilcoxon_test(double[] x, double mu, boolean correction, TestKind kind)One-sample Wilcoxon test.
-
-
-
Method Detail
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, double[] Y)Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided, exact p-value. If there are ties, then p-values will be inexact!- Parameters:
X- an array with length of nXY- an array with length of nY- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, double[] Y, boolean isExact)Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided.- Parameters:
X- an array with length of nXY- an array with length of nYisExact- whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind)Compute the Kolmogorov-Smirnov test to test between two distribution, exact p-value. If there are ties, then p-values will be inexact!- Parameters:
X- an array with length of nXY- an array with length of nYkind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind, boolean isExact)Compute the Kolmogorov-Smirnov test to test between two distribution.- Parameters:
X- an array with length of nXY- an array with length of nYkind- the kind of test {LOWER, GREATER, TWO_SIDED}isExact- whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided, exact p-value. If there are ties, then p-values will be inexact!- Parameters:
X- an array with length of nXdist- reference distribution- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, exact p-value. If there are ties, then p-values will be inexact!- Parameters:
X- an array with length of nXdist- reference distributionkind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, boolean isExact)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided.- Parameters:
X- an array with length of nXdist- reference distributionisExact- whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kolmogorov_smirnov_test
public static final double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind, boolean isExact)Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution.- Parameters:
X- an array with length of nXdist- reference distributionkind- the kind of test {LOWER, GREATER, TWO_SIDED}isExact- whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
ansari_bradley_test
public static final double[] ansari_bradley_test(double[] x, double[] y, boolean force_exact)Return the two-sided test of Ansari-Bradley.- Parameters:
x- the original xy- the original yforce_exact- Set to true if you want exact answer. The default behavior is that if there are ties or either the length of x or the length of y is at least 50.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
ansari_bradley_test
public static final double[] ansari_bradley_test(double[] x, double[] y, boolean force_exact, TestKind kind)Ansari-Bradley test.- Parameters:
x- the original xy- the original yforce_exact- Set to true if you want exact answer. The default behavior is that if there are ties or either the length of x or the length of y is at least 50.kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
mood_test
public static final double[] mood_test(double[] x, double[] y)Performs Mood's two-sample test for a difference in scale parameters. Two-sided test.- Parameters:
x-y-- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
mood_test
public static final double[] mood_test(double[] x, double[] y, TestKind kind)Performs Mood's two-sample test for a difference in scale parameters.- Parameters:
x-y-kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
var_test
public static final double[] var_test(double[] x, double[] y, TestKind kind)Performs an F test to compare the variances of two samples from normal populations. Ratio is set to 1.0.- Parameters:
x-y-kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
var_test
public static final double[] var_test(double[] x, double[] y, double ratio, TestKind kind)Performs an F test to compare the variances of two samples from normal populations.- Parameters:
x-y-ratio- the hypothesized ratio of the population variances of x and y.kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
wilcoxon_test
public static final double[] wilcoxon_test(double[] x, double mu, boolean correction, TestKind kind)One-sample Wilcoxon test. Test whether the vector of x is != mu- Parameters:
x-mu-correction- set to true if continuity correction is desired. Only matters if x has zeroes or tieskind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
mann_whitney_u_test
public static final double[] mann_whitney_u_test(double[] x, double[] y, double mu, boolean correction, boolean paired, TestKind kind)Mann-Whitney-U test- Parameters:
x-y-mu-correction- set to true if continuity correction is desired. Only matters then there are tiespaired- set to true for paired test (which reduces to Wilcoxon test)kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
t_test
public static final double[] t_test(double[] x, double mu, TestKind kind)One-sample t-test- Parameters:
x-mu-kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
t_test_paired
public static final double[] t_test_paired(double[] x, double[] y, double mu, TestKind kind)Paired t-test- Parameters:
x-y-mu-kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
t_test
public static final double[] t_test(double[] x, double[] y, double mu, boolean pool_var, TestKind kind)Two sample t-test- Parameters:
x-y-mu-pool_var- set to true if the variance should be pooled. Only matters when paired == falsekind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
binomial_test
public static final double[] binomial_test(int n_success, int n, double p, TestKind kind)Binomial test- Parameters:
n_success- The number of successesn- The total number of trialsp- Expected probabilitykind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
bartlett_test
public static final double[] bartlett_test(double[] x, int[] group)Bartlett's test- Parameters:
x-group- an array of group indices. Observation in x that belongs in the same group must have the same index.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
fligner_test
public static final double[] fligner_test(double[] x, int[] group)Fligner-Killeen test- Parameters:
x-group- an array of group indices. Observation in x that belongs in the same group must have the same index.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
kruskal_wallis_test
public static final double[] kruskal_wallis_test(double[] x, int[] group)Kruskal-Wallis test- Parameters:
x-group- an array of group indices. Observation in x that belongs in the same group must have the same index.- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
poisson_test
public static final double[] poisson_test(int num_events, double time, double rate, TestKind kind)Performs an exact test of a simple null hypothesis about the rate parameter in Poisson distribution- Parameters:
num_events- number of events.time- time base for event count.rate- hypothesized ratekind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
poisson_test
public static final double[] poisson_test(int num_events1, int num_events2, double time1, double time2, double r, TestKind kind)Comparison of Poisson rates- Parameters:
num_events1- number of events for the treatment.num_events2- number of events for control.time1- time base for event count for treatment.time2- time base for event count for control.kind- the kind of test {LOWER, GREATER, TWO_SIDED}- Returns:
- an array of two elements: The first is the test statistic, the second is the p-value
-
diptest
public static final double[] diptest(double[] x)
Perform Hartigan's dip test, assuming the minimum test statistics D is zero.- Parameters:
x- Can be of any order. If x is already sorted, use diptest_presorted to save some time.- Returns:
- an array of four elements: The first is the test statistic, the second is the p-value, followed by indices for which there are a dip. If there is no dip, the indices will be set to -1.
-
diptest_presorted
public static final double[] diptest_presorted(double[] x)
Perform Hartigan's dip test, assuming the minimum test statistics D is zero.- Parameters:
x- MUST BE SORTED in order to output the right result. This routine will NOT check for order!- Returns:
- an array of four elements: The first is the test statistic, the second is the p-value, followed by indices for which there are a dip. If there is no dip, the indices will be set to -1.
-
main
public static final void main(java.lang.String[] args)
-
-
DMelt 3.0 © DataMelt by jWork.ORG