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 computationSun, 20 Jan 2019 15:04:57 +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/20/t1547993117f7u77d6hz93753o.htm/, Retrieved Fri, 03 May 2024 14:25:38 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=316475, Retrieved Fri, 03 May 2024 14:25:38 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact28
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-20 14:04:57] [8aefb0ce5982b02eeb5bb0c046fe0171] [Current]
Feedback Forum

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




Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time3 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 time3 seconds \tabularnewline
R ServerBig Analytics Cloud Computing Center \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=316475&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]3 seconds[/C][/ROW] [ROW]R Server[/C]Big Analytics Cloud Computing Center[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=316475&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316475&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 time3 seconds
R ServerBig Analytics Cloud Computing Center







Tabulation of Results
NUMERACYTOT x gender
01
010
210
302
421
710
821
901
1022
1111
1231
1321
1411
1556
1696
1766
18137
191415
20920
21710
22149
23726
24414
25513
2633
2744
2823
2913
3012

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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316475&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 gender
01
010
210
302
421
710
821
901
1022
1111
1231
1321
1411
1556
1696
1766
18137
191415
20920
21710
22149
23726
24414
25513
2633
2744
2823
2913
3012







Tabulation of Expected Results
NUMERACYTOT x gender
01
00.430.57
20.430.57
30.861.14
41.291.71
70.430.57
81.291.71
90.430.57
101.732.27
110.861.14
121.732.27
131.291.71
140.861.14
154.756.25
166.478.53
175.186.82
188.6311.37
1912.5216.48
2012.5216.48
217.349.66
229.9313.07
2314.2418.76
247.7710.23
257.7710.23
262.593.41
273.454.55
282.162.84
291.732.27
301.291.71

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
NUMERACYTOT  x  gender \tabularnewline
  & 0 & 1 \tabularnewline
0 & 0.43 & 0.57 \tabularnewline
2 & 0.43 & 0.57 \tabularnewline
3 & 0.86 & 1.14 \tabularnewline
4 & 1.29 & 1.71 \tabularnewline
7 & 0.43 & 0.57 \tabularnewline
8 & 1.29 & 1.71 \tabularnewline
9 & 0.43 & 0.57 \tabularnewline
10 & 1.73 & 2.27 \tabularnewline
11 & 0.86 & 1.14 \tabularnewline
12 & 1.73 & 2.27 \tabularnewline
13 & 1.29 & 1.71 \tabularnewline
14 & 0.86 & 1.14 \tabularnewline
15 & 4.75 & 6.25 \tabularnewline
16 & 6.47 & 8.53 \tabularnewline
17 & 5.18 & 6.82 \tabularnewline
18 & 8.63 & 11.37 \tabularnewline
19 & 12.52 & 16.48 \tabularnewline
20 & 12.52 & 16.48 \tabularnewline
21 & 7.34 & 9.66 \tabularnewline
22 & 9.93 & 13.07 \tabularnewline
23 & 14.24 & 18.76 \tabularnewline
24 & 7.77 & 10.23 \tabularnewline
25 & 7.77 & 10.23 \tabularnewline
26 & 2.59 & 3.41 \tabularnewline
27 & 3.45 & 4.55 \tabularnewline
28 & 2.16 & 2.84 \tabularnewline
29 & 1.73 & 2.27 \tabularnewline
30 & 1.29 & 1.71 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=316475&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]NUMERACYTOT  x  gender[/C][/ROW]
[ROW][C] [/C][C]0[/C][C]1[/C][/ROW]
[C]0[/C][C]0.43[/C][C]0.57[/C][/ROW]
[C]2[/C][C]0.43[/C][C]0.57[/C][/ROW]
[C]3[/C][C]0.86[/C][C]1.14[/C][/ROW]
[C]4[/C][C]1.29[/C][C]1.71[/C][/ROW]
[C]7[/C][C]0.43[/C][C]0.57[/C][/ROW]
[C]8[/C][C]1.29[/C][C]1.71[/C][/ROW]
[C]9[/C][C]0.43[/C][C]0.57[/C][/ROW]
[C]10[/C][C]1.73[/C][C]2.27[/C][/ROW]
[C]11[/C][C]0.86[/C][C]1.14[/C][/ROW]
[C]12[/C][C]1.73[/C][C]2.27[/C][/ROW]
[C]13[/C][C]1.29[/C][C]1.71[/C][/ROW]
[C]14[/C][C]0.86[/C][C]1.14[/C][/ROW]
[C]15[/C][C]4.75[/C][C]6.25[/C][/ROW]
[C]16[/C][C]6.47[/C][C]8.53[/C][/ROW]
[C]17[/C][C]5.18[/C][C]6.82[/C][/ROW]
[C]18[/C][C]8.63[/C][C]11.37[/C][/ROW]
[C]19[/C][C]12.52[/C][C]16.48[/C][/ROW]
[C]20[/C][C]12.52[/C][C]16.48[/C][/ROW]
[C]21[/C][C]7.34[/C][C]9.66[/C][/ROW]
[C]22[/C][C]9.93[/C][C]13.07[/C][/ROW]
[C]23[/C][C]14.24[/C][C]18.76[/C][/ROW]
[C]24[/C][C]7.77[/C][C]10.23[/C][/ROW]
[C]25[/C][C]7.77[/C][C]10.23[/C][/ROW]
[C]26[/C][C]2.59[/C][C]3.41[/C][/ROW]
[C]27[/C][C]3.45[/C][C]4.55[/C][/ROW]
[C]28[/C][C]2.16[/C][C]2.84[/C][/ROW]
[C]29[/C][C]1.73[/C][C]2.27[/C][/ROW]
[C]30[/C][C]1.29[/C][C]1.71[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=316475&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316475&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 gender
01
00.430.57
20.430.57
30.861.14
41.291.71
70.430.57
81.291.71
90.430.57
101.732.27
110.861.14
121.732.27
131.291.71
140.861.14
154.756.25
166.478.53
175.186.82
188.6311.37
1912.5216.48
2012.5216.48
217.349.66
229.9313.07
2314.2418.76
247.7710.23
257.7710.23
262.593.41
273.454.55
282.162.84
291.732.27
301.291.71







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic33.33
Degrees of Freedom27
P value0.19

\begin{tabular}{lllllllll}
\hline
Statistical Results \tabularnewline
Pearson's Chi-squared test \tabularnewline
Pearson Chi Square Statistic & 33.33 \tabularnewline
Degrees of Freedom & 27 \tabularnewline
P value & 0.19 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=316475&T=3

[TABLE]
[ROW][C]Statistical Results[/C][/ROW]
[ROW][C]Pearson's Chi-squared test[/C][/ROW]
[ROW][C]Pearson Chi Square Statistic[/C][C]33.33[/C][/ROW]
[ROW][C]Degrees of Freedom[/C][C]27[/C][/ROW]
[ROW][C]P value[/C][C]0.19[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=316475&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316475&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
Pearson Chi Square Statistic33.33
Degrees of Freedom27
P value0.19



Parameters (Session):
par1 = 1 ; par2 = 2 ; par3 = Pearson Chi-Squared ;
Parameters (R input):
par1 = 1 ; par2 = 2 ; par3 = Pearson Chi-Squared ;
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')