Description Usage Arguments Details Value Author(s) References Examples
View source: R/HHG_univariate.R
Functions for creating null table objects for the omnibus distribution-free test of independence between two univariate random variables.
1 2 3 4 5 | hhg.univariate.ind.nulltable(size,mmin=2,mmax = max(floor(sqrt(size)/2),2),
variant = 'ADP',aggregation.type = 'sum',score.type='LikelihoodRatio',
w.sum = 0, w.max = 2,nr.replicates=1000,keep.simulation.data=F,
nr.atoms = nr_bins_equipartition(size),
compress=F,compress.p0=0.001,compress.p=0.99,compress.p1=0.000001)
|
size |
The sample size |
mmin |
The minimum partition size of the ranked observations, default value is 2. |
mmax |
The maximum partition size of the ranked observations, default value is half the square root of the number of observations. |
variant |
a character string specifying the partition type, must be one of |
aggregation.type |
a character string specifying the aggregation type, must be one of |
score.type |
a character string specifying the score type, must be one of |
w.sum |
The minimum number of observations in a partition, only relevant for |
w.max |
The minimum number of observations in a partition, only relevant for |
nr.replicates |
The number of permutations for the null distribution. |
keep.simulation.data |
TRUE/FALSE. If TRUE, then in addition to the sorted statistics per column, the original matrix of size nr.replicates by mmax-mmin+1 is also stored. |
nr.atoms |
For |
compress |
TRUE or FALSE. If enabled, null tables are compressed: The lower |
compress.p0 |
Parameter for compression. This is the resolution for the lower |
compress.p |
Parameter for compression. Part of the null distribution to compress. |
compress.p1 |
Parameter for compression. This is the resolution for the upper value of the null distribution. |
In order to compute the null distributions for a test statistic (with a specific aggregation and score type, and all partition sizes), the only necessary information is the sample size (the test statistic is "distribution free"). The accuracy of the quantiles of the null distribution depend on the number of replicates used for constructing the null tables. The necessary accuracy depends on the threshold used for rejection of the null hypotheses.
This function creates an object for efficiently storing the null distribution of the test statistics (by partition size m
). Use the returned object, together with hhg.univariate.ind.pvalue
to compute the P-value for the statistics computed by hhg.univariate.ind.stat
Generated null tables also hold the distribution of statistics for combination types (comb.type=='MinP'
and comb.type=='Fisher'
), used by hhg.univariate.ind.combined.test
.
Variant types "ADP-EQP"
and "ADP-EQP-ML"
, are the computationally efficient versions of the "ADP"
and "ADP-ML"
. EQP type variants reduce calculation time by summing over a subset of partitions, where a split between cells may be performed only every n/nr.atoms observations. This allows for a complexity of O(nr.atoms^4). These variants are only available for aggregation.type=='sum'
type aggregation.
Null tables may be compressed, using the compress
argument. For each of the partition sizes (i.e. m
or mXm
), the null distribution is held at a compress.p0
resolution up to the compress.p
percentile. Beyond that value, the distribution is held at a finer resolution defined by compress.p1
(since higher values are attained when a relation exists in the data, this is required for computing the p-value accurately in the tail of the null disribution.)
For large data (n>100), it is recommended to used Fast.ADP.test
, which is an optimized version of the hhg.univariate.ind.stat
and hhg.univariate.ind.combined
tests. Null Tables for Fast.ADP.test
can be constructed using Fast.ADP.nulltable
.
m.stats |
If keep.simulation.data= TRUE, |
univariate.object |
A useful format of the null tables for computing p-values efficiently. |
Barak Brill and Shachar Kaufman.
Heller, R., Heller, Y., Kaufman S., Brill B, & Gorfine, M. (2016). Consistent Distribution-Free K-Sample and Independence Tests for Univariate Random Variables, JMLR 17(29):1-54 https://www.jmlr.org/papers/volume17/14-441/14-441.pdf
Brill B. (2016) Scalable Non-Parametric Tests of Independence (master's thesis) http://primage.tau.ac.il/libraries/theses/exeng/free/2899741.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
#Testing for independance, sample size = 35
N=35
#null table for aggregation by summation (on ADP):
ADP.null = hhg.univariate.ind.nulltable(N)
#create a null table, using aggregation by summation over DDP partitions,
#with partitions sizes up to 5, over Pearson scores, with 1000 bootstrap repetitions.
DDP.null = hhg.univariate.ind.nulltable(N,mmax = 5,variant = 'DDP',
score.type = 'Pearson', nr.replicates = 1000)
#Create a null table for the ADP-EQP and ADP-EQP-ML variants,
#which are tailored for independece testing, with larger n (n>100):
N_large =200
ADP.EQP.null = hhg.univariate.ind.nulltable(N_large, variant = 'ADP-EQP',nr.atoms = 40)
#Null table for the sum of log likelihood scores over all possible M X L tables:
ADP.EQP.ML.null = hhg.univariate.ind.nulltable(N_large, variant = 'ADP-EQP-ML',
nr.atoms = 30,nr.replicates=200)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.