Title: | Independence Tests for Two-Way, Three-Way and Four-Way Contingency Tables |
---|---|
Description: | Presentation two independence tests for two-way, three-way and four-way contingency tables. These tests are: the modular test and the logarithmic minimum test. For details on this method see: Sulewski (2017) <doi:10.18778/0208-6018.330.04>, Sulewski (2018) <doi:10.1080/02664763.2018.1424122>, Sulewski (2019) <doi:10.2478/bile-2019-0003>, Sulewski (2021) <doi:10.1080/00949655.2021.1908286>. |
Authors: | Piotr Sulewski [aut, cre] |
Maintainer: | Piotr Sulewski <[email protected]> |
License: | GPL-3 |
Version: | 0.0.1 |
Built: | 2024-11-27 06:56:51 UTC |
Source: | CRAN |
Generating a two-way contingency table r x c
GenTab2(pij, n)
GenTab2(pij, n)
pij |
a numeric matrix with non-negative probability values of the two-way contingency table |
n |
a sample size |
Generating a two-way contingency table r x c using the probability matrix pij. If Ho is true then pij equals 1 / r / c.
The function returns the two-way contingency table r x c
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2016). Moc testów niezależności w tablicy dwudzielczej większej niż 2×2, Przegląd statystyczny 63(2), 190-210
r = 6; c = 2 GenTab2(array(1 / r / c, dim = c(r, c)), 93) GenTab2(matrix(c(0.125,0.25,0.25,0.375), nrow=2), 100)
r = 6; c = 2 GenTab2(array(1 / r / c, dim = c(r, c)), 93) GenTab2(matrix(c(0.125,0.25,0.25,0.375), nrow=2), 100)
Generating a three-way contingency table r x c x t.
GenTab3(pijt, n)
GenTab3(pijt, n)
pijt |
a numeric matrix with non-negative probability values of the three-way contingency table |
n |
a sample size |
Generating a three-way contingency table r x c x t using the probability matrix pijt. If Ho is true then pijt equals 1 / r / c / t.
The function returns the three-way contingency table r x c x t
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
r = 2; c = 3; t = 4 GenTab3(array(1 / (r * c * t), dim = c(r, c, t)),250) table = GenTab3(array(0.125, dim = c(2, 2, 2)), 100) GenTab3(prop.table(table),100)
r = 2; c = 3; t = 4 GenTab3(array(1 / (r * c * t), dim = c(r, c, t)),250) table = GenTab3(array(0.125, dim = c(2, 2, 2)), 100) GenTab3(prop.table(table),100)
Generating a four-way contingency table r x c x t x u.
GenTab4(pijtu, n)
GenTab4(pijtu, n)
pijtu |
a numeric matrix with non-negative probability values of the four-way contingency table |
n |
a sample size |
Generating a four-way contingency table r x c x t x u using the probability matrix pijtu. If Ho is true then pijtu equals 1 / r / c / t / u.
The function returns the four-way contingency table r x c x t x u
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
r = 2; c = 2; t = 2; u = 3 GenTab4(array(1 / (r * c * t * u), dim = c(r, c, t, u)),150) table = GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 200) GenTab4(prop.table(table),200)
r = 2; c = 2; t = 2; u = 3 GenTab4(array(1 / (r * c * t * u), dim = c(r, c, t, u)),150) table = GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 200) GenTab4(prop.table(table),200)
Calculates the critical values of the logarithmic minimum test.
Lms2.cv(nr, nc, n, alfa, B = 10000)
Lms2.cv(nr, nc, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the logarithmic minimum test for independence in r x c contingency table,
The function returns the critical value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2019). The LMS for Testing Independence in Two-way Contingency Tables. Biometrical Letters 56(1), 17-43 #'
Lms2.cv(2, 2, 40, 0.05, B = 1e3) Lms2.cv(2, 3, 60, 0.1, B = 1e2)
Lms2.cv(2, 2, 40, 0.05, B = 1e3) Lms2.cv(2, 3, 60, 0.1, B = 1e2)
Calculates the p-value of the logarithmic minimum test.
Lms2.pvalue(stat, nr, nc, n, B = 10000)
Lms2.pvalue(stat, nr, nc, n, B = 10000)
stat |
a logarithmic minimum statistic value |
nr |
a number of rows |
nc |
a number of columns |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The p-value of the logarithmic minimum test for independence in r x c contingency table, data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAWElEQVR42mNgGPTAxsZmJsVqQApgmGw1yApwKcQiT7phRBuCzzCSDSHGMKINIeDNmWQlA2IigKJwIssQkHdINgxfmBBtGDEBS3KCxBc7pMQgMYE5c/AXPwAwSX4lV3pTWwAAAABJRU5ErkJggg==
The function returns the p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2019). The LMS for Testing Independence in Two-way Contingency Tables. Biometrical Letters 56(1), 17-43
Lms2.pvalue(Lms2.stat(table1), 2, 2, 40, B = 1e3) Lms2.pvalue(Lms2.stat(table2), 2, 3, 60, B = 1e2)
Lms2.pvalue(Lms2.stat(table1), 2, 2, 40, B = 1e3) Lms2.pvalue(Lms2.stat(table2), 2, 3, 60, B = 1e2)
Calculates the logarithmic minimum statistics (see Sulewski P. (2019)).
Lms2.stat(nij)
Lms2.stat(nij)
nij |
a numeric matrix with non-negative values of the two-way contingency table cells |
The statistic of the logarithmic minimum test for independence in r x c contingency table, see formula (4) and example 3 in the article.
The function returns the value of the logarithmic minimum test statistic
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2019). The LMS for Testing Independence in Two-way Contingency Tables. Biometrical Letters 56(1), 17-43
Lms2.stat(table1) Lms2.stat(table2)
Lms2.stat(table1) Lms2.stat(table2)
Calculates the test statistic and p-value of the logarithmic minimum test.
Lms2.test(nij, B = 10000)
Lms2.test(nij, B = 10000)
nij |
a numeric matrix with non-negative values of the two-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of he logarithmic minimum test for independence in r x c contingency table,
The function returns values of the test statistic and p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2019). The LMS for Testing Independence in Two-way Contingency Tables. Biometrical Letters 56(1), 17-43
Lms2.test(GenTab2(matrix(1/6, nrow = 2, ncol = 3), 50), B = 1e2) Lms2.test(table2, B = 1e3)
Lms2.test(GenTab2(matrix(1/6, nrow = 2, ncol = 3), 50), B = 1e2) Lms2.test(table2, B = 1e3)
Calculates the critical value of the Logarithmic minimum test for independence in three-way contingency table (see Sulewski P. (2018)).
Lms3.cv(nr, nc, nt, n, alfa, B = 10000)
Lms3.cv(nr, nc, nt, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the Logarithmic minimum test for independence in r x c x t contingency table,
The function returns the critical value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms3.cv(2, 2, 2, 80, 0.05, B = 1e2) Lms3.cv(2, 2, 2, 80, 0.1, B = 1e3)
Lms3.cv(2, 2, 2, 80, 0.05, B = 1e2) Lms3.cv(2, 2, 2, 80, 0.1, B = 1e3)
Calculates the p-value of the Logarithmic minimum test for independence in three-way contingency table
Lms3.pvalue(stat, nr, nc, nt, n, B = 10000)
Lms3.pvalue(stat, nr, nc, nt, n, B = 10000)
stat |
a Logarithmic minimum statistic value |
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c x t contingency table,
The function returns the p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
tab1 = GenTab3(array(0.125, dim = c(2, 2, 2)), 100) Lms3.pvalue(Lms3.stat(tab1), 2, 2, 2, 100, B=1e2) Lms3.pvalue(Lms3.stat(table4), 2, 2, 2, 80, B = 1e3)
tab1 = GenTab3(array(0.125, dim = c(2, 2, 2)), 100) Lms3.pvalue(Lms3.stat(tab1), 2, 2, 2, 100, B=1e2) Lms3.pvalue(Lms3.stat(table4), 2, 2, 2, 80, B = 1e3)
Calculates the statistic of the Logarithmic minimum test for independence in three-way contingency table (see Sulewski P. (2018)).
Lms3.stat(nijt)
Lms3.stat(nijt)
nijt |
a numeric matrix with non-negative values of the three-way contingency table cells |
The statistic of Logarithmic minimum test for independence in r x c x t contingency table, see formula (6) in the article.
The function returns the value of the logarithmic minimum test statistic.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms3.stat(table3) Lms3.stat(GenTab3(array(1/12, dim=c(2,2,3)), 120))
Lms3.stat(table3) Lms3.stat(GenTab3(array(1/12, dim=c(2,2,3)), 120))
Calculates the test statistic and p-value of the Logarithmic minimum test for independence in three-way contingency table
Lms3.test(nijt, B = 10000)
Lms3.test(nijt, B = 10000)
nijt |
a numeric matrix with non-negative values of the three-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of the Logarithmic minimum test for independence in r x c x t contingency table,
The function returns values of the test statistic and p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms3.test(GenTab3(array(0.125, dim = c(2, 2, 2)), 80), B = 1e2) Lms3.test(table4, B = 1e3)
Lms3.test(GenTab3(array(0.125, dim = c(2, 2, 2)), 80), B = 1e2) Lms3.test(table4, B = 1e3)
Calculates the critical value of the Logarithmic minimum test for independence in four-way contingency table
Lms4.cv(nr, nc, nt, nu, n, alfa, B = 10000)
Lms4.cv(nr, nc, nt, nu, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
nu |
a number of tubes |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the Logarithmic minimum test for independence in r x c x t contingency table,
The function returns the critical value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms4.cv(2, 2, 2, 2, 160, 0.05, B = 1e2) Lms4.cv(2, 2, 2, 2, 160, 0.1, B = 1e3)
Lms4.cv(2, 2, 2, 2, 160, 0.05, B = 1e2) Lms4.cv(2, 2, 2, 2, 160, 0.1, B = 1e3)
Calculates the p-value of the Logarithmic minimum test for independence in four-way contingency table
Lms4.pvalue(stat, nr, nc, nt, nu, n, B = 10000)
Lms4.pvalue(stat, nr, nc, nt, nu, n, B = 10000)
stat |
a Logarithmic minimum statistic value |
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
nu |
a number of |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c x t x u contingency table,
The function returns the p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
data = GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160) Lms4.pvalue(Lms4.stat(data), 2, 2, 2, 2, 160, B=1e3) Lms4.pvalue(Lms4.stat(table6), 2, 2, 2, 2, 160, B = 1e2)
data = GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160) Lms4.pvalue(Lms4.stat(data), 2, 2, 2, 2, 160, B=1e3) Lms4.pvalue(Lms4.stat(table6), 2, 2, 2, 2, 160, B = 1e2)
Calculates the statistic of the Logarithmic minimum test for independence in four-way contingency table
Lms4.stat(nijtu)
Lms4.stat(nijtu)
nijtu |
a numeric matrix with non-negative values of the four-way contingency table cells |
The statistic of Logarithmic minimum test for independence in r x c x t x u contingency table,
The function returns the value of the logarithmic minimum test statistic.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms4.stat(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160)) Lms4.stat(table5)
Lms4.stat(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160)) Lms4.stat(table5)
Calculates the test statistic and p-value of the Logarithmic minimum test for independence in four-way contingency table
Lms4.test(nijtu, B = 10000)
Lms4.test(nijtu, B = 10000)
nijtu |
a numeric matrix with non-negative values of the four-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of the Logarithmic minimum test for independence in r x c x t x u contingency table,
The function returns values of the test statistic and p-value of the logarithmic minimum test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes, Journal of Statistical Computation and Simulation 91(13), 2780-2799
Lms4.test(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160), B = 1e2) Lms4.test(table6, B = 1e3)
Lms4.test(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160), B = 1e2) Lms4.test(table6, B = 1e3)
Calculates the critical value of the modular test for independence in two-way contingency table see formula (9) in the article.
Mod2.cv(nr, nc, n, alfa, B = 10000)
Mod2.cv(nr, nc, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c contingency table, see formula (2) in the article.
The function returns the critical value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2016). Moc testów niezależności w tablicy dwudzielczej większej niż 2×2, Przegląd statystyczny 63(2), 190-210
Mod2.cv(2, 2, 40, 0.05, B = 1e2) Mod2.cv(2, 3, 60, 0.1)
Mod2.cv(2, 2, 40, 0.05, B = 1e2) Mod2.cv(2, 3, 60, 0.1)
Calculates the p-value of the modular test for independence in two-way contingency table
Mod2.pvalue(stat, nr, nc, n, B = 10000)
Mod2.pvalue(stat, nr, nc, n, B = 10000)
stat |
a modular statistic value |
nr |
a number of rows |
nc |
a number of columns |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The p-value of the modular test for independence in r x c contingency table,
The function returns the p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2016). Moc testów niezależności w tablicy dwudzielczej większej niż 2×2, Przegląd statystyczny 63(2), 190-210
pij=matrix(1/4, nrow = 2, ncol = 2) tab4=GenTab2(pij, 30) Mod2.pvalue(Mod2.stat(tab4), 2, 2, 30, B=1e3) Mod2.pvalue(2.5, 3, 2, 60)
pij=matrix(1/4, nrow = 2, ncol = 2) tab4=GenTab2(pij, 30) Mod2.pvalue(Mod2.stat(tab4), 2, 2, 30, B=1e3) Mod2.pvalue(2.5, 3, 2, 60)
Calculates the statistic of the modular test for independence in two-way contingency table (see Sulewski P. (2016)).
Mod2.stat(nij)
Mod2.stat(nij)
nij |
a numeric matrix with non-negative values of the two-way contingency table cells |
The statistic of the modular test for independence in r x c contingency table, see formula (2) in the article.
The function returns the value of the modular test statistic.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2016). Moc testów niezależności w tablicy dwudzielczej większej niż 2×2, Przegląd statystyczny 63(2), 190-210
tab5=GenTab2(matrix(1/12, nrow = 3, ncol = 4), 60) Mod2.stat(tab5) Mod2.stat(table1)
tab5=GenTab2(matrix(1/12, nrow = 3, ncol = 4), 60) Mod2.stat(tab5) Mod2.stat(table1)
Calculates the test statistic and p-value of the modular test for independence in two-way contingency table
Mod2.test(nij, B = 10000)
Mod2.test(nij, B = 10000)
nij |
a numeric matrix with non-negative values of the two-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of the modular test for independence in r x c contingency table,
The function returns values of the test statistic and p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2016). Moc testów niezależności w tablicy dwudzielczej większej niż 2×2, Przegląd statystyczny 63(2), 190-210
pij=matrix(1/4, nrow = 2, ncol = 2) Mod2.test(GenTab2(pij, 50), B = 1e3) Mod2.test(table1, B = 1e2)
pij=matrix(1/4, nrow = 2, ncol = 2) Mod2.test(GenTab2(pij, 50), B = 1e3) Mod2.test(table1, B = 1e2)
Calculates the critical value of the modular test for independence in three-way contingency table (see Sulewski P. (2018)).
Mod3.cv(nr, nc, nt, n, alfa, B = 10000)
Mod3.cv(nr, nc, nt, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c x t contingency table,
The function returns the critical value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod3.cv(2, 2, 2, 80, 0.05, B = 1e2) Mod3.cv(2, 2, 2, 80, 0.1, B = 1e3)
Mod3.cv(2, 2, 2, 80, 0.05, B = 1e2) Mod3.cv(2, 2, 2, 80, 0.1, B = 1e3)
Calculates the p-value of the modular test for independence in three-way contingency table
Mod3.pvalue(stat, nr, nc, nt, n, B = 10000)
Mod3.pvalue(stat, nr, nc, nt, n, B = 10000)
stat |
a modular statistic value |
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c x t contingency table,
The function returns the p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
data = GenTab3(array(0.125, dim = c(2, 2, 2)), 80) Mod3.pvalue(Mod3.stat(data), 2, 2, 2, 80, B = 1e2) Mod3.pvalue(Mod3.stat(table4), 2, 2, 2, 80, B = 1e3)
data = GenTab3(array(0.125, dim = c(2, 2, 2)), 80) Mod3.pvalue(Mod3.stat(data), 2, 2, 2, 80, B = 1e2) Mod3.pvalue(Mod3.stat(table4), 2, 2, 2, 80, B = 1e3)
Calculates the statistic of the modular test for independence in three-way contingency table (see Sulewski P. (2018)).
Mod3.stat(nijt)
Mod3.stat(nijt)
nijt |
a numeric matrix with non-negative values of the three-way contingency table cells |
The statistic of the modular test for independence in r x c x t contingency table, see formula (6) in the article.
The function returns the value of the modular test statistic.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod3.stat(GenTab3(array(0.125, dim = c(2, 2, 2)), 100)) Mod3.stat(table4)
Mod3.stat(GenTab3(array(0.125, dim = c(2, 2, 2)), 100)) Mod3.stat(table4)
Calculates the test statistic and p-value of the modular test for independence in three-way contingency table
Mod3.test(nijt, B = 10000)
Mod3.test(nijt, B = 10000)
nijt |
a numeric matrix with non-negative values of the three-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of the modular test for independence in r x c x t contingency table,
The function returns values of the test statistic and p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod3.test(GenTab3(array(0.125, dim = c(2, 2, 2)), 80), B = 1e3) Mod3.test(table4, B = 1e3)
Mod3.test(GenTab3(array(0.125, dim = c(2, 2, 2)), 80), B = 1e3) Mod3.test(table4, B = 1e3)
Calculates the critical value of the modular test for independence in four-way contingency table
Mod4.cv(nr, nc, nt, nu, n, alfa, B = 10000)
Mod4.cv(nr, nc, nt, nu, n, alfa, B = 10000)
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
nu |
a number of tubes |
n |
a sample size |
alfa |
a significance level |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the Logarithmic minimum test for independence in r x c x t contingency table,
The function returns the critical value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod4.cv(2, 2, 2, 2, 160, 0.05, B = 1e2) Mod4.cv(2, 2, 2, 2, 160, 0.1, B = 1e3)
Mod4.cv(2, 2, 2, 2, 160, 0.05, B = 1e2) Mod4.cv(2, 2, 2, 2, 160, 0.1, B = 1e3)
Calculates the p-value of the modular test for independence in four-way contingency table
Mod4.pvalue(stat, nr, nc, nt, nu, n, B = 10000)
Mod4.pvalue(stat, nr, nc, nt, nu, n, B = 10000)
stat |
a Logarithmic minimum statistic value |
nr |
a number of rows |
nc |
a number of columns |
nt |
a number of tubes |
nu |
a number of |
n |
a sample size |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The Critical value of the modular test for independence in r x c x t x u contingency table,
The function returns the p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod4.pvalue(Mod4.stat(table6), 2, 2, 2, 2, 160, B = 1e2) Mod4.pvalue(Mod4.stat(table6), 2, 2, 2, 2, 160, B = 1e3)
Mod4.pvalue(Mod4.stat(table6), 2, 2, 2, 2, 160, B = 1e2) Mod4.pvalue(Mod4.stat(table6), 2, 2, 2, 2, 160, B = 1e3)
Calculates the statistic of the modular test for independence in four-way contingency table
Mod4.stat(nijtu)
Mod4.stat(nijtu)
nijtu |
a numeric matrix with non-negative values of the four-way contingency table cells |
The statistic of Logarithmic minimum test for independence in r x c x t x u contingency table,
The function returns the value of the modular test statistic.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod4.stat(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 100)) Mod4.stat(table6)
Mod4.stat(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 100)) Mod4.stat(table6)
Calculates the test statistic and p-value of the modular test for independence in four-way contingency table
Mod4.test(nijtu, B = 10000)
Mod4.test(nijtu, B = 10000)
nijtu |
a numeric matrix with non-negative values of the four-way contingency table cells |
B |
an integer specifying the number of replicates used in the Monte Carlo test (optional) |
The test statistic and p-value of the modular test for independence in r x c x t x u contingency table,
The function returns values of the test statistic and p-value of the modular test.
Piotr Sulewski, [email protected], Pomeranian University in Slupsk.
Extension of the information contained in Sulewski, P. (2018). Power Analysis Of Independence Testing for the Three-Way Con-tingency Tables of Small Sizes. Journal of Applied Statistics 45(13), 2481-2498
Mod4.test(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160), B = 1e2) Mod4.test(table6, B = 1e2)
Mod4.test(GenTab4(array(1/16, dim = c(2, 2, 2, 2)), 160), B = 1e2) Mod4.test(table6, B = 1e2)
The PSIndependenceTest package puts into practice the modular and logarithmic minimum tests for independence in two-way, three-way and four-way contingency tables. Statistic value, cv value and p-value are calculated. This package also includes three table generation functions and six data sets. The list of package functions is as follows:
The first data set from Sulewski, P. (2017) A new test for independence in 2x2 contingency tables, Acta Universitatis Lodziensis. Folia Oeconomica, 4(330), 55–75 consist of 40 observations described the effect of a treatment for rheumatoid arthritis vs. a placebo. See Table 17 in the paper.
table1
table1
two-way contingency table 2 x 2
The second data set obtained using the Monte Carlo method consist of 60 observations when Ho is true, i.e. all probabilities equal 1/6
table2
table2
two-way contingency table 2 x 3
The third data set from Sulewski, P. (2021). Logarithmic Minimum Test for Independence in Three Way Con-tingency Table of Small Sizes. Journal of Statistical Computation and Simulation 91(13), 2780-2799 consist of 695 observations described the frequency of watching videos at home or at friends’ homes for young people between 7 and 15 years of age, cross-classified according to age and sex. See Table 10 in the paper.
table3
table3
three-way contingency table 3 x 3 x 2
The fourth data set obtained using the Monte Carlo method consist of 80 observations when Ho is true, i.e. all probabilities equal 1/8.
table4
table4
three-way contingency table 2 x 2 x 2
The fifth data set provides information on the fate of 2201 passengers on the fatal maiden voyage of the ocean liner ‘Titanic’, summarized according to economic status (class), sex, age and survival.
table5
table5
four-way contingency table 4 x 2 x 2 x 2
The sixth data set obtained using the Monte Carlo method consist of 160 observations when Ho is true, i.e. all probabilities equal 1/16.
table6
table6
four-way contingency table 2 x 2 x 2 x 2