Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_chi_squared_tests.wasp
Title produced by softwareChi-Squared Test, McNemar Test, and Fisher Exact Test
Date of computationThu, 31 Jan 2019 14:31:09 +0100
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2019/Jan/31/t15489415347eqfxfqtdl3mrte.htm/, Retrieved Sun, 05 May 2024 16:50:12 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=317598, Retrieved Sun, 05 May 2024 16:50:12 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact27
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Chi-Squared Test, McNemar Test, and Fisher Exact Test] [] [2019-01-31 13:31:09] [9f050f8aed6d13342aa7dd8a5b9f6dd8] [Current]
Feedback Forum

Post a new message
Dataseries X:
21 1 0
22 1 1
22 1 0
18 1 1
23 1 1
12 1 1
20 1 0
22 1 1
21 1 1
19 1 1
22 1 1
15 1 1
20 1 1
19 1 0
18 1 0
15 0 0
20 1 1
21 1 0
21 0 1
15 1 0
16 1 1
23 1 1
21 1 0
18 1 1
25 1 1
9 1 1
30 0 1
20 0 0
23 1 1
16 1 0
16 1 0
19 1 0
25 1 1
18 1 1
23 1 1
21 1 1
10 1 0
14 0 1
22 1 1
26 1 0
23 1 1
23 1 1
24 1 1
24 1 1
18 0 1
23 1 0
15 1 1
19 0 1
16 1 0
25 0 1
23 0 1
17 0 1
19 1 1
21 0 1
18 1 1
27 1 1
21 0 0
13 1 1
8 0 0
29 0 1
28 1 1
23 1 0
21 1 0
19 1 1
19 1 0
20 0 1
18 1 0
19 1 1
17 1 1
19 0 0
25 1 0
19 1 0
22 0 0
23 0 1
14 1 0
16 1 0
24 0 1
20 1 0
12 0 0
24 1 1
22 0 0
12 0 0
22 0 0
20 0 1
10 0 0
23 0 1
17 0 1
22 0 0
24 0 0
18 0 0
21 0 1
20 0 1
20 0 1
22 0 0
19 0 1
20 0 0
26 0 1
23 0 1
24 0 1
21 0 1
21 0 1
19 0 0
8 0 1
17 0 1
20 0 1
11 0 0
8 0 0
15 0 0
18 0 0
18 0 0
19 0 0
19 0 1
23 1 1
22 1 1
21 1 1
25 1 1
30 0 0
17 0 1
27 1 1
23 1 0
23 1 1
18 1 0
18 1 0
23 1 1
19 1 1
15 1 1
20 1 1
16 1 1
24 0 1
25 1 1
25 1 1
19 1 0
19 1 1
16 1 1
19 1 1
19 1 1
23 1 1
21 1 1
22 1 0
19 1 1
20 0 1
20 1 1
3 1 1
23 1 1
23 1 0
20 1 0
15 1 1
16 1 0
7 1 0
24 1 1
17 1 0
24 1 1
24 1 1
19 1 0
25 0 1
20 0 1
28 1 1
23 1 0
27 0 0
18 0 0
28 0 0
21 0 1
19 1 0
23 1 1
27 0 0
22 0 1
28 0 0
25 0 1
21 0 0
22 0 0
28 0 1
20 0 0
29 0 1
25 1 1
25 1 1
20 0 1
20 1 1
16 1 0
20 0 1
20 1 0
23 0 0
18 0 0
25 1 1
18 0 0
19 0 1
25 0 0
25 0 0
25 0 0
24 0 0
19 0 1
26 0 1
10 0 1
17 0 1
13 0 0
17 0 0
30 0 1
25 1 0
4 0 0
16 0 0
21 0 0
23 1 1
22 0 1
17 1 0
20 0 0
20 1 1
22 0 0
16 1 1
23 0 1
0 0 0
18 0 1
25 0 1
23 1 1
12 1 0
18 0 0
24 1 0
11 1 1
18 0 1
23 1 1
24 0 1
29 0 0
18 1 0
15 0 0
29 1 1
16 1 1
19 1 0
22 0 0
16 1 0
23 0 1
23 1 1
19 1 0
4 1 0
20 1 0
24 0 1
20 1 1
4 1 1
24 1 1
22 0 0
16 1 1
3 1 1
15 0 1
24 1 0
17 0 0
20 0 1
27 0 0
26 0 1
23 0 1
17 1 0
20 1 1
22 1 0
19 1 1
24 1 1
19 1 0
23 0 1
15 0 0
27 1 1
26 0 0
22 0 1
22 1 0
18 0 0
15 0 1
22 0 1
27 0 0
10 0 1
20 0 1
17 0 0
23 0 1
19 0 0
13 0 0
27 0 1
23 0 1
16 0 0
25 0 1
2 0 0
26 0 0
20 0 1
23 1 0
22 0 0
24 0 1




Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time6 seconds
R ServerBig Analytics Cloud Computing Center

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input view raw input (R code)  \tabularnewline
Raw Outputview raw output of R engine  \tabularnewline
Computing time6 seconds \tabularnewline
R ServerBig Analytics Cloud Computing Center \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=317598&T=0

