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 computationFri, 11 Dec 2015 12:21:59 +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/2015/Dec/11/t1449837009ut708sxvuaacun1.htm/, Retrieved Thu, 16 May 2024 18:45:33 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=285912, Retrieved Thu, 16 May 2024 18:45:33 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact74
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] [] [2015-12-11 12:21:59] [b4712dc468fc78917cdf7a5954f8e48b] [Current]
Feedback Forum

Post a new message
Dataseries X:
1	1
1	2
1	2
1	2
1	2
1	3
1	3
1	3
1	3
1	3
1	3
1	4
1	5
1	5
1	5
1	5
1	5
1	5
1	5
1	5
1	6
1	6
1	6
1	7
1	7
1	7
1	7
1	7
1	7
1	7
1	7
1	8
1	8
1	8
1	8
1	8
1	8
1	8
1	9
1	9
1	9
1	9
1	9
1	9
1	9
1	10
1	10
1	10
1	10
1	11
1	11
1	11
1	11
1	11
1	11
1	12
1	12
1	13
1	13
1	13
1	13
1	13
1	14
1	14
1	15
1	15
1	15
1	15
1	15
2	1
2	1
2	1
2	1
2	1
2	2
2	2
2	2
2	2
2	2
2	3
2	4
2	4
2	4
2	4
2	4
2	4
2	4
2	5
2	5
2	6
2	6
2	6
2	6
2	7
2	8
2	8
2	9
2	9
2	10
2	10
2	10
2	10
2	10
2	11
2	11
2	11
2	12
2	12
2	12
2	12
2	12
2	12
2	12
2	13
2	13
2	13
2	13
2	13
2	13
2	14
2	14
2	14
2	14
2	14
2	14
2	14
2	14
2	14
2	15
2	15
2	15
2	15
3	1
3	1
3	1
3	1
3	2
3	3
3	3
3	3
3	3
3	3
3	5
3	5
3	6
3	6
3	6
3	7
3	8
3	8
3	3
3	3
3	3
3	10
3	10
3	11
3	12
3	12
3	13
3	14
3	14
3	15
4	1
4	2
4	4
4	4
4	4
4	4
4	4
4	4
4	5
4	5
4	5
4	6
4	6
4	6
4	7
4	7
4	8
4	9
4	9
4	9
4	10
4	12
4	12
4	12
4	13
4	14
4	14
4	15
5	2
5	2
5	5
5	6
5	6
5	6
5	6
5	7
5	8
5	8
5	8
5	8
5	8
5	8
5	9
5	10
5	10
5	11
5	11
5	11
5	11
5	11
5	12
5	13
5	13
5	14
5	14
5	15
5	15
6	1
6	1
6	1
6	1
6	1
6	1
6	1
6	1
6	1
6	2
6	2
6	2
6	2
6	2
6	3
6	3
6	3
6	3
6	3
6	3
6	3
6	4
6	4
6	4
6	4
6	4
6	4
6	5
6	5
6	5
6	5
6	5
6	6
6	6
6	6
6	7
6	7
6	7
6	7
6	7
6	7
6	8
6	8
6	9
6	9
6	9
6	10
6	10
6	10
6	10
6	10
6	10
6	10
6	11
6	11
6	11
6	11
6	12
6	12
6	12
6	12
6	12
6	13
6	13
6	14
6	14
6	15
6	15
6	15
6	15
6	15




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=285912&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=285912&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=285912&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
Kleur x Zakje
123456789101112131415
1146183877462525
2551724122537694
3418023120212121
4110633213103121
5020014161251222
6957653623745225

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline Kleur x Zakje \tabularnewline & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \tabularnewline 1 & 1 & 4 & 6 & 1 & 8 & 3 & 8 & 7 & 7 & 4 & 6 & 2 & 5 & 2 & 5 \tabularnewline 2 & 5 & 5 & 1 & 7 & 2 & 4 & 1 & 2 & 2 & 5 & 3 & 7 & 6 & 9 & 4 \tabularnewline 3 & 4 & 1 & 8 & 0 & 2 & 3 & 1 & 2 & 0 & 2 & 1 & 2 & 1 & 2 & 1 \tabularnewline 4 & 1 & 1 & 0 & 6 & 3 & 3 & 2 & 1 & 3 & 1 & 0 & 3 & 1 & 2 & 1 \tabularnewline 5 & 0 & 2 & 0 & 0 & 1 & 4 & 1 & 6 & 1 & 2 & 5 & 1 & 2 & 2 & 2 \tabularnewline 6 & 9 & 5 & 7 & 6 & 5 & 3 & 6 & 2 & 3 & 7 & 4 & 5 & 2 & 2 & 5 \tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=285912&T=1

