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, 10 Dec 2014 11:14:19 +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/10/t14182105493uc4xfnutqrbeeu.htm/, Retrieved Sun, 19 May 2024 15:27:37 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=264928, Retrieved Sun, 19 May 2024 15:27:37 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact59
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-10 11:14:19] [83f8f1d217ef29583e8b7cd372ece6b5] [Current]
Feedback Forum

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




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=264928&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'Gwilym Jenkins' @ jenkins.wessa.net







Tabulation of Results
year x NUMERACYTOT
0234789101112131415161718192021222324252627282930
20110000031213125541014111210126421111
2012112310021120610810151851321121447432

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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=264928&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
year x NUMERACYTOT
0234789101112131415161718192021222324252627282930
20110000031213125541014111210126421111
2012112310021120610810151851321121447432







Tabulation of Expected Results
year x NUMERACYTOT
0234789101112131415161718192021222324252627282930
20110.40.40.811.210.41.210.41.610.811.611.210.814.436.044.838.0611.6811.686.859.2713.297.257.252.423.222.011.611.21
20120.60.61.191.790.61.790.62.391.192.391.791.196.578.967.1711.9417.3217.3210.1513.7319.7110.7510.753.584.782.992.391.79

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
year  x  NUMERACYTOT \tabularnewline
  & 0 & 2 & 3 & 4 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 & 29 & 30 \tabularnewline
2011 & 0.4 & 0.4 & 0.81 & 1.21 & 0.4 & 1.21 & 0.4 & 1.61 & 0.81 & 1.61 & 1.21 & 0.81 & 4.43 & 6.04 & 4.83 & 8.06 & 11.68 & 11.68 & 6.85 & 9.27 & 13.29 & 7.25 & 7.25 & 2.42 & 3.22 & 2.01 & 1.61 & 1.21 \tabularnewline
2012 & 0.6 & 0.6 & 1.19 & 1.79 & 0.6 & 1.79 & 0.6 & 2.39 & 1.19 & 2.39 & 1.79 & 1.19 & 6.57 & 8.96 & 7.17 & 11.94 & 17.32 & 17.32 & 10.15 & 13.73 & 19.71 & 10.75 & 10.75 & 3.58 & 4.78 & 2.99 & 2.39 & 1.79 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=264928&T=2

[TABLE]
[ROW]Tabulation of Expected Results[/C][/ROW]
[ROW]year  x  NUMERACYTOT[/C][/ROW]
[ROW][C] [/C][C]0[/C][C]2[/C][C]3[/C][C]4[/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][C]16[/C][C]17[/C][C]18[/C][C]19[/C][C]20[/C][C]21[/C][C]22[/C][C]23[/C][C]24[/C][C]25[/C][C]26[/C][C]27[/C][C]28[/C][C]29[/C][C]30[/C][/ROW]
[C]2011[/C][C]0.4[/C][C]0.4[/C][C]0.81[/C][C]1.21[/C][C]0.4[/C][C]1.21[/C][C]0.4[/C][C]1.61[/C][C]0.81[/C][C]1.61[/C][C]1.21[/C][C]0.81[/C][C]4.43[/C][C]6.04[/C][C]4.83[/C][C]8.06[/C][C]11.68[/C][C]11.68[/C][C]6.85[/C][C]9.27[/C][C]13.29[/C][C]7.25[/C][C]7.25[/C][C]2.42[/C][C]3.22[/C][C]2.01[/C][C]1.61[/C][C]1.21[/C][/ROW]
[C]2012[/C][C]0.6[/C][C]0.6[/C][C]1.19[/C][C]1.79[/C][C]0.6[/C][C]1.79[/C][C]0.6[/C][C]2.39[/C][C]1.19[/C][C]2.39[/C][C]1.79[/C][C]1.19[/C][C]6.57[/C][C]8.96[/C][C]7.17[/C][C]11.94[/C][C]17.32[/C][C]17.32[/C][C]10.15[/C][C]13.73[/C][C]19.71[/C][C]10.75[/C][C]10.75[/C][C]3.58[/C][C]4.78[/C][C]2.99[/C][C]2.39[/C][C]1.79[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=264928&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=264928&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
year x NUMERACYTOT
0234789101112131415161718192021222324252627282930
20110.40.40.811.210.41.210.41.610.811.611.210.814.436.044.838.0611.6811.686.859.2713.297.257.252.423.222.011.611.21
20120.60.61.191.790.61.790.62.391.192.391.791.196.578.967.1711.9417.3217.3210.1513.7319.7110.7510.753.584.782.992.391.79







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic32.47
Degrees of Freedom27
P value0.22

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

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



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