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 computationThu, 22 Dec 2016 20:51:10 +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/22/t1482436280pjhbavu98yaemed.htm/, Retrieved Mon, 29 Apr 2024 05:55:49 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=302657, Retrieved Mon, 29 Apr 2024 05:55:49 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact73
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-22 19:51:10] [037fdaa34a77b5f63489b3bcd360a80c] [Current]
Feedback Forum

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




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

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







Tabulation of Results
TVDCSUM x IVHBSUM
8910111213141516171819
10000000100000
11000101010000
12000100110000
13000210212000
14000010142320
15000146211010
16010224751311
17003113461000
18100000111200
19000000011000
20000010000000

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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302657&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
TVDCSUM x IVHBSUM
8910111213141516171819
10000000100000
11000101010000
12000100110000
13000210212000
14000010142320
15000146211010
16010224751311
17003113461000
18100000111200
19000000011000
20000010000000







Tabulation of Expected Results
TVDCSUM x IVHBSUM
8910111213141516171819
100.010.010.030.080.10.140.190.210.090.080.040.01
110.030.030.090.240.30.420.580.640.270.240.120.03
120.030.030.090.240.30.420.580.640.270.240.120.03
130.080.080.240.650.811.131.541.70.730.650.320.08
140.130.130.391.051.311.842.492.761.181.050.530.13
150.160.160.481.291.622.263.073.391.451.290.650.16
160.270.270.822.182.733.825.185.732.452.181.090.27
170.190.190.581.541.922.693.654.031.731.540.770.19
180.060.060.180.480.610.851.151.270.550.480.240.06
190.020.020.060.160.20.280.380.420.180.160.080.02
200.010.010.030.080.10.140.190.210.090.080.040.01

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
TVDCSUM  x  IVHBSUM \tabularnewline
  & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 \tabularnewline
