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, 12 Dec 2014 15:05:09 +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/12/t1418396950qs4yur7kb9v4m1v.htm/, Retrieved Thu, 16 May 2024 11:42:18 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=266773, Retrieved Thu, 16 May 2024 11:42:18 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact78
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] [Chi Squared Tot S...] [2014-12-12 15:05:09] [3bdd9332f2b4587684e97c4d9c2e2a73] [Current]
Feedback Forum

Post a new message
Dataseries X:
12	13
11	13
13	11
11	14
10	15
7	14
10	11
15	13
12	16
12	14
10	14
10	15
14	15
6	13
12	14
14	11
11	12
8	14
12	13
15	12
13	15
11	15
12	14
7	14
11	12
7	12
12	12
12	15
13	14
9	16
11	12
12	12
12	14
6	16
5	15
13	12
11	14
6	13
12	14
10	16
6	12
12	14
11	15
6	13
12	16
12	16
8	12
10	12
11	16
7	12
12	15
13	12
14	13
12	12
6	14
14	14
10	11
12	10
11	12
10	11
7	16
12	14
7	14
12	15
12	15
10	14
10	13
12	11
12	16
12	12
8	15
10	14
5	15
12	13
11	6
9	12
12	12
11	14
10	14
12	15
10	11
9	13
11	14
12	16
7	13
11	14
12	16
6	11
9	13
15	13
10	15
11	12
12	13
12	12
12	14
11	14
9	16
11	15
12	14
12	13
14	14
8	15
10	14
9	12
10	7
9	12
10	15
12	12
11	13
9	11
11	14
12	13




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R Server'Herman Ole Andreas Wold' @ wold.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 & 2 seconds \tabularnewline
R Server & 'Herman Ole Andreas Wold' @ wold.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=266773&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]2 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Herman Ole Andreas Wold' @ wold.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=266773&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266773&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 time2 seconds
R Server'Herman Ole Andreas Wold' @ wold.wessa.net







Tabulation of Results
C x S
6710111213141516
5000000020
6000113101
7000021301
8000010120
9000132002
10010411541
11100052731
12001176956
13000120110
14000101210
15000012000

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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266773&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
C x S
6710111213141516
5000000020
6000113101
7000021301
8000010120
9000132002
10010411541
11100052731
12001176956
13000120110
14000101210
15000012000







Tabulation of Expected Results
C x S
6710111213141516
50.020.020.020.160.410.320.520.320.21
60.060.060.060.561.441.121.811.120.75
70.060.060.060.561.441.121.811.120.75
80.040.040.040.320.820.641.040.640.43
90.070.070.070.641.641.292.071.290.86
100.150.150.151.373.492.734.42.731.82
110.170.170.171.533.93.054.923.052.04
120.310.310.312.817.195.629.065.623.75
130.040.040.040.41.030.81.290.80.54
140.040.040.040.41.030.81.290.80.54
150.030.030.030.240.620.480.780.480.32

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
C  x  S \tabularnewline
  & 6 & 7 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \tabularnewline
