View source: R/topological.binary.R
topological.binary | R Documentation |
Performs Topological Binary Test of Alcover et al. (2013) to evaluate the randomness of an RNG. No additional goodness-of-fit test is applied after calculation of test statistic of Topological Binary Test.
topological.binary(x, B, alpha = 0.05, critical.value)
x |
a matrix that includes random data in base-2 format. See details for further information. |
B |
the length of words (B-bit). |
alpha |
a predetermined value of significance level with the default value of 0.05. |
critical.value |
a value used to decide whether to reject the null hypothesis at the significance level of |
The argument x
should be entered as a matrix of bits of dimension Bxk, where k is the number of words (integers) generated by the RNG of interest.
The argument critical.value
should be calculated regarding the value of B
. For B = 8,...,16, values of critical.value
are tabulated by Alcover et al. (2013) and calculation procedure of critical.value
for the values greater than 16 is described therein. The tabulated values can be used if the number of words (k) is equal to 2^B. Otherwise, it should be calculated over the given cumulative distribution function by Alcover et al. (2013). For example, if k=10^4, then critical.value
= 9245 and if k=2*10^4, then critical.value
= 19999.
Topological binary test is itself constitutes a goodness-of-fit test based on the number of different B-bit patterns among the non-overlapping B-bit blocks composed of the input sequence of bits.
statistic |
calculated value of the test statistic. |
result.TBT |
returns 0 if H0 is rejected and 1 otherwise. |
Haydar Demirhan
Maintainer: Haydar Demirhan <haydarde@hacettepe.edu.tr>
Alcover, P.M., Guillamon, A., Ruiz, M.C., A new randomness test for bit sequences. Informatica (2013), 24(3), 339–356.
RNGkind(kind = "Super-Duper") B=16 # Bit length is 16. k=5000 # Generate 5000 integers. dat=round(runif(k,0,(2^B-1))) x=sfsmisc::digitsBase(dat, base= 2, B) #Convert to base 2 alpha = 0.05 critical.value=9245 #Obtained for B = 16 test=topological.binary(x, B, alpha, critical.value) print(test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.