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, 19 Dec 2018 15:59:21 +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/2018/Dec/19/t1545231715f4rdm5ed3se1afc.htm/, Retrieved Mon, 29 Apr 2024 21:02:28 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=316101, Retrieved Mon, 29 Apr 2024 21:02:28 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact33
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] [SUGARS] [2018-12-19 14:59:21] [b533b184177b91add058bbf2204e0bf7] [Current]
Feedback Forum

Post a new message
Dataseries X:
6 1
8 1
5 1
0 1
8 1
10 1
14 1
8 1.33
6 1
5 1
12 1
1 1
9 1
7 1
13 1
3 1
2 1
12 1
13 1
7 1
0 1
3 1
10 1
5 1
13 1
11 1
7 1
10 1.25
12 1.33
12 1
15 1
9 1
5 1
3 1
4 1
11 1
10 1
11 1
6 1
9 1.3
3 1
6 1
12 1
3 1
11 1
11 1
13 1.5
6 1
9 1
7 1.33
2 1
10 1.25
14 1.33
3 1
0 0.5
0 0.5
6 1
-1 1
12 1.33
8 1
6 1
2 1
3 1
0 0.83
0 1
0 1
15 1
3 1
5 1
3 1
14 1.5
3 1
3 1
12 1
3 1
3 1
8 1




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

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







Tabulation of Results
sugars x weight
0.50.8311.251.31.331.5
-10010000
02140000
10010000
20030000
300130000
40010000
50050000
60070000
70030010
80040010
90030100
100032000
110050000
120050020
130030001
140010011
150020000

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline
sugars  x  weight \tabularnewline
  & 0.5 & 0.83 & 1 & 1.25 & 1.3 & 1.33 & 1.5 \tabularnewline
-1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \tabularnewline
0 & 2 & 1 & 4 & 0 & 0 & 0 & 0 \tabularnewline
1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \tabularnewline
2 & 0 & 0 & 3 & 0 & 0 & 0 & 0 \tabularnewline
3 & 0 & 0 & 13 & 0 & 0 & 0 & 0 \tabularnewline
4 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \tabularnewline
5 & 0 & 0 & 5 & 0 & 0 & 0 & 0 \tabularnewline
6 & 0 & 0 & 7 & 0 & 0 & 0 & 0 \tabularnewline
7 & 0 & 0 & 3 & 0 & 0 & 1 & 0 \tabularnewline
8 & 0 & 0 & 4 & 0 & 0 & 1 & 0 \tabularnewline
9 & 0 & 0 & 3 & 0 & 1 & 0 & 0 \tabularnewline
10 & 0 & 0 & 3 & 2 & 0 & 0 & 0 \tabularnewline
11 & 0 & 0 & 5 & 0 & 0 & 0 & 0 \tabularnewline
12 & 0 & 0 & 5 & 0 & 0 & 2 & 0 \tabularnewline
13 & 0 & 0 & 3 & 0 & 0 & 0 & 1 \tabularnewline
14 & 0 & 0 & 1 & 0 & 0 & 1 & 1 \tabularnewline
15 & 0 & 0 & 2 & 0 & 0 & 0 & 0 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=316101&T=1

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]sugars  x  weight[/C][/ROW]
[ROW][C] [/C][C]0.5[/C][C]0.83[/C][C]1[/C][C]1.25[/C][C]1.3[/C][C]1.33[/C][C]1.5[/C][/ROW]
[C]-1[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]0[/C][C]2[/C][C]1[/C][C]4[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]1[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]2[/C][C]0[/C][C]0[/C][C]3[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]3[/C][C]0[/C][C]0[/C][C]13[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]4[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]5[/C][C]0[/C][C]0[/C][C]5[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]6[/C][C]0[/C][C]0[/C][C]7[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]7[/C][C]0[/C][C]0[/C][C]3[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][/ROW]
[C]8[/C][C]0[/C][C]0[/C][C]4[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][/ROW]
[C]9[/C][C]0[/C][C]0[/C][C]3[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][/ROW]
[C]10[/C][C]0[/C][C]0[/C][C]3[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]11[/C][C]0[/C][C]0[/C][C]5[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]12[/C][C]0[/C][C]0[/C][C]5[/C][C]0[/C][C]0[/C][C]2[/C][C]0[/C][/ROW]
[C]13[/C][C]0[/C][C]0[/C][C]3[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][/ROW]
[C]14[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]1[/C][C]1[/C][/ROW]
[C]15[/C][C]0[/C][C]0[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=316101&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316101&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
sugars x weight
0.50.8311.251.31.331.5
-10010000
02140000
10010000
20030000
300130000
40010000
50050000
60070000
70030010
80040010
90030100
100032000
110050000
120050020
130030001
140010011
150020000







Tabulation of Expected Results
sugars x weight
0.50.8311.251.31.331.5
-10.030.010.830.030.010.060.03
00.180.095.820.180.090.450.18
10.030.010.830.030.010.060.03
20.080.042.490.080.040.190.08
30.340.1710.810.340.170.840.34
40.030.010.830.030.010.060.03
50.130.064.160.130.060.320.13
60.180.095.820.180.090.450.18
70.10.053.320.10.050.260.1
80.130.064.160.130.060.320.13
90.10.053.320.10.050.260.1
100.130.064.160.130.060.320.13
110.130.064.160.130.060.320.13
120.180.095.820.180.090.450.18
130.10.053.320.10.050.260.1
140.080.042.490.080.040.190.08
150.050.031.660.050.030.130.05

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
sugars  x  weight \tabularnewline
  & 0.5 & 0.83 & 1 & 1.25 & 1.3 & 1.33 & 1.5 \tabularnewline
-1 & 0.03 & 0.01 & 0.83 & 0.03 & 0.01 & 0.06 & 0.03 \tabularnewline
0 & 0.18 & 0.09 & 5.82 & 0.18 & 0.09 & 0.45 & 0.18 \tabularnewline
1 & 0.03 & 0.01 & 0.83 & 0.03 & 0.01 & 0.06 & 0.03 \tabularnewline
2 & 0.08 & 0.04 & 2.49 & 0.08 & 0.04 & 0.19 & 0.08 \tabularnewline
3 & 0.34 & 0.17 & 10.81 & 0.34 & 0.17 & 0.84 & 0.34 \tabularnewline
4 & 0.03 & 0.01 & 0.83 & 0.03 & 0.01 & 0.06 & 0.03 \tabularnewline
5 & 0.13 & 0.06 & 4.16 & 0.13 & 0.06 & 0.32 & 0.13 \tabularnewline
6 & 0.18 & 0.09 & 5.82 & 0.18 & 0.09 & 0.45 & 0.18 \tabularnewline
7 & 0.1 & 0.05 & 3.32 & 0.1 & 0.05 & 0.26 & 0.1 \tabularnewline
8 & 0.13 & 0.06 & 4.16 & 0.13 & 0.06 & 0.32 & 0.13 \tabularnewline
9 & 0.1 & 0.05 & 3.32 & 0.1 & 0.05 & 0.26 & 0.1 \tabularnewline
10 & 0.13 & 0.06 & 4.16 & 0.13 & 0.06 & 0.32 & 0.13 \tabularnewline
11 & 0.13 & 0.06 & 4.16 & 0.13 & 0.06 & 0.32 & 0.13 \tabularnewline
12 & 0.18 & 0.09 & 5.82 & 0.18 & 0.09 & 0.45 & 0.18 \tabularnewline
13 & 0.1 & 0.05 & 3.32 & 0.1 & 0.05 & 0.26 & 0.1 \tabularnewline
14 & 0.08 & 0.04 & 2.49 & 0.08 & 0.04 & 0.19 & 0.08 \tabularnewline
15 & 0.05 & 0.03 & 1.66 & 0.05 & 0.03 & 0.13 & 0.05 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=316101&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]sugars  x  weight[/C][/ROW]
[ROW][C] [/C][C]0.5[/C][C]0.83[/C][C]1[/C][C]1.25[/C][C]1.3[/C][C]1.33[/C][C]1.5[/C][/ROW]
[C]-1[/C][C]0.03[/C][C]0.01[/C][C]0.83[/C][C]0.03[/C][C]0.01[/C][C]0.06[/C][C]0.03[/C][/ROW]
[C]0[/C][C]0.18[/C][C]0.09[/C][C]5.82[/C][C]0.18[/C][C]0.09[/C][C]0.45[/C][C]0.18[/C][/ROW]
[C]1[/C][C]0.03[/C][C]0.01[/C][C]0.83[/C][C]0.03[/C][C]0.01[/C][C]0.06[/C][C]0.03[/C][/ROW]
[C]2[/C][C]0.08[/C][C]0.04[/C][C]2.49[/C][C]0.08[/C][C]0.04[/C][C]0.19[/C][C]0.08[/C][/ROW]
[C]3[/C][C]0.34[/C][C]0.17[/C][C]10.81[/C][C]0.34[/C][C]0.17[/C][C]0.84[/C][C]0.34[/C][/ROW]
[C]4[/C][C]0.03[/C][C]0.01[/C][C]0.83[/C][C]0.03[/C][C]0.01[/C][C]0.06[/C][C]0.03[/C][/ROW]
[C]5[/C][C]0.13[/C][C]0.06[/C][C]4.16[/C][C]0.13[/C][C]0.06[/C][C]0.32[/C][C]0.13[/C][/ROW]
[C]6[/C][C]0.18[/C][C]0.09[/C][C]5.82[/C][C]0.18[/C][C]0.09[/C][C]0.45[/C][C]0.18[/C][/ROW]
[C]7[/C][C]0.1[/C][C]0.05[/C][C]3.32[/C][C]0.1[/C][C]0.05[/C][C]0.26[/C][C]0.1[/C][/ROW]
[C]8[/C][C]0.13[/C][C]0.06[/C][C]4.16[/C][C]0.13[/C][C]0.06[/C][C]0.32[/C][C]0.13[/C][/ROW]
[C]9[/C][C]0.1[/C][C]0.05[/C][C]3.32[/C][C]0.1[/C][C]0.05[/C][C]0.26[/C][C]0.1[/C][/ROW]
[C]10[/C][C]0.13[/C][C]0.06[/C][C]4.16[/C][C]0.13[/C][C]0.06[/C][C]0.32[/C][C]0.13[/C][/ROW]
[C]11[/C][C]0.13[/C][C]0.06[/C][C]4.16[/C][C]0.13[/C][C]0.06[/C][C]0.32[/C][C]0.13[/C][/ROW]
[C]12[/C][C]0.18[/C][C]0.09[/C][C]5.82[/C][C]0.18[/C][C]0.09[/C][C]0.45[/C][C]0.18[/C][/ROW]
[C]13[/C][C]0.1[/C][C]0.05[/C][C]3.32[/C][C]0.1[/C][C]0.05[/C][C]0.26[/C][C]0.1[/C][/ROW]
[C]14[/C][C]0.08[/C][C]0.04[/C][C]2.49[/C][C]0.08[/C][C]0.04[/C][C]0.19[/C][C]0.08[/C][/ROW]
[C]15[/C][C]0.05[/C][C]0.03[/C][C]1.66[/C][C]0.05[/C][C]0.03[/C][C]0.13[/C][C]0.05[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=316101&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316101&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
sugars x weight
0.50.8311.251.31.331.5
-10.030.010.830.030.010.060.03
00.180.095.820.180.090.450.18
10.030.010.830.030.010.060.03
20.080.042.490.080.040.190.08
30.340.1710.810.340.170.840.34
40.030.010.830.030.010.060.03
50.130.064.160.130.060.320.13
60.180.095.820.180.090.450.18
70.10.053.320.10.050.260.1
80.130.064.160.130.060.320.13
90.10.053.320.10.050.260.1
100.130.064.160.130.060.320.13
110.130.064.160.130.060.320.13
120.180.095.820.180.090.450.18
130.10.053.320.10.050.260.1
140.080.042.490.080.040.190.08
150.050.031.660.050.030.130.05







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic116.68
Degrees of Freedom96
P value0.07

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=316101&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 Statistic116.68
Degrees of Freedom96
P value0.07



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