10 & 0.01 & 0.01 & 0.03 & 0.08 & 0.1 & 0.14 & 0.19 & 0.21 & 0.09 & 0.08 & 0.04 & 0.01 \tabularnewline
11 & 0.03 & 0.03 & 0.09 & 0.24 & 0.3 & 0.42 & 0.58 & 0.64 & 0.27 & 0.24 & 0.12 & 0.03 \tabularnewline
12 & 0.03 & 0.03 & 0.09 & 0.24 & 0.3 & 0.42 & 0.58 & 0.64 & 0.27 & 0.24 & 0.12 & 0.03 \tabularnewline
13 & 0.08 & 0.08 & 0.24 & 0.65 & 0.81 & 1.13 & 1.54 & 1.7 & 0.73 & 0.65 & 0.32 & 0.08 \tabularnewline
14 & 0.13 & 0.13 & 0.39 & 1.05 & 1.31 & 1.84 & 2.49 & 2.76 & 1.18 & 1.05 & 0.53 & 0.13 \tabularnewline
15 & 0.16 & 0.16 & 0.48 & 1.29 & 1.62 & 2.26 & 3.07 & 3.39 & 1.45 & 1.29 & 0.65 & 0.16 \tabularnewline
16 & 0.27 & 0.27 & 0.82 & 2.18 & 2.73 & 3.82 & 5.18 & 5.73 & 2.45 & 2.18 & 1.09 & 0.27 \tabularnewline
17 & 0.19 & 0.19 & 0.58 & 1.54 & 1.92 & 2.69 & 3.65 & 4.03 & 1.73 & 1.54 & 0.77 & 0.19 \tabularnewline
18 & 0.06 & 0.06 & 0.18 & 0.48 & 0.61 & 0.85 & 1.15 & 1.27 & 0.55 & 0.48 & 0.24 & 0.06 \tabularnewline
19 & 0.02 & 0.02 & 0.06 & 0.16 & 0.2 & 0.28 & 0.38 & 0.42 & 0.18 & 0.16 & 0.08 & 0.02 \tabularnewline
20 & 0.01 & 0.01 & 0.03 & 0.08 & 0.1 & 0.14 & 0.19 & 0.21 & 0.09 & 0.08 & 0.04 & 0.01 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302657&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]TVDCSUM  x  IVHBSUM[/C][/ROW]
[ROW][C] [/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][/ROW]
[C]10[/C][C]0.01[/C][C]0.01[/C][C]0.03[/C][C]0.08[/C][C]0.1[/C][C]0.14[/C][C]0.19[/C][C]0.21[/C][C]0.09[/C][C]0.08[/C][C]0.04[/C][C]0.01[/C][/ROW]
[C]11[/C][C]0.03[/C][C]0.03[/C][C]0.09[/C][C]0.24[/C][C]0.3[/C][C]0.42[/C][C]0.58[/C][C]0.64[/C][C]0.27[/C][C]0.24[/C][C]0.12[/C][C]0.03[/C][/ROW]
[C]12[/C][C]0.03[/C][C]0.03[/C][C]0.09[/C][C]0.24[/C][C]0.3[/C][C]0.42[/C][C]0.58[/C][C]0.64[/C][C]0.27[/C][C]0.24[/C][C]0.12[/C][C]0.03[/C][/ROW]
[C]13[/C][C]0.08[/C][C]0.08[/C][C]0.24[/C][C]0.65[/C][C]0.81[/C][C]1.13[/C][C]1.54[/C][C]1.7[/C][C]0.73[/C][C]0.65[/C][C]0.32[/C][C]0.08[/C][/ROW]
[C]14[/C][C]0.13[/C][C]0.13[/C][C]0.39[/C][C]1.05[/C][C]1.31[/C][C]1.84[/C][C]2.49[/C][C]2.76[/C][C]1.18[/C][C]1.05[/C][C]0.53[/C][C]0.13[/C][/ROW]
[C]15[/C][C]0.16[/C][C]0.16[/C][C]0.48[/C][C]1.29[/C][C]1.62[/C][C]2.26[/C][C]3.07[/C][C]3.39[/C][C]1.45[/C][C]1.29[/C][C]0.65[/C][C]0.16[/C][/ROW]
[C]16[/C][C]0.27[/C][C]0.27[/C][C]0.82[/C][C]2.18[/C][C]2.73[/C][C]3.82[/C][C]5.18[/C][C]5.73[/C][C]2.45[/C][C]2.18[/C][C]1.09[/C][C]0.27[/C][/ROW]
[C]17[/C][C]0.19[/C][C]0.19[/C][C]0.58[/C][C]1.54[/C][C]1.92[/C][C]2.69[/C][C]3.65[/C][C]4.03[/C][C]1.73[/C][C]1.54[/C][C]0.77[/C][C]0.19[/C][/ROW]
[C]18[/C][C]0.06[/C][C]0.06[/C][C]0.18[/C][C]0.48[/C][C]0.61[/C][C]0.85[/C][C]1.15[/C][C]1.27[/C][C]0.55[/C][C]0.48[/C][C]0.24[/C][C]0.06[/C][/ROW]
[C]19[/C][C]0.02[/C][C]0.02[/C][C]0.06[/C][C]0.16[/C][C]0.2[/C][C]0.28[/C][C]0.38[/C][C]0.42[/C][C]0.18[/C][C]0.16[/C][C]0.08[/C][C]0.02[/C][/ROW]
[C]20[/C][C]0.01[/C][C]0.01[/C][C]0.03[/C][C]0.08[/C][C]0.1[/C][C]0.14[/C][C]0.19[/C][C]0.21[/C][C]0.09[/C][C]0.08[/C][C]0.04[/C][C]0.01[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302657&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302657&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
TVDCSUM x IVHBSUM
8910111213141516171819
100.010.010.030.080.10.140.190.210.090.080.040.01
110.030.030.090.240.30.420.580.640.270.240.120.03
120.030.030.090.240.30.420.580.640.270.240.120.03
130.080.080.240.650.811.131.541.70.730.650.320.08
140.130.130.391.051.311.842.492.761.181.050.530.13
150.160.160.481.291.622.263.073.391.451.290.650.16
160.270.270.822.182.733.825.185.732.452.181.090.27
170.190.190.581.541.922.693.654.031.731.540.770.19
180.060.060.180.480.610.851.151.270.550.480.240.06
190.020.020.060.160.20.280.380.420.180.160.080.02
200.010.010.030.080.10.140.190.210.090.080.040.01







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

\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 & 108.91 \tabularnewline
P value & 0.41 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=302657&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]108.91[/C][/ROW]
[ROW][C]P value[/C][C]0.41[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=302657&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=302657&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 Statistic108.91
P value0.41



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