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 computationSat, 17 Dec 2016 19:15:15 +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/17/t14819998858ugob6dhapknbz0.htm/, Retrieved Thu, 02 May 2024 12:04:42 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=300906, Retrieved Thu, 02 May 2024 12:04:42 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact71
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 simul...] [2016-12-17 18:15:15] [870ee93fd745ab9642a13cc9296726e0] [Current]
Feedback Forum

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




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300906&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
IKSUM x TVDCSUM
1011121314151617181920
1300000001100
1401120011000
1500101211000
1610022436201
1701024461010
1800012264210
1901114264100
2000000242200

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

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]IKSUM  x  TVDCSUM[/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]13[/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]1[/C][C]0[/C][C]0[/C][/ROW]
[C]14[/C][C]0[/C][C]1[/C][C]1[/C][C]2[/C][C]0[/C][C]0[/C][C]1[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]15[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]1[/C][C]2[/C][C]1[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]16[/C][C]1[/C][C]0[/C][C]0[/C][C]2[/C][C]2[/C][C]4[/C][C]3[/C][C]6[/C][C]2[/C][C]0[/C][C]1[/C][/ROW]
[C]17[/C][C]0[/C][C]1[/C][C]0[/C][C]2[/C][C]4[/C][C]4[/C][C]6[/C][C]1[/C][C]0[/C][C]1[/C][C]0[/C][/ROW]
[C]18[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][C]2[/C][C]2[/C][C]6[/C][C]4[/C][C]2[/C][C]1[/C][C]0[/C][/ROW]
[C]19[/C][C]0[/C][C]1[/C][C]1[/C][C]1[/C][C]4[/C][C]2[/C][C]6[/C][C]4[/C][C]1[/C][C]0[/C][C]0[/C][/ROW]
[C]20[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]2[/C][C]4[/C][C]2[/C][C]2[/C][C]0[/C][C]0[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=300906&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300906&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
IKSUM x TVDCSUM
1011121314151617181920
1300000001100
1401120011000
1500101211000
1610022436201
1701024461010
1800012264210
1901114264100
2000000242200







Tabulation of Expected Results
IKSUM x TVDCSUM
1011121314151617181920
130.020.060.060.160.250.310.530.390.160.040.02
140.060.180.180.470.760.941.591.180.470.120.06
150.060.180.180.470.760.941.591.180.470.120.06
160.210.620.621.652.683.295.564.121.650.410.21
170.190.560.561.492.422.985.033.731.490.370.19
180.180.530.531.412.292.824.763.531.410.350.18
190.20.590.591.572.553.145.293.921.570.390.2
200.10.290.290.781.271.572.651.960.780.20.1

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
IKSUM  x  TVDCSUM \tabularnewline
  & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \tabularnewline
13 & 0.02 & 0.06 & 0.06 & 0.16 & 0.25 & 0.31 & 0.53 & 0.39 & 0.16 & 0.04 & 0.02 \tabularnewline
14 & 0.06 & 0.18 & 0.18 & 0.47 & 0.76 & 0.94 & 1.59 & 1.18 & 0.47 & 0.12 & 0.06 \tabularnewline
15 & 0.06 & 0.18 & 0.18 & 0.47 & 0.76 & 0.94 & 1.59 & 1.18 & 0.47 & 0.12 & 0.06 \tabularnewline
16 & 0.21 & 0.62 & 0.62 & 1.65 & 2.68 & 3.29 & 5.56 & 4.12 & 1.65 & 0.41 & 0.21 \tabularnewline
17 & 0.19 & 0.56 & 0.56 & 1.49 & 2.42 & 2.98 & 5.03 & 3.73 & 1.49 & 0.37 & 0.19 \tabularnewline
18 & 0.18 & 0.53 & 0.53 & 1.41 & 2.29 & 2.82 & 4.76 & 3.53 & 1.41 & 0.35 & 0.18 \tabularnewline
19 & 0.2 & 0.59 & 0.59 & 1.57 & 2.55 & 3.14 & 5.29 & 3.92 & 1.57 & 0.39 & 0.2 \tabularnewline
20 & 0.1 & 0.29 & 0.29 & 0.78 & 1.27 & 1.57 & 2.65 & 1.96 & 0.78 & 0.2 & 0.1 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=300906&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]IKSUM  x  TVDCSUM[/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]13[/C][C]0.02[/C][C]0.06[/C][C]0.06[/C][C]0.16[/C][C]0.25[/C][C]0.31[/C][C]0.53[/C][C]0.39[/C][C]0.16[/C][C]0.04[/C][C]0.02[/C][/ROW]
[C]14[/C][C]0.06[/C][C]0.18[/C][C]0.18[/C][C]0.47[/C][C]0.76[/C][C]0.94[/C][C]1.59[/C][C]1.18[/C][C]0.47[/C][C]0.12[/C][C]0.06[/C][/ROW]
[C]15[/C][C]0.06[/C][C]0.18[/C][C]0.18[/C][C]0.47[/C][C]0.76[/C][C]0.94[/C][C]1.59[/C][C]1.18[/C][C]0.47[/C][C]0.12[/C][C]0.06[/C][/ROW]
[C]16[/C][C]0.21[/C][C]0.62[/C][C]0.62[/C][C]1.65[/C][C]2.68[/C][C]3.29[/C][C]5.56[/C][C]4.12[/C][C]1.65[/C][C]0.41[/C][C]0.21[/C][/ROW]
[C]17[/C][C]0.19[/C][C]0.56[/C][C]0.56[/C][C]1.49[/C][C]2.42[/C][C]2.98[/C][C]5.03[/C][C]3.73[/C][C]1.49[/C][C]0.37[/C][C]0.19[/C][/ROW]
[C]18[/C][C]0.18[/C][C]0.53[/C][C]0.53[/C][C]1.41[/C][C]2.29[/C][C]2.82[/C][C]4.76[/C][C]3.53[/C][C]1.41[/C][C]0.35[/C][C]0.18[/C][/ROW]
[C]19[/C][C]0.2[/C][C]0.59[/C][C]0.59[/C][C]1.57[/C][C]2.55[/C][C]3.14[/C][C]5.29[/C][C]3.92[/C][C]1.57[/C][C]0.39[/C][C]0.2[/C][/ROW]
[C]20[/C][C]0.1[/C][C]0.29[/C][C]0.29[/C][C]0.78[/C][C]1.27[/C][C]1.57[/C][C]2.65[/C][C]1.96[/C][C]0.78[/C][C]0.2[/C][C]0.1[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=300906&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300906&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
IKSUM x TVDCSUM
1011121314151617181920
130.020.060.060.160.250.310.530.390.160.040.02
140.060.180.180.470.760.941.591.180.470.120.06
150.060.180.180.470.760.941.591.180.470.120.06
160.210.620.621.652.683.295.564.121.650.410.21
170.190.560.561.492.422.985.033.731.490.370.19
180.180.530.531.412.292.824.763.531.410.350.18
190.20.590.591.572.553.145.293.921.570.390.2
200.10.290.290.781.271.572.651.960.780.20.1







Statistical Results
Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
Exact Pearson Chi Square Statistic59.25
P value0.8

\begin{tabular}{lllllllll}
\hline
Statistical Results \tabularnewline
Pearson's Chi-squared test with simulated p-value
	 (based on 2000 replicates) \tabularnewline
Exact Pearson Chi Square Statistic & 59.25 \tabularnewline
P value & 0.8 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=300906&T=3

[TABLE]
[ROW][C]Statistical Results[/C][/ROW]
[ROW][C]Pearson's Chi-squared test with simulated p-value
	 (based on 2000 replicates)[/C][/ROW]
[ROW][C]Exact Pearson Chi Square Statistic[/C][C]59.25[/C][/ROW]
[ROW][C]P value[/C][C]0.8[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=300906&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300906&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 with simulated p-value (based on 2000 replicates)
Exact Pearson Chi Square Statistic59.25
P value0.8



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