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 computationFri, 12 Dec 2014 14:29:29 +0000
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2014/Dec/12/t1418395679rnqb49e318nsrlt.htm/, Retrieved Thu, 16 May 2024 11:26:42 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=266763, Retrieved Thu, 16 May 2024 11:26:42 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact80
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] [paper stress man/...] [2014-12-12 14:29:29] [b3af8a5e2d9bda149808ec07c7827d03] [Current]
Feedback Forum

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




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 2 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ jenkins.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=266763&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]2 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gwilym Jenkins' @ jenkins.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=266763&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266763&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 Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 seconds
R Server'Gwilym Jenkins' @ jenkins.wessa.net







Tabulation of Results
stress_voor_mannen x confstat_man
78910121314151617181920
60000010000000
70000100000000
100000010000000
110000001010000
120001223220110
131101020021010
140112222331010
150000302060010
160000020230001

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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266763&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
stress_voor_mannen x confstat_man
78910121314151617181920
60000010000000
70000100000000
100000010000000
110000001010000
120001223220110
131101020021010
140112222331010
150000302060010
160000020230001







Tabulation of Expected Results
stress_voor_mannen x confstat_man
78910121314151617181920
60.020.030.020.060.120.150.120.110.260.030.020.060.02
70.020.030.020.060.120.150.120.110.260.030.020.060.02
100.020.030.020.060.120.150.120.110.260.030.020.060.02
110.030.060.030.120.240.30.240.210.520.060.030.120.03
120.210.420.210.851.72.121.71.483.610.420.210.850.21
130.140.270.140.551.091.361.090.952.320.270.140.550.14
140.270.550.271.092.182.732.181.914.640.550.271.090.27
150.180.360.180.731.451.821.451.273.090.360.180.730.18
160.120.240.120.480.971.210.970.852.060.240.120.480.12

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
stress_voor_mannen  x  confstat_man \tabularnewline
  & 7 & 8 & 9 & 10 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \tabularnewline
6 & 0.02 & 0.03 & 0.02 & 0.06 & 0.12 & 0.15 & 0.12 & 0.11 & 0.26 & 0.03 & 0.02 & 0.06 & 0.02 \tabularnewline
7 & 0.02 & 0.03 & 0.02 & 0.06 & 0.12 & 0.15 & 0.12 & 0.11 & 0.26 & 0.03 & 0.02 & 0.06 & 0.02 \tabularnewline
10 & 0.02 & 0.03 & 0.02 & 0.06 & 0.12 & 0.15 & 0.12 & 0.11 & 0.26 & 0.03 & 0.02 & 0.06 & 0.02 \tabularnewline
11 & 0.03 & 0.06 & 0.03 & 0.12 & 0.24 & 0.3 & 0.24 & 0.21 & 0.52 & 0.06 & 0.03 & 0.12 & 0.03 \tabularnewline
12 & 0.21 & 0.42 & 0.21 & 0.85 & 1.7 & 2.12 & 1.7 & 1.48 & 3.61 & 0.42 & 0.21 & 0.85 & 0.21 \tabularnewline
13 & 0.14 & 0.27 & 0.14 & 0.55 & 1.09 & 1.36 & 1.09 & 0.95 & 2.32 & 0.27 & 0.14 & 0.55 & 0.14 \tabularnewline
14 & 0.27 & 0.55 & 0.27 & 1.09 & 2.18 & 2.73 & 2.18 & 1.91 & 4.64 & 0.55 & 0.27 & 1.09 & 0.27 \tabularnewline
15 & 0.18 & 0.36 & 0.18 & 0.73 & 1.45 & 1.82 & 1.45 & 1.27 & 3.09 & 0.36 & 0.18 & 0.73 & 0.18 \tabularnewline
16 & 0.12 & 0.24 & 0.12 & 0.48 & 0.97 & 1.21 & 0.97 & 0.85 & 2.06 & 0.24 & 0.12 & 0.48 & 0.12 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=266763&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]stress_voor_mannen  x  confstat_man[/C][/ROW]
[ROW][C] [/C][C]7[/C][C]8[/C][C]9[/C][C]10[/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]6[/C][C]0.02[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.12[/C][C]0.15[/C][C]0.12[/C][C]0.11[/C][C]0.26[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.02[/C][/ROW]
[C]7[/C][C]0.02[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.12[/C][C]0.15[/C][C]0.12[/C][C]0.11[/C][C]0.26[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.02[/C][/ROW]
[C]10[/C][C]0.02[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.12[/C][C]0.15[/C][C]0.12[/C][C]0.11[/C][C]0.26[/C][C]0.03[/C][C]0.02[/C][C]0.06[/C][C]0.02[/C][/ROW]
[C]11[/C][C]0.03[/C][C]0.06[/C][C]0.03[/C][C]0.12[/C][C]0.24[/C][C]0.3[/C][C]0.24[/C][C]0.21[/C][C]0.52[/C][C]0.06[/C][C]0.03[/C][C]0.12[/C][C]0.03[/C][/ROW]
[C]12[/C][C]0.21[/C][C]0.42[/C][C]0.21[/C][C]0.85[/C][C]1.7[/C][C]2.12[/C][C]1.7[/C][C]1.48[/C][C]3.61[/C][C]0.42[/C][C]0.21[/C][C]0.85[/C][C]0.21[/C][/ROW]
[C]13[/C][C]0.14[/C][C]0.27[/C][C]0.14[/C][C]0.55[/C][C]1.09[/C][C]1.36[/C][C]1.09[/C][C]0.95[/C][C]2.32[/C][C]0.27[/C][C]0.14[/C][C]0.55[/C][C]0.14[/C][/ROW]
[C]14[/C][C]0.27[/C][C]0.55[/C][C]0.27[/C][C]1.09[/C][C]2.18[/C][C]2.73[/C][C]2.18[/C][C]1.91[/C][C]4.64[/C][C]0.55[/C][C]0.27[/C][C]1.09[/C][C]0.27[/C][/ROW]
[C]15[/C][C]0.18[/C][C]0.36[/C][C]0.18[/C][C]0.73[/C][C]1.45[/C][C]1.82[/C][C]1.45[/C][C]1.27[/C][C]3.09[/C][C]0.36[/C][C]0.18[/C][C]0.73[/C][C]0.18[/C][/ROW]
[C]16[/C][C]0.12[/C][C]0.24[/C][C]0.12[/C][C]0.48[/C][C]0.97[/C][C]1.21[/C][C]0.97[/C][C]0.85[/C][C]2.06[/C][C]0.24[/C][C]0.12[/C][C]0.48[/C][C]0.12[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=266763&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=266763&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
stress_voor_mannen x confstat_man
78910121314151617181920
60.020.030.020.060.120.150.120.110.260.030.020.060.02
70.020.030.020.060.120.150.120.110.260.030.020.060.02
100.020.030.020.060.120.150.120.110.260.030.020.060.02
110.030.060.030.120.240.30.240.210.520.060.030.120.03
120.210.420.210.851.72.121.71.483.610.420.210.850.21
130.140.270.140.551.091.361.090.952.320.270.140.550.14
140.270.550.271.092.182.732.181.914.640.550.271.090.27
150.180.360.180.731.451.821.451.273.090.360.180.730.18
160.120.240.120.480.971.210.970.852.060.240.120.480.12







Statistical Results
Pearson's Chi-squared test
Pearson Chi Square Statistic71.23
Degrees of Freedom96
P value0.97

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

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



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):
par3 <- 'Pearson Chi-Squared'
par2 <- '2'
par1 <- '1'
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')