5 & 0.02 & 0.02 & 0.02 & 0.16 & 0.41 & 0.32 & 0.52 & 0.32 & 0.21 \tabularnewline
6 & 0.06 & 0.06 & 0.06 & 0.56 & 1.44 & 1.12 & 1.81 & 1.12 & 0.75 \tabularnewline
7 & 0.06 & 0.06 & 0.06 & 0.56 & 1.44 & 1.12 & 1.81 & 1.12 & 0.75 \tabularnewline
8 & 0.04 & 0.04 & 0.04 & 0.32 & 0.82 & 0.64 & 1.04 & 0.64 & 0.43 \tabularnewline
9 & 0.07 & 0.07 & 0.07 & 0.64 & 1.64 & 1.29 & 2.07 & 1.29 & 0.86 \tabularnewline
10 & 0.15 & 0.15 & 0.15 & 1.37 & 3.49 & 2.73 & 4.4 & 2.73 & 1.82 \tabularnewline
11 & 0.17 & 0.17 & 0.17 & 1.53 & 3.9 & 3.05 & 4.92 & 3.05 & 2.04 \tabularnewline
12 & 0.31 & 0.31 & 0.31 & 2.81 & 7.19 & 5.62 & 9.06 & 5.62 & 3.75 \tabularnewline
13 & 0.04 & 0.04 & 0.04 & 0.4 & 1.03 & 0.8 & 1.29 & 0.8 & 0.54 \tabularnewline
14 & 0.04 & 0.04 & 0.04 & 0.4 & 1.03 & 0.8 & 1.29 & 0.8 & 0.54 \tabularnewline
15 & 0.03 & 0.03 & 0.03 & 0.24 & 0.62 & 0.48 & 0.78 & 0.48 & 0.32 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=266773&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]C  x  S[/C][/ROW]
[ROW][C] [/C][C]6[/C][C]7[/C][C]10[/C][C]11[/C][C]12[/C][C]13[/C][C]14[/C][C]15[/C][C]16[/C][/ROW]
[C]5[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.16[/C][C]0.41[/C][C]0.32[/C][C]0.52[/C][C]0.32[/C][C]0.21[/C][/ROW]
[C]6[/C][C]0.06[/C][C]0.06[/C][C]0.06[/C][C]0.56[/C][C]1.44[/C][C]1.12[/C][C]1.81[/C][C]1.12[/C][C]0.75[/C][/ROW]
[C]7[/C][C]0.06[/C][C]0.06[/C][C]0.06[/C][C]0.56[/C][C]1.44[/C][C]1.12[/C][C]1.81[/C][C]1.12[/C][C]0.75[/C][/ROW]
[C]8[/C][C]0.04[/C][C]0.04[/C][C]0.04[/C][C]0.32[/C][C]0.82[/C][C]0.64[/C][C]1.04[/C][C]0.64[/C][C]0.43[/C][/ROW]
[C]9[/C][C]0.07[/C][C]0.07[/C][C]0.07[/C][C]0.64[/C][C]1.64[/C][C]1.29[/C][C]2.07[/C][C]1.29[/C][C]0.86[/C][/ROW]
[C]10[/C][C]0.15[/C][C]0.15[/C][C]0.15[/C][C]1.37[/C][C]3.49[/C][C]2.73[/C][C]4.4[/C][C]2.73[/C][C]1.82[/C][/ROW]
[C]11[/C][C]0.17[/C][C]0.17[/C][C]0.17[/C][C]1.53[/C][C]3.9[/C][C]3.05[/C][C]4.92[/C][C]3.05[/C][C]2.04[/C][/ROW]
[C]12[/C][C]0.31[/C][C]0.31[/C][C]0.31[/C][C]2.81[/C][C]7.19[/C][C]5.62[/C][C]9.06[/C][C]5.62[/C][C]3.75[/C][/ROW]
[C]13[/C][C]0.04[/C][C]0.04[/C][C]0.04[/C][C]0.4[/C][C]1.03[/C][C]0.8[/C][C]1.29[/C][C]0.8[/C][C]0.54[/C][/ROW]
[C]14[/C][C]0.04[/C][C]0.04[/C][C]0.04[/C][C]0.4[/C][C]1.03[/C][C]0.8[/C][C]1.29[/C][C]0.8[/C][C]0.54[/C][/ROW]
[C]15[/C][C]0.03[/C][C]0.03[/C][C]0.03[/C][C]0.24[/C][C]0.62[/C][C]0.48[/C][C]0.78[/C][C]0.48[/C][C]0.32[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=266773&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266773&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
C x S
6710111213141516
50.020.020.020.160.410.320.520.320.21
60.060.060.060.561.441.121.811.120.75
70.060.060.060.561.441.121.811.120.75
80.040.040.040.320.820.641.040.640.43
90.070.070.070.641.641.292.071.290.86
100.150.150.151.373.492.734.42.731.82
110.170.170.171.533.93.054.923.052.04
120.310.310.312.817.195.629.065.623.75
130.040.040.040.41.030.81.290.80.54
140.040.040.040.41.030.81.290.80.54
150.030.030.030.240.620.480.780.480.32







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic70.18
Degrees of Freedom80
P value0.78

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266773&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 Statistic70.18
Degrees of Freedom80
P value0.78



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')