Class AS159
- java.lang.Object
-
- dev.nm.stat.test.distribution.pearson.AS159
-
- All Implemented Interfaces:
Seedable
public class AS159 extends Object implements Seedable
Algorithm AS 159 accepts a table shape (the number of rows and columns), and two vectors, the lists of row and column sums. There may be 0, 1, or many tables with nonnegative, integral entries that have the given shape and sums. If there is at least one candidate, then the routine will choose one, uniformly over the number of distinct candidates. The routine will report the case if there are no candidates. Other implementations includesrcont2
. For example,- https://svn.r-project.org/R/trunk/src/library/stats/src/rcont.c
- http://people.sc.fsu.edu/~jburkardt/c_src/asa159/asa159.c
- http://lib.stat.cmu.edu/apstat/159
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AS159.RandomMatrix
a random matrix generated by AS159 and its probability
-
Constructor Summary
Constructors Constructor Description AS159(int[] rowSums, int[] colSums)
Constructs a random table generator according to the row and column totals.AS159(int[] rowSums, int[] colSums, RandomLongGenerator uniform)
Constructs a random table generator according to the row and column totals.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isValidated(Matrix A)
Checks whether a matrix satisfies the row and column sums.AS159.RandomMatrix
nextMatrix()
Constructs a random matrix based on the row and column sums.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
AS159
public AS159(int[] rowSums, int[] colSums)
Constructs a random table generator according to the row and column totals.- Parameters:
rowSums
- the row totalscolSums
- the column totals
-
AS159
public AS159(int[] rowSums, int[] colSums, RandomLongGenerator uniform)
Constructs a random table generator according to the row and column totals.- Parameters:
rowSums
- the row totalscolSums
- the column totalsuniform
- a uniform random number generator
-
-
Method Detail
-
seed
public void seed(long... seeds)
Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
isValidated
public boolean isValidated(Matrix A)
Checks whether a matrix satisfies the row and column sums.- Parameters:
A
- a matrix- Returns:
true
ifA
satisfies the constraints
-
nextMatrix
public AS159.RandomMatrix nextMatrix()
Constructs a random matrix based on the row and column sums.- Returns:
- a random matrix
-
-