[TABLE]
[ROW]
Summary of computational transaction[/C][/ROW] [ROW]Raw Input[/C] view raw input (R code) [/C][/ROW] [ROW]Raw Output[/C]view raw output of R engine [/C][/ROW] [ROW]Computing time[/C]6 seconds[/C][/ROW] [ROW]R Server[/C]Big Analytics Cloud Computing Center[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=317598&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=317598&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time6 seconds
R ServerBig Analytics Cloud Computing Center







Tabulation of Results
NUMERACYTOT x group
01
010
210
302
412
701
830
901
1031
1111
1222
1321
1411
1565
16213
1784
18119
19920
201613
2198
22149
231122
24810
25810
2651
2753
2832
2931
3030

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline
NUMERACYTOT  x  group \tabularnewline
  & 0 & 1 \tabularnewline
0 & 1 & 0 \tabularnewline
2 & 1 & 0 \tabularnewline
3 & 0 & 2 \tabularnewline
4 & 1 & 2 \tabularnewline
7 & 0 & 1 \tabularnewline
8 & 3 & 0 \tabularnewline
9 & 0 & 1 \tabularnewline
10 & 3 & 1 \tabularnewline
11 & 1 & 1 \tabularnewline
12 & 2 & 2 \tabularnewline
13 & 2 & 1 \tabularnewline
14 & 1 & 1 \tabularnewline
15 & 6 & 5 \tabularnewline
16 & 2 & 13 \tabularnewline
17 & 8 & 4 \tabularnewline
18 & 11 & 9 \tabularnewline
19 & 9 & 20 \tabularnewline
20 & 16 & 13 \tabularnewline
21 & 9 & 8 \tabularnewline
22 & 14 & 9 \tabularnewline
23 & 11 & 22 \tabularnewline
24 & 8 & 10 \tabularnewline
25 & 8 & 10 \tabularnewline
26 & 5 & 1 \tabularnewline
27 & 5 & 3 \tabularnewline
28 & 3 & 2 \tabularnewline
29 & 3 & 1 \tabularnewline
30 & 3 & 0 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=317598&T=1

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]NUMERACYTOT  x  group[/C][/ROW]
[ROW][C] [/C][C]0[/C][C]1[/C][/ROW]
[C]0[/C][C]1[/C][C]0[/C][/ROW]
[C]2[/C][C]1[/C][C]0[/C][/ROW]
[C]3[/C][C]0[/C][C]2[/C][/ROW]
[C]4[/C][C]1[/C][C]2[/C][/ROW]
[C]7[/C][C]0[/C][C]1[/C][/ROW]
[C]8[/C][C]3[/C][C]0[/C][/ROW]
[C]9[/C][C]0[/C][C]1[/C][/ROW]
[C]10[/C][C]3[/C][C]1[/C][/ROW]
[C]11[/C][C]1[/C][C]1[/C][/ROW]
[C]12[/C][C]2[/C][C]2[/C][/ROW]
[C]13[/C][C]2[/C][C]1[/C][/ROW]
[C]14[/C][C]1[/C][C]1[/C][/ROW]
[C]15[/C][C]6[/C][C]5[/C][/ROW]
[C]16[/C][C]2[/C][C]13[/C][/ROW]
[C]17[/C][C]8[/C][C]4[/C][/ROW]
[C]18[/C][C]11[/C][C]9[/C][/ROW]
[C]19[/C][C]9[/C][C]20[/C][/ROW]
[C]20[/C][C]16[/C][C]13[/C][/ROW]
[C]21[/C][C]9[/C][C]8[/C][/ROW]
[C]22[/C][C]14[/C][C]9[/C][/ROW]
[C]23[/C][C]11[/C][C]22[/C][/ROW]
[C]24[/C][C]8[/C][C]10[/C][/ROW]
[C]25[/C][C]8[/C][C]10[/C][/ROW]
[C]26[/C][C]5[/C][C]1[/C][/ROW]
[C]27[/C][C]5[/C][C]3[/C][/ROW]
[C]28[/C][C]3[/C][C]2[/C][/ROW]
[C]29[/C][C]3[/C][C]1[/C][/ROW]
[C]30[/C][C]3[/C][C]0[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=317598&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=317598&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Tabulation of Results
NUMERACYTOT x group
01
010
210
302
412
701
830
901
1031
1111
1222
1321
1411
1565
16213
1784
18119
19920
201613
2198
22149
231122
24810
25810
2651
2753
2832
2931
3030







Tabulation of Expected Results
NUMERACYTOT x group
01
00.490.51
20.490.51
30.981.02
41.471.53
70.490.51
81.471.53
90.490.51
101.962.04
110.981.02
121.962.04
131.471.53
140.981.02
155.385.62
167.347.66
175.876.13
189.7810.22
1914.1914.81
2014.1914.81
218.328.68
2211.2511.75
2316.1416.86
248.819.19
258.819.19
262.943.06
273.914.09
282.452.55
291.962.04
301.471.53

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
NUMERACYTOT  x  group \tabularnewline
  & 0 & 1 \tabularnewline
0 & 0.49 & 0.51 \tabularnewline
2 & 0.49 & 0.51 \tabularnewline
3 & 0.98 & 1.02 \tabularnewline
4 & 1.47 & 1.53 \tabularnewline
7 & 0.49 & 0.51 \tabularnewline
8 & 1.47 & 1.53 \tabularnewline
9 & 0.49 & 0.51 \tabularnewline
10 & 1.96 & 2.04 \tabularnewline
11 & 0.98 & 1.02 \tabularnewline
12 & 1.96 & 2.04 \tabularnewline
13 & 1.47 & 1.53 \tabularnewline
14 & 0.98 & 1.02 \tabularnewline
15 & 5.38 & 5.62 \tabularnewline
16 & 7.34 & 7.66 \tabularnewline
17 & 5.87 & 6.13 \tabularnewline
18 & 9.78 & 10.22 \tabularnewline
19 & 14.19 & 14.81 \tabularnewline
20 & 14.19 & 14.81 \tabularnewline
21 & 8.32 & 8.68 \tabularnewline
22 & 11.25 & 11.75 \tabularnewline
23 & 16.14 & 16.86 \tabularnewline
24 & 8.81 & 9.19 \tabularnewline
25 & 8.81 & 9.19 \tabularnewline
26 & 2.94 & 3.06 \tabularnewline
27 & 3.91 & 4.09 \tabularnewline
28 & 2.45 & 2.55 \tabularnewline
29 & 1.96 & 2.04 \tabularnewline
30 & 1.47 & 1.53 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=317598&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]NUMERACYTOT  x  group[/C][/ROW]
[ROW][C] [/C][C]0[/C][C]1[/C][/ROW]
[C]0[/C][C]0.49[/C][C]0.51[/C][/ROW]
[C]2[/C][C]0.49[/C][C]0.51[/C][/ROW]
[C]3[/C][C]0.98[/C][C]1.02[/C][/ROW]
[C]4[/C][C]1.47[/C][C]1.53[/C][/ROW]
[C]7[/C][C]0.49[/C][C]0.51[/C][/ROW]
[C]8[/C][C]1.47[/C][C]1.53[/C][/ROW]
[C]9[/C][C]0.49[/C][C]0.51[/C][/ROW]
[C]10[/C][C]1.96[/C][C]2.04[/C][/ROW]
[C]11[/C][C]0.98[/C][C]1.02[/C][/ROW]
[C]12[/C][C]1.96[/C][C]2.04[/C][/ROW]
[C]13[/C][C]1.47[/C][C]1.53[/C][/ROW]
[C]14[/C][C]0.98[/C][C]1.02[/C][/ROW]
[C]15[/C][C]5.38[/C][C]5.62[/C][/ROW]
[C]16[/C][C]7.34[/C][C]7.66[/C][/ROW]
[C]17[/C][C]5.87[/C][C]6.13[/C][/ROW]
[C]18[/C][C]9.78[/C][C]10.22[/C][/ROW]
[C]19[/C][C]14.19[/C][C]14.81[/C][/ROW]
[C]20[/C][C]14.19[/C][C]14.81[/C][/ROW]
[C]21[/C][C]8.32[/C][C]8.68[/C][/ROW]
[C]22[/C][C]11.25[/C][C]11.75[/C][/ROW]
[C]23[/C][C]16.14[/C][C]16.86[/C][/ROW]
[C]24[/C][C]8.81[/C][C]9.19[/C][/ROW]
[C]25[/C][C]8.81[/C][C]9.19[/C][/ROW]
[C]26[/C][C]2.94[/C][C]3.06[/C][/ROW]
[C]27[/C][C]3.91[/C][C]4.09[/C][/ROW]
[C]28[/C][C]2.45[/C][C]2.55[/C][/ROW]
[C]29[/C][C]1.96[/C][C]2.04[/C][/ROW]
[C]30[/C][C]1.47[/C][C]1.53[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=317598&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=317598&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Tabulation of Expected Results
NUMERACYTOT x group
01
00.490.51
20.490.51
30.981.02
41.471.53
70.490.51
81.471.53
90.490.51
101.962.04
110.981.02
121.962.04
131.471.53
140.981.02
155.385.62
167.347.66
175.876.13
189.7810.22
1914.1914.81
2014.1914.81
218.328.68
2211.2511.75
2316.1416.86
248.819.19
258.819.19
262.943.06
273.914.09
282.452.55
291.962.04
301.471.53







Statistical Results
Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
Exact Pearson Chi Square Statistic37.35
P value0.06

\begin{tabular}{lllllllll}
\hline
Statistical Results \tabularnewline
Pearson's Chi-squared test with simulated p-value
	 (based on 2000 replicates) \tabularnewline
Exact Pearson Chi Square Statistic & 37.35 \tabularnewline
P value & 0.06 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=317598&T=3

[TABLE]
[ROW][C]Statistical Results[/C][/ROW]
[ROW][C]Pearson's Chi-squared test with simulated p-value
	 (based on 2000 replicates)[/C][/ROW]
[ROW][C]Exact Pearson Chi Square Statistic[/C][C]37.35[/C][/ROW]
[ROW][C]P value[/C][C]0.06[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=317598&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=317598&T=3

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Statistical Results
Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
Exact Pearson Chi Square Statistic37.35
P value0.06



Parameters (Session):
par1 = 1 ; par2 = 2 ; par3 = 3 ; par4 = TRUE ;
Parameters (R input):
par1 = 1 ; par2 = 2 ; par3 = Exact Pearson Chi-Squared by Simulation ;
R code (references can be found in the software module):
library(vcd)
cat1 <- as.numeric(par1) #
cat2<- as.numeric(par2) #
simulate.p.value=FALSE
if (par3 == 'Exact Pearson Chi-Squared by Simulation') simulate.p.value=TRUE
x <- t(x)
(z <- array(unlist(x),dim=c(length(x[,1]),length(x[1,]))))
(table1 <- table(z[,cat1],z[,cat2]))
(V1<-dimnames(y)[[1]][cat1])
(V2<-dimnames(y)[[1]][cat2])
bitmap(file='pic1.png')
assoc(ftable(z[,cat1],z[,cat2],row.vars=1,dnn=c(V1,V2)),shade=T)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Tabulation of Results',ncol(table1)+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,paste(V1,' x ', V2),ncol(table1)+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, ' ', 1,TRUE)
for(nc in 1:ncol(table1)){
a<-table.element(a, colnames(table1)[nc], 1, TRUE)
}
a<-table.row.end(a)
for(nr in 1:nrow(table1) ){
a<-table.element(a, rownames(table1)[nr], 1, TRUE)
for(nc in 1:ncol(table1) ){
a<-table.element(a, table1[nr, nc], 1, FALSE)
}
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
(cst<-chisq.test(table1, simulate.p.value=simulate.p.value) )
if (par3 == 'McNemar Chi-Squared') {
(cst <- mcnemar.test(table1))
}
if (par3=='Fisher Exact Test') {
(cst <- fisher.test(table1))
}
if ((par3 != 'McNemar Chi-Squared') & (par3 != 'Fisher Exact Test')) {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Tabulation of Expected Results',ncol(table1)+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,paste(V1,' x ', V2),ncol(table1)+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, ' ', 1,TRUE)
for(nc in 1:ncol(table1)){
a<-table.element(a, colnames(table1)[nc], 1, TRUE)
}
a<-table.row.end(a)
for(nr in 1:nrow(table1) ){
a<-table.element(a, rownames(table1)[nr], 1, TRUE)
for(nc in 1:ncol(table1) ){
a<-table.element(a, round(cst$expected[nr, nc], digits=2), 1, FALSE)
}
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')
}
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Statistical Results',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, cst$method, 2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
if (par3=='Pearson Chi-Squared') a<-table.element(a, 'Pearson Chi Square Statistic', 1, TRUE)
if (par3=='Exact Pearson Chi-Squared by Simulation') a<-table.element(a, 'Exact Pearson Chi Square Statistic', 1, TRUE)
if (par3=='McNemar Chi-Squared') a<-table.element(a, 'McNemar Chi Square Statistic', 1, TRUE)
if (par3=='Fisher Exact Test') a<-table.element(a, 'Odds Ratio', 1, TRUE)
if (par3=='Fisher Exact Test') {
if ((ncol(table1) == 2) & (nrow(table1) == 2)) {
a<-table.element(a, round(cst$estimate, digits=2), 1,FALSE)
} else {
a<-table.element(a, '--', 1,FALSE)
}
} else {
a<-table.element(a, round(cst$statistic, digits=2), 1,FALSE)
}
a<-table.row.end(a)
if(!simulate.p.value){
if(par3!='Fisher Exact Test') {
a<-table.row.start(a)
a<-table.element(a, 'Degrees of Freedom', 1, TRUE)
a<-table.element(a, cst$parameter, 1,FALSE)
a<-table.row.end(a)
}
}
a<-table.row.start(a)
a<-table.element(a, 'P value', 1, TRUE)
a<-table.element(a, round(cst$p.value, digits=2), 1,FALSE)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable2.tab')