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, 21 Dec 2016 08:18:51 +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/2016/Dec/21/t14823047956nz3xezrnae2y5e.htm/, Retrieved Fri, 01 Nov 2024 03:41:07 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=301859, Retrieved Fri, 01 Nov 2024 03:41:07 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact109
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] [] [2016-12-21 07:18:51] [33afbfb1be031b32823b544e140562b9] [Current]
Feedback Forum

Post a new message
Dataseries X:
11	14
9	19
12	17
10	17
12	15
12	20
12	15
12	19
12	15
11	15
12	19
12	16
15	20
13	18
12	15
11	14
12	20
9	16
9	16
11	16
12	10
12	19
12	19
11	16
10	15
12	18
12	17
14	19
12	17
12	14
9	19
13	20
13	19
12	16
12	15
12	16
12	18
12	16
10	15
12	17
11	14
13	20
13	19
12	13
13	16
10	16
13	18
11	18
12	16
5	17
11	19
10	16
12	19
15	13
13	16
13	13
12	12
13	17
13	17
11	17
11	16
9	16
12	14
12	16
13	13
14	16
10	14
12	20
8	12
11	18
12	14
12	19
10	18
12	14
12	18
11	15
12	14
13	17
12	19
14	13
10	19
12	18
11	20
13	15
11	15
13	15
12	20
12	15
12	19
13	18
12	18
9	15
12	17
13	12
14	18
11	19
11	20
11	13
12	17
12	16
12	18
12	18
12	14
12	15
10	12
12	17
10	14
9	18
13	17
10	17
10	20
14	16
10	14
12	15
12	18
11	20
14	17
13	17
12	17
12	15
12	17
10	18
12	17
12	20
10	15
12	16
15	18
10	15
12	18
12	20
10	19
12	14
12	16
11	15
12	17
11	18
13	20
9	17
11	18
11	15
13	16
11	11
10	15
9	18
12	17
12	16
14	19
13	18
10	15
13	17
13	19
12	18
12	19
9	16
12	16
11	16
12	14




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

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







