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 computationWed, 17 Dec 2014 13:24:45 +0000
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2014/Dec/17/t14188227222f70zjpwws7p1kr.htm/, Retrieved Sun, 19 May 2024 17:14:46 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=270207, Retrieved Sun, 19 May 2024 17:14:46 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact53
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] [] [2014-12-17 13:24:45] [648c1440f05bd644df5068f7a7b787c0] [Current]
Feedback Forum

Post a new message
Dataseries X:
21	1	0
26	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
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
26	1	1
14	1	0
28	1	1
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
14	1	0
23	1	0
20	1	0
15	1	1
13	1	0
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
16	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
14	1	0
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
23	1	1
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 Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 1 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ jenkins.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=270207&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]1 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gwilym Jenkins' @ jenkins.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=270207&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=270207&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 Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net







Tabulation of Results
Numeracy x Course
01
010
210
302
412
701
830
901
1031
1111
1222
1322
1413
1565
16313
1784
18119
19920
201613
2198
22149
231123
24810
25811
2653
2753
2833
2931
3030

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline
Numeracy  x  Course \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 & 2 \tabularnewline
14 & 1 & 3 \tabularnewline
15 & 6 & 5 \tabularnewline
16 & 3 & 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 & 23 \tabularnewline
24 & 8 & 10 \tabularnewline
25 & 8 & 11 \tabularnewline
26 & 5 & 3 \tabularnewline
27 & 5 & 3 \tabularnewline
28 & 3 & 3 \tabularnewline
29 & 3 & 1 \tabularnewline
30 & 3 & 0 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=270207&T=1

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]Numeracy  x  Course[/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]2[/C][/ROW]
[C]14[/C][C]1[/C][C]3[/C][/ROW]
[C]15[/C][C]6[/C][C]5[/C][/ROW]
[C]16[/C][C]3[/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]23[/C][/ROW]
[C]24[/C][C]8[/C][C]10[/C][/ROW]
[C]25[/C][C]8[/C][C]11[/C][/ROW]
[C]26[/C][C]5[/C][C]3[/C][/ROW]
[C]27[/C][C]5[/C][C]3[/C][/ROW]
[C]28[/C][C]3[/C][C]3[/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=270207&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=270207&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
Numeracy x Course
01
010
210
302
412
701
830
901
1031
1111
1222
1322
1413
1565
16313
1784
18119
19920
201613
2198
22149
231123
24810
25811
2653
2753
2833
2931
3030







Tabulation of Expected Results
Numeracy x Course
01
00.480.52
20.480.52
30.951.05
41.431.57
70.480.52
81.431.57
90.480.52
101.912.09
110.951.05
121.912.09
131.912.09
141.912.09
155.255.75
167.648.36
175.736.27
189.5510.45
1913.8415.16
2013.8415.16
218.118.89
2210.9812.02
2316.2317.77
248.599.41
259.079.93
263.824.18
273.824.18
282.863.14
291.912.09
301.431.57

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
Numeracy  x  Course \tabularnewline
  & 0 & 1 \tabularnewline
0 & 0.48 & 0.52 \tabularnewline
2 & 0.48 & 0.52 \tabularnewline
3 & 0.95 & 1.05 \tabularnewline
4 & 1.43 & 1.57 \tabularnewline
7 & 0.48 & 0.52 \tabularnewline
8 & 1.43 & 1.57 \tabularnewline
9 & 0.48 & 0.52 \tabularnewline
10 & 1.91 & 2.09 \tabularnewline
11 & 0.95 & 1.05 \tabularnewline
12 & 1.91 & 2.09 \tabularnewline
13 & 1.91 & 2.09 \tabularnewline
14 & 1.91 & 2.09 \tabularnewline
15 & 5.25 & 5.75 \tabularnewline
16 & 7.64 & 8.36 \tabularnewline
17 & 5.73 & 6.27 \tabularnewline
18 & 9.55 & 10.45 \tabularnewline
19 & 13.84 & 15.16 \tabularnewline
20 & 13.84 & 15.16 \tabularnewline
21 & 8.11 & 8.89 \tabularnewline
22 & 10.98 & 12.02 \tabularnewline
23 & 16.23 & 17.77 \tabularnewline
24 & 8.59 & 9.41 \tabularnewline
25 & 9.07 & 9.93 \tabularnewline
26 & 3.82 & 4.18 \tabularnewline
27 & 3.82 & 4.18 \tabularnewline
28 & 2.86 & 3.14 \tabularnewline
29 & 1.91 & 2.09 \tabularnewline
30 & 1.43 & 1.57 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=270207&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]Numeracy  x  Course[/C][/ROW]
[ROW][C] [/C][C]0[/C][C]1[/C][/ROW]
[C]0[/C][C]0.48[/C][C]0.52[/C][/ROW]
[C]2[/C][C]0.48[/C][C]0.52[/C][/ROW]
[C]3[/C][C]0.95[/C][C]1.05[/C][/ROW]
[C]4[/C][C]1.43[/C][C]1.57[/C][/ROW]
[C]7[/C][C]0.48[/C][C]0.52[/C][/ROW]
[C]8[/C][C]1.43[/C][C]1.57[/C][/ROW]
[C]9[/C][C]0.48[/C][C]0.52[/C][/ROW]
[C]10[/C][C]1.91[/C][C]2.09[/C][/ROW]
[C]11[/C][C]0.95[/C][C]1.05[/C][/ROW]
[C]12[/C][C]1.91[/C][C]2.09[/C][/ROW]
[C]13[/C][C]1.91[/C][C]2.09[/C][/ROW]
[C]14[/C][C]1.91[/C][C]2.09[/C][/ROW]
[C]15[/C][C]5.25[/C][C]5.75[/C][/ROW]
[C]16[/C][C]7.64[/C][C]8.36[/C][/ROW]
[C]17[/C][C]5.73[/C][C]6.27[/C][/ROW]
[C]18[/C][C]9.55[/C][C]10.45[/C][/ROW]
[C]19[/C][C]13.84[/C][C]15.16[/C][/ROW]
[C]20[/C][C]13.84[/C][C]15.16[/C][/ROW]
[C]21[/C][C]8.11[/C][C]8.89[/C][/ROW]
[C]22[/C][C]10.98[/C][C]12.02[/C][/ROW]
[C]23[/C][C]16.23[/C][C]17.77[/C][/ROW]
[C]24[/C][C]8.59[/C][C]9.41[/C][/ROW]
[C]25[/C][C]9.07[/C][C]9.93[/C][/ROW]
[C]26[/C][C]3.82[/C][C]4.18[/C][/ROW]
[C]27[/C][C]3.82[/C][C]4.18[/C][/ROW]
[C]28[/C][C]2.86[/C][C]3.14[/C][/ROW]
[C]29[/C][C]1.91[/C][C]2.09[/C][/ROW]
[C]30[/C][C]1.43[/C][C]1.57[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=270207&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=270207&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
Numeracy x Course
01
00.480.52
20.480.52
30.951.05
41.431.57
70.480.52
81.431.57
90.480.52
101.912.09
110.951.05
121.912.09
131.912.09
141.912.09
155.255.75
167.648.36
175.736.27
189.5510.45
1913.8415.16
2013.8415.16
218.118.89
2210.9812.02
2316.2317.77
248.599.41
259.079.93
263.824.18
273.824.18
282.863.14
291.912.09
301.431.57







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic34.25
Degrees of Freedom27
P value0.16

\begin{tabular}{lllllllll}
\hline
Statistical Results \tabularnewline
Pearson's Chi-squared test \tabularnewline
Pearson Chi Square Statistic & 34.25 \tabularnewline
Degrees of Freedom & 27 \tabularnewline
P value & 0.16 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=270207&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]34.25[/C][/ROW]
[ROW][C]Degrees of Freedom[/C][C]27[/C][/ROW]
[ROW][C]P value[/C][C]0.16[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=270207&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=270207&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 Statistic34.25
Degrees of Freedom27
P value0.16



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):
par3 <- 'Pearson Chi-Squared'
par2 <- '3'
par1 <- '2'
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')