[TABLE]
[ROW]
Tabulation of Results[/C][/ROW] [ROW]Kleur x Zakje[/C][/ROW] [ROW][C] [/C][C]1[/C][C]2[/C][C]3[/C][C]4[/C][C]5[/C][C]6[/C][C]7[/C][C]8[/C][C]9[/C][C]10[/C][C]11[/C][C]12[/C][C]13[/C][C]14[/C][C]15[/C][/ROW] [C]1[/C][C]1[/C][C]4[/C][C]6[/C][C]1[/C][C]8[/C][C]3[/C][C]8[/C][C]7[/C][C]7[/C][C]4[/C][C]6[/C][C]2[/C][C]5[/C][C]2[/C][C]5[/C][/ROW] [C]2[/C][C]5[/C][C]5[/C][C]1[/C][C]7[/C][C]2[/C][C]4[/C][C]1[/C][C]2[/C][C]2[/C][C]5[/C][C]3[/C][C]7[/C][C]6[/C][C]9[/C][C]4[/C][/ROW] [C]3[/C][C]4[/C][C]1[/C][C]8[/C][C]0[/C][C]2[/C][C]3[/C][C]1[/C][C]2[/C][C]0[/C][C]2[/C][C]1[/C][C]2[/C][C]1[/C][C]2[/C][C]1[/C][/ROW] [C]4[/C][C]1[/C][C]1[/C][C]0[/C][C]6[/C][C]3[/C][C]3[/C][C]2[/C][C]1[/C][C]3[/C][C]1[/C][C]0[/C][C]3[/C][C]1[/C][C]2[/C][C]1[/C][/ROW] [C]5[/C][C]0[/C][C]2[/C][C]0[/C][C]0[/C][C]1[/C][C]4[/C][C]1[/C][C]6[/C][C]1[/C][C]2[/C][C]5[/C][C]1[/C][C]2[/C][C]2[/C][C]2[/C][/ROW] [C]6[/C][C]9[/C][C]5[/C][C]7[/C][C]6[/C][C]5[/C][C]3[/C][C]6[/C][C]2[/C][C]3[/C][C]7[/C][C]4[/C][C]5[/C][C]2[/C][C]2[/C][C]5[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=285912&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=285912&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
Kleur x Zakje
123456789101112131415
1146183877462525
2551724122537694
3418023120212121
4110633213103121
5020014161251222
6957653623745225







Tabulation of Expected Results
Kleur x Zakje
123456789101112131415
14.764.285.234.7654.764.524.763.8154.524.764.044.524.28
24.343.914.784.344.564.344.134.343.484.564.134.343.694.133.91
32.071.862.282.072.172.071.972.071.662.171.972.071.761.971.86
41.931.742.121.932.031.931.831.931.542.031.831.931.641.831.74
521.82.222.121.921.62.11.921.71.91.8
64.94.415.394.95.144.94.654.93.925.144.654.94.164.654.41

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline Kleur x Zakje \tabularnewline & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \tabularnewline 1 & 4.76 & 4.28 & 5.23 & 4.76 & 5 & 4.76 & 4.52 & 4.76 & 3.81 & 5 & 4.52 & 4.76 & 4.04 & 4.52 & 4.28 \tabularnewline 2 & 4.34 & 3.91 & 4.78 & 4.34 & 4.56 & 4.34 & 4.13 & 4.34 & 3.48 & 4.56 & 4.13 & 4.34 & 3.69 & 4.13 & 3.91 \tabularnewline 3 & 2.07 & 1.86 & 2.28 & 2.07 & 2.17 & 2.07 & 1.97 & 2.07 & 1.66 & 2.17 & 1.97 & 2.07 & 1.76 & 1.97 & 1.86 \tabularnewline 4 & 1.93 & 1.74 & 2.12 & 1.93 & 2.03 & 1.93 & 1.83 & 1.93 & 1.54 & 2.03 & 1.83 & 1.93 & 1.64 & 1.83 & 1.74 \tabularnewline 5 & 2 & 1.8 & 2.2 & 2 & 2.1 & 2 & 1.9 & 2 & 1.6 & 2.1 & 1.9 & 2 & 1.7 & 1.9 & 1.8 \tabularnewline 6 & 4.9 & 4.41 & 5.39 & 4.9 & 5.14 & 4.9 & 4.65 & 4.9 & 3.92 & 5.14 & 4.65 & 4.9 & 4.16 & 4.65 & 4.41 \tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=285912&T=2

[TABLE]
[ROW]
Tabulation of Expected Results[/C][/ROW] [ROW]Kleur x Zakje[/C][/ROW] [ROW][C] [/C][C]1[/C][C]2[/C][C]3[/C][C]4[/C][C]5[/C][C]6[/C][C]7[/C][C]8[/C][C]9[/C][C]10[/C][C]11[/C][C]12[/C][C]13[/C][C]14[/C][C]15[/C][/ROW] [C]1[/C][C]4.76[/C][C]4.28[/C][C]5.23[/C][C]4.76[/C][C]5[/C][C]4.76[/C][C]4.52[/C][C]4.76[/C][C]3.81[/C][C]5[/C][C]4.52[/C][C]4.76[/C][C]4.04[/C][C]4.52[/C][C]4.28[/C][/ROW] [C]2[/C][C]4.34[/C][C]3.91[/C][C]4.78[/C][C]4.34[/C][C]4.56[/C][C]4.34[/C][C]4.13[/C][C]4.34[/C][C]3.48[/C][C]4.56[/C][C]4.13[/C][C]4.34[/C][C]3.69[/C][C]4.13[/C][C]3.91[/C][/ROW] [C]3[/C][C]2.07[/C][C]1.86[/C][C]2.28[/C][C]2.07[/C][C]2.17[/C][C]2.07[/C][C]1.97[/C][C]2.07[/C][C]1.66[/C][C]2.17[/C][C]1.97[/C][C]2.07[/C][C]1.76[/C][C]1.97[/C][C]1.86[/C][/ROW] [C]4[/C][C]1.93[/C][C]1.74[/C][C]2.12[/C][C]1.93[/C][C]2.03[/C][C]1.93[/C][C]1.83[/C][C]1.93[/C][C]1.54[/C][C]2.03[/C][C]1.83[/C][C]1.93[/C][C]1.64[/C][C]1.83[/C][C]1.74[/C][/ROW] [C]5[/C][C]2[/C][C]1.8[/C][C]2.2[/C][C]2[/C][C]2.1[/C][C]2[/C][C]1.9[/C][C]2[/C][C]1.6[/C][C]2.1[/C][C]1.9[/C][C]2[/C][C]1.7[/C][C]1.9[/C][C]1.8[/C][/ROW] [C]6[/C][C]4.9[/C][C]4.41[/C][C]5.39[/C][C]4.9[/C][C]5.14[/C][C]4.9[/C][C]4.65[/C][C]4.9[/C][C]3.92[/C][C]5.14[/C][C]4.65[/C][C]4.9[/C][C]4.16[/C][C]4.65[/C][C]4.41[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=285912&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=285912&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
Kleur x Zakje
123456789101112131415
14.764.285.234.7654.764.524.763.8154.524.764.044.524.28
24.343.914.784.344.564.344.134.343.484.564.134.343.694.133.91
32.071.862.282.072.172.071.972.071.662.171.972.071.761.971.86
41.931.742.121.932.031.931.831.931.542.031.831.931.641.831.74
521.82.222.121.921.62.11.921.71.91.8
64.94.415.394.95.144.94.654.93.925.144.654.94.164.654.41







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic113.09
Degrees of Freedom70
P value0

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=285912&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 Statistic113.09
Degrees of Freedom70
P value0



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 <- '2'
par1 <- '1'
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')