Tabulation of Results
GWSUM x ITHSUM
1011121314151617181920
500000001000
800100000000
900000141220
1000103622221
1101013541423
1210118911121096
1300120236433
1400010021120
1500010000101

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

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]GWSUM  x  ITHSUM[/C][/ROW]
[ROW][C] [/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][/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]1[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]8[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]9[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][C]4[/C][C]1[/C][C]2[/C][C]2[/C][C]0[/C][/ROW]
[C]10[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]3[/C][C]6[/C][C]2[/C][C]2[/C][C]2[/C][C]2[/C][C]1[/C][/ROW]
[C]11[/C][C]0[/C][C]1[/C][C]0[/C][C]1[/C][C]3[/C][C]5[/C][C]4[/C][C]1[/C][C]4[/C][C]2[/C][C]3[/C][/ROW]
[C]12[/C][C]1[/C][C]0[/C][C]1[/C][C]1[/C][C]8[/C][C]9[/C][C]11[/C][C]12[/C][C]10[/C][C]9[/C][C]6[/C][/ROW]
[C]13[/C][C]0[/C][C]0[/C][C]1[/C][C]2[/C][C]0[/C][C]2[/C][C]3[/C][C]6[/C][C]4[/C][C]3[/C][C]3[/C][/ROW]
[C]14[/C][C]0[/C][C]0[/C][C]0[/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][/ROW]
[C]15[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]1[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=301859&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=301859&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
GWSUM x ITHSUM
1011121314151617181920
500000001000
800100000000
900000141220
1000103622221
1101013541423
1210118911121096
1300120236433
1400010021120
1500010000101







Tabulation of Expected Results
GWSUM x ITHSUM
1011121314151617181920
50.010.010.030.040.090.150.170.150.150.130.09
80.010.010.030.040.090.150.170.150.150.130.09
90.060.060.250.380.891.461.661.531.531.270.89
100.120.120.480.731.692.783.152.92.92.421.69
110.150.150.610.922.143.523.973.673.673.062.14
120.430.431.732.66.069.9611.2610.3910.398.666.06
130.150.150.610.922.143.523.973.673.673.062.14
140.040.040.180.270.621.031.161.071.070.890.62
150.020.020.080.110.270.440.50.460.460.380.27

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
GWSUM  x  ITHSUM \tabularnewline
  & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \tabularnewline
5 & 0.01 & 0.01 & 0.03 & 0.04 & 0.09 & 0.15 & 0.17 & 0.15 & 0.15 & 0.13 & 0.09 \tabularnewline
8 & 0.01 & 0.01 & 0.03 & 0.04 & 0.09 & 0.15 & 0.17 & 0.15 & 0.15 & 0.13 & 0.09 \tabularnewline
9 & 0.06 & 0.06 & 0.25 & 0.38 & 0.89 & 1.46 & 1.66 & 1.53 & 1.53 & 1.27 & 0.89 \tabularnewline
10 & 0.12 & 0.12 & 0.48 & 0.73 & 1.69 & 2.78 & 3.15 & 2.9 & 2.9 & 2.42 & 1.69 \tabularnewline
11 & 0.15 & 0.15 & 0.61 & 0.92 & 2.14 & 3.52 & 3.97 & 3.67 & 3.67 & 3.06 & 2.14 \tabularnewline
12 & 0.43 & 0.43 & 1.73 & 2.6 & 6.06 & 9.96 & 11.26 & 10.39 & 10.39 & 8.66 & 6.06 \tabularnewline
13 & 0.15 & 0.15 & 0.61 & 0.92 & 2.14 & 3.52 & 3.97 & 3.67 & 3.67 & 3.06 & 2.14 \tabularnewline
14 & 0.04 & 0.04 & 0.18 & 0.27 & 0.62 & 1.03 & 1.16 & 1.07 & 1.07 & 0.89 & 0.62 \tabularnewline
15 & 0.02 & 0.02 & 0.08 & 0.11 & 0.27 & 0.44 & 0.5 & 0.46 & 0.46 & 0.38 & 0.27 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=301859&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]GWSUM  x  ITHSUM[/C][/ROW]
[ROW][C] [/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][/ROW]
[C]5[/C][C]0.01[/C][C]0.01[/C][C]0.03[/C][C]0.04[/C][C]0.09[/C][C]0.15[/C][C]0.17[/C][C]0.15[/C][C]0.15[/C][C]0.13[/C][C]0.09[/C][/ROW]
[C]8[/C][C]0.01[/C][C]0.01[/C][C]0.03[/C][C]0.04[/C][C]0.09[/C][C]0.15[/C][C]0.17[/C][C]0.15[/C][C]0.15[/C][C]0.13[/C][C]0.09[/C][/ROW]
[C]9[/C][C]0.06[/C][C]0.06[/C][C]0.25[/C][C]0.38[/C][C]0.89[/C][C]1.46[/C][C]1.66[/C][C]1.53[/C][C]1.53[/C][C]1.27[/C][C]0.89[/C][/ROW]
[C]10[/C][C]0.12[/C][C]0.12[/C][C]0.48[/C][C]0.73[/C][C]1.69[/C][C]2.78[/C][C]3.15[/C][C]2.9[/C][C]2.9[/C][C]2.42[/C][C]1.69[/C][/ROW]
[C]11[/C][C]0.15[/C][C]0.15[/C][C]0.61[/C][C]0.92[/C][C]2.14[/C][C]3.52[/C][C]3.97[/C][C]3.67[/C][C]3.67[/C][C]3.06[/C][C]2.14[/C][/ROW]
[C]12[/C][C]0.43[/C][C]0.43[/C][C]1.73[/C][C]2.6[/C][C]6.06[/C][C]9.96[/C][C]11.26[/C][C]10.39[/C][C]10.39[/C][C]8.66[/C][C]6.06[/C][/ROW]
[C]13[/C][C]0.15[/C][C]0.15[/C][C]0.61[/C][C]0.92[/C][C]2.14[/C][C]3.52[/C][C]3.97[/C][C]3.67[/C][C]3.67[/C][C]3.06[/C][C]2.14[/C][/ROW]
[C]14[/C][C]0.04[/C][C]0.04[/C][C]0.18[/C][C]0.27[/C][C]0.62[/C][C]1.03[/C][C]1.16[/C][C]1.07[/C][C]1.07[/C][C]0.89[/C][C]0.62[/C][/ROW]
[C]15[/C][C]0.02[/C][C]0.02[/C][C]0.08[/C][C]0.11[/C][C]0.27[/C][C]0.44[/C][C]0.5[/C][C]0.46[/C][C]0.46[/C][C]0.38[/C][C]0.27[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=301859&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=301859&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
GWSUM x ITHSUM
1011121314151617181920
50.010.010.030.040.090.150.170.150.150.130.09
80.010.010.030.040.090.150.170.150.150.130.09
90.060.060.250.380.891.461.661.531.531.270.89
100.120.120.480.731.692.783.152.92.92.421.69
110.150.150.610.922.143.523.973.673.673.062.14
120.430.431.732.66.069.9611.2610.3910.398.666.06
130.150.150.610.922.143.523.973.673.673.062.14
140.040.040.180.270.621.031.161.071.070.890.62
150.020.020.080.110.270.440.50.460.460.380.27







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic95.62
Degrees of Freedom80
P value0.11

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

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



Parameters (Session):
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')