org.statcato.statistics.inferential.nonparametrics
Class RunsTest
- java.lang.Object
-
- org.statcato.statistics.inferential.nonparametrics.RunsTest
-
public class RunsTest extends java.lang.ObjectRuns test for randomness. A nonparametic test that the number of runs (sequence of data having the same characteristic) in a sequence of sample data to test for randomness in the order of the data.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description RunsTest(int n1, int n2, int G, double significance)Constructor, given summarized data.RunsTest(java.util.Vector<Cell> vector, java.lang.String cat1, java.lang.String cat2, double significance)Constructor, given a vector of Cell containing data of two categories, the two categories, and significance level.RunsTest(java.util.Vector<java.lang.Double> vector, double separator, double significance)Constructor, given a vector containing numerical data, a separator value, and the significance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecriticalValue()doublemu()Returns the mean of the distribution of runs, mu = 2 * n1 * n2 / (n1 + n2) + 1.doublepValue()Returns the p-value.doublesigma()Returns the standard deviation of the distribution of runs, sigma = [(2 * n1 * n2)(2 * n1 * n2 - n1 - n2) / (n1 + n2)^2 / (n1 + n2 - 1)]^0.5doubletestStatistic()Returns the test statistic z = (G - mu) / sigma, where G is the number of runs, mu the mean of the distribution of runs, and sigma the standard deviatioin of the distribution of runs.java.lang.StringtoString()
-
-
-
Constructor Detail
-
RunsTest
public RunsTest(int n1, int n2, int G, double significance)Constructor, given summarized data.- Parameters:
n1- number of category 1n2- number of category 2G- number of runssignificance- significance level
-
RunsTest
public RunsTest(java.util.Vector<Cell> vector, java.lang.String cat1, java.lang.String cat2, double significance)
Constructor, given a vector of Cell containing data of two categories, the two categories, and significance level.- Parameters:
vector- vector of Cellcat1- string representing category 1cat2- string representing category 2significance- significance level
-
RunsTest
public RunsTest(java.util.Vector<java.lang.Double> vector, double separator, double significance)Constructor, given a vector containing numerical data, a separator value, and the significance. Test for randomness in which the numerical data fluctuates above or below the separator. Values equal to the separator are ignored.- Parameters:
vector- vector of double valuesseparator- double value separating the two groupssignificance- significance level
-
-
Method Detail
-
testStatistic
public double testStatistic()
Returns the test statistic z = (G - mu) / sigma, where G is the number of runs, mu the mean of the distribution of runs, and sigma the standard deviatioin of the distribution of runs.- Returns:
- test statistic z
-
mu
public double mu()
Returns the mean of the distribution of runs, mu = 2 * n1 * n2 / (n1 + n2) + 1.- Returns:
- mean
-
sigma
public double sigma()
Returns the standard deviation of the distribution of runs, sigma = [(2 * n1 * n2)(2 * n1 * n2 - n1 - n2) / (n1 + n2)^2 / (n1 + n2 - 1)]^0.5- Returns:
- standard deviation
-
pValue
public double pValue()
Returns the p-value.- Returns:
- p-value
-
criticalValue
public double criticalValue()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG