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 computationTue, 13 Dec 2016 11:57:02 +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/13/t1481626647sevz5v1k566vofc.htm/, Retrieved Sun, 05 May 2024 07:15:24 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=299049, Retrieved Sun, 05 May 2024 07:15:24 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact107
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-13 10:57:02] [c6ea875f0603e0876d03f43aca979571] [Current]
Feedback Forum

Post a new message
Dataseries X:
2.75	3.25
2.25	4.00
3.00	4.25
3.00	4.00
2.75	4.25
3.00	4.25
3.00	3.75
3.75	4.00
3.25	3.50
3.00	4.00
2.75	4.25
2.75	4.00
3.00	4.00
3.00	4.00
3.00	3.75
3.50	4.00
3.00	3.25
2.25	3.75
3.25	4.25
3.25	3.25
3.00	4.25
3.00	3.50
3.00	3.50
3.00	4.50
3.00	4.25
2.75	3.25
3.25	4.00
3.25	3.75
3.25	3.75
2.50	3.25
3.25	4.25
1.25	2.75
2.50	3.25
3.75	4.25
3.25	4.00
3.00	4.25
3.25	4.00
3.25	4.00
2.75	4.00
3.00	4.25
3.00	3.50
3.25	3.50
3.50	4.00
3.00	3.75
3.00	4.00
2.50	3.50
3.00	3.75
3.00	4.25
3.25	4.25
3.50	5.00
2.50	4.25
3.00	4.50
3.25	4.25
2.75	3.50
3.00	4.25
3.00	4.25
3.00	4.00
2.25	4.50
3.00	4.00
2.75	3.25
3.00	4.00
3.00	3.00
2.25	4.00
3.25	4.00
2.50	4.00
3.50	3.50
2.50	3.75
3.00	3.50
2.75	3.75
3.50	3.75
3.25	4.00
2.50	2.75
3.00	4.50
3.00	2.75
3.75	4.50
3.00	4.75
3.00	4.25
3.00	3.50
3.00	4.25
2.75	3.50
3.25	4.75
3.25	4.00
2.75	4.00
2.50	3.75
2.25	3.00
3.00	4.25
3.25	4.50
2.50	3.75
3.25	4.50
3.00	4.00
3.00	4.00




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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299049&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
Response x Treatment
2.7533.253.53.7544.254.54.755
1.251000000000
2.250100120100
2.51021311000
2.750032132000
3111541012310
3.250012274210
3.50001120001
3.750000011100

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline
Response  x  Treatment \tabularnewline
  & 2.75 & 3 & 3.25 & 3.5 & 3.75 & 4 & 4.25 & 4.5 & 4.75 & 5 \tabularnewline
1.25 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \tabularnewline
2.25 & 0 & 1 & 0 & 0 & 1 & 2 & 0 & 1 & 0 & 0 \tabularnewline
2.5 & 1 & 0 & 2 & 1 & 3 & 1 & 1 & 0 & 0 & 0 \tabularnewline
2.75 & 0 & 0 & 3 & 2 & 1 & 3 & 2 & 0 & 0 & 0 \tabularnewline
3 & 1 & 1 & 1 & 5 & 4 & 10 & 12 & 3 & 1 & 0 \tabularnewline
3.25 & 0 & 0 & 1 & 2 & 2 & 7 & 4 & 2 & 1 & 0 \tabularnewline
3.5 & 0 & 0 & 0 & 1 & 1 & 2 & 0 & 0 & 0 & 1 \tabularnewline
3.75 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=299049&T=1

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]Response  x  Treatment[/C][/ROW]
[ROW][C] [/C][C]2.75[/C][C]3[/C][C]3.25[/C][C]3.5[/C][C]3.75[/C][C]4[/C][C]4.25[/C][C]4.5[/C][C]4.75[/C][C]5[/C][/ROW]
[C]1.25[/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][C]0[/C][/ROW]
[C]2.25[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][C]1[/C][C]2[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][/ROW]
[C]2.5[/C][C]1[/C][C]0[/C][C]2[/C][C]1[/C][C]3[/C][C]1[/C][C]1[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]2.75[/C][C]0[/C][C]0[/C][C]3[/C][C]2[/C][C]1[/C][C]3[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[C]3[/C][C]1[/C][C]1[/C][C]1[/C][C]5[/C][C]4[/C][C]10[/C][C]12[/C][C]3[/C][C]1[/C][C]0[/C][/ROW]
[C]3.25[/C][C]0[/C][C]0[/C][C]1[/C][C]2[/C][C]2[/C][C]7[/C][C]4[/C][C]2[/C][C]1[/C][C]0[/C][/ROW]
[C]3.5[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][C]1[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][/ROW]
[C]3.75[/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]0[/C][C]0[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=299049&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299049&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
Response x Treatment
2.7533.253.53.7544.254.54.755
1.251000000000
2.250100120100
2.51021311000
2.750032132000
3111541012310
3.250012274210
3.50001120001
3.750000011100







Tabulation of Expected Results
Response x Treatment
2.7533.253.53.7544.254.54.755
1.250.030.020.080.120.130.290.220.080.020.01
2.250.160.110.380.60.661.431.10.380.110.05
2.50.30.20.691.091.192.571.980.690.20.1
2.750.360.240.851.331.453.142.420.850.240.12
31.250.842.924.595.0110.868.352.920.840.42
3.250.630.421.462.32.515.434.181.460.420.21
3.50.160.110.380.60.661.431.10.380.110.05
3.750.10.070.230.360.40.860.660.230.070.03

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
Response  x  Treatment \tabularnewline
  & 2.75 & 3 & 3.25 & 3.5 & 3.75 & 4 & 4.25 & 4.5 & 4.75 & 5 \tabularnewline
1.25 & 0.03 & 0.02 & 0.08 & 0.12 & 0.13 & 0.29 & 0.22 & 0.08 & 0.02 & 0.01 \tabularnewline
2.25 & 0.16 & 0.11 & 0.38 & 0.6 & 0.66 & 1.43 & 1.1 & 0.38 & 0.11 & 0.05 \tabularnewline
2.5 & 0.3 & 0.2 & 0.69 & 1.09 & 1.19 & 2.57 & 1.98 & 0.69 & 0.2 & 0.1 \tabularnewline
2.75 & 0.36 & 0.24 & 0.85 & 1.33 & 1.45 & 3.14 & 2.42 & 0.85 & 0.24 & 0.12 \tabularnewline
3 & 1.25 & 0.84 & 2.92 & 4.59 & 5.01 & 10.86 & 8.35 & 2.92 & 0.84 & 0.42 \tabularnewline
3.25 & 0.63 & 0.42 & 1.46 & 2.3 & 2.51 & 5.43 & 4.18 & 1.46 & 0.42 & 0.21 \tabularnewline
3.5 & 0.16 & 0.11 & 0.38 & 0.6 & 0.66 & 1.43 & 1.1 & 0.38 & 0.11 & 0.05 \tabularnewline
3.75 & 0.1 & 0.07 & 0.23 & 0.36 & 0.4 & 0.86 & 0.66 & 0.23 & 0.07 & 0.03 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=299049&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]Response  x  Treatment[/C][/ROW]
[ROW][C] [/C][C]2.75[/C][C]3[/C][C]3.25[/C][C]3.5[/C][C]3.75[/C][C]4[/C][C]4.25[/C][C]4.5[/C][C]4.75[/C][C]5[/C][/ROW]
[C]1.25[/C][C]0.03[/C][C]0.02[/C][C]0.08[/C][C]0.12[/C][C]0.13[/C][C]0.29[/C][C]0.22[/C][C]0.08[/C][C]0.02[/C][C]0.01[/C][/ROW]
[C]2.25[/C][C]0.16[/C][C]0.11[/C][C]0.38[/C][C]0.6[/C][C]0.66[/C][C]1.43[/C][C]1.1[/C][C]0.38[/C][C]0.11[/C][C]0.05[/C][/ROW]
[C]2.5[/C][C]0.3[/C][C]0.2[/C][C]0.69[/C][C]1.09[/C][C]1.19[/C][C]2.57[/C][C]1.98[/C][C]0.69[/C][C]0.2[/C][C]0.1[/C][/ROW]
[C]2.75[/C][C]0.36[/C][C]0.24[/C][C]0.85[/C][C]1.33[/C][C]1.45[/C][C]3.14[/C][C]2.42[/C][C]0.85[/C][C]0.24[/C][C]0.12[/C][/ROW]
[C]3[/C][C]1.25[/C][C]0.84[/C][C]2.92[/C][C]4.59[/C][C]5.01[/C][C]10.86[/C][C]8.35[/C][C]2.92[/C][C]0.84[/C][C]0.42[/C][/ROW]
[C]3.25[/C][C]0.63[/C][C]0.42[/C][C]1.46[/C][C]2.3[/C][C]2.51[/C][C]5.43[/C][C]4.18[/C][C]1.46[/C][C]0.42[/C][C]0.21[/C][/ROW]
[C]3.5[/C][C]0.16[/C][C]0.11[/C][C]0.38[/C][C]0.6[/C][C]0.66[/C][C]1.43[/C][C]1.1[/C][C]0.38[/C][C]0.11[/C][C]0.05[/C][/ROW]
[C]3.75[/C][C]0.1[/C][C]0.07[/C][C]0.23[/C][C]0.36[/C][C]0.4[/C][C]0.86[/C][C]0.66[/C][C]0.23[/C][C]0.07[/C][C]0.03[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=299049&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299049&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
Response x Treatment
2.7533.253.53.7544.254.54.755
1.250.030.020.080.120.130.290.220.080.020.01
2.250.160.110.380.60.661.431.10.380.110.05
2.50.30.20.691.091.192.571.980.690.20.1
2.750.360.240.851.331.453.142.420.850.240.12
31.250.842.924.595.0110.868.352.920.840.42
3.250.630.421.462.32.515.434.181.460.420.21
3.50.160.110.380.60.661.431.10.380.110.05
3.750.10.070.230.360.40.860.660.230.070.03







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic87.65
Degrees of Freedom63
P value0.02

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=299049&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 Statistic87.65
Degrees of Freedom63
P value0.02



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