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 computationMon, 22 Oct 2012 13:25:08 -0400
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2012/Oct/22/t1350926727ryvirsvpw51kbst.htm/, Retrieved Fri, 03 May 2024 16:15:48 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=181861, Retrieved Fri, 03 May 2024 16:15:48 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact64
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] [] [2012-10-22 16:50:58] [739726dcd44895e1bbfe6a9ff78aefee]
-   PD    [Chi-Squared Test, McNemar Test, and Fisher Exact Test] [] [2012-10-22 17:25:08] [6a75692d68b560ebf35260ff627da44a] [Current]
Feedback Forum

Post a new message
Dataseries X:
14	'A'
18	'C'
11	'B'
12	'C'
16	'A'
18	'D'
14	'D'
14	'B'
15	'B'
15	'A'
17	'D'
19	'B'
10	'B'
16	'A'
18	'A'
14	'C'
14	'C'
17	'A'
14	'A'
16	'C'
18	'C'
11	'D'
14	'A'
12	'A'
17	'C'
9	'C'
16	'B'
14	'A'
15	'C'
11	'C'
16	'D'
13	'C'
17	'D'
15	'A'
14	'D'
16	'C'
9	'D'
15	'C'
17	'D'
13	'C'
15	'C'
16	'C'
16	'C'
12	'C'
12	'D'
11	'B'
15	'A'
15	'B'
17	'A'
13	'C'
16	'A'
14	'D'
11	'C'
12	'A'
12	'C'
15	'C'
16	'B'
15	'B'
12	'B'
12	'B'
8	'D'
13	'B'
11	'B'
14	'B'
15	'D'
10	'A'
11	'B'
12	'D'
15	'A'
15	'A'
14	'B'
16	'A'
15	'A'
15	'A'
13	'D'
12	'D'
17	'A'
13	'D'
15	'D'
13	'D'
15	'B'
16	'A'
15	'A'
16	'C'
15	'B'
14	'D'
15	'A'
14	'B'
13	'C'
7	'C'
17	'B'
13	'C'
15	'A'
14	'D'
13	'D'
16	'B'
12	'B'
14	'D'
17	'B'
15	'B'
17	'B'
12	'B'
16	'A'
11	'D'
15	'A'
9	'C'
16	'B'
15	'A'
10	'B'
10	'A'
15	'B'
11	'C'
13	'A'
14	'C'
18	'B'
16	'C'
14	'A'
14	'A'
14	'B'
14	'B'
12	'A'
14	'D'
15	'A'
15	'A'
15	'D'
13	'C'
17	'C'
17	'A'
19	'B'
15	'C'
13	'C'
9	'C'
15	'A'
15	'D'
15	'A'
16	'D'
11	'D'
14	'B'
11	'B'
15	'B'
13	'B'
15	'B'
16	'B'
14	'B'
15	'D'
16	'D'
16	'D'
11	'B'
12	'D'
9	'C'
16	'A'
13	'A'
16	'A'
12	'A'
9	'B'
13	'D'
13	'C'
14	'A'
19	'B'
13	'C'
12	'B'
13	'B'





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
R Framework error message
Warning: there are blank lines in the 'Data X' field.
Please, use NA for missing data - blank lines are simply
 deleted and are NOT treated as missing values.

\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
R Framework error message & 
Warning: there are blank lines in the 'Data X' field.
Please, use NA for missing data - blank lines are simply
 deleted and are NOT treated as missing values.
\tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=181861&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]
[ROW][C]R Framework error message[/C][C]
Warning: there are blank lines in the 'Data X' field.
Please, use NA for missing data - blank lines are simply
 deleted and are NOT treated as missing values.
[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=181861&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181861&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
R Framework error message
Warning: there are blank lines in the 'Data X' field.
Please, use NA for missing data - blank lines are simply
 deleted and are NOT treated as missing values.







Tabulation of Results
Hapiness x Seperated
ABCD
102200
110633
124534
132395
147837
1516955
168564
174323
181121
190300
70010
80001
90141

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

[TABLE]
[ROW][C]Tabulation of Results[/C][/ROW]
[ROW][C]Hapiness  x  Seperated[/C][/ROW]
[ROW][C] [/C][C]A[/C][C]B[/C][C]C[/C][C]D[/C][/ROW]
[C]10[/C][C]2[/C][C]2[/C][C]0[/C][C]0[/C][/ROW]
[C]11[/C][C]0[/C][C]6[/C][C]3[/C][C]3[/C][/ROW]
[C]12[/C][C]4[/C][C]5[/C][C]3[/C][C]4[/C][/ROW]
[C]13[/C][C]2[/C][C]3[/C][C]9[/C][C]5[/C][/ROW]
[C]14[/C][C]7[/C][C]8[/C][C]3[/C][C]7[/C][/ROW]
[C]15[/C][C]16[/C][C]9[/C][C]5[/C][C]5[/C][/ROW]
[C]16[/C][C]8[/C][C]5[/C][C]6[/C][C]4[/C][/ROW]
[C]17[/C][C]4[/C][C]3[/C][C]2[/C][C]3[/C][/ROW]
[C]18[/C][C]1[/C][C]1[/C][C]2[/C][C]1[/C][/ROW]
[C]19[/C][C]0[/C][C]3[/C][C]0[/C][C]0[/C][/ROW]
[C]7[/C][C]0[/C][C]0[/C][C]1[/C][C]0[/C][/ROW]
[C]8[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][/ROW]
[C]9[/C][C]0[/C][C]1[/C][C]4[/C][C]1[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=181861&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181861&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
Hapiness x Seperated
ABCD
102200
110633
124534
132395
147837
1516955
168564
174323
181121
190300
70010
80001
90141







Tabulation of Expected Results
Hapiness x Seperated
ABCD
101.091.140.940.84
113.263.412.812.52
124.354.543.753.36
135.165.44.463.99
146.797.15.865.25
159.519.948.217.35
166.256.535.44.83
173.263.412.812.52
181.361.421.171.05
190.810.850.70.63
70.270.280.230.21
80.270.280.230.21
91.631.71.411.26

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline
Hapiness  x  Seperated \tabularnewline
  & A & B & C & D \tabularnewline
10 & 1.09 & 1.14 & 0.94 & 0.84 \tabularnewline
11 & 3.26 & 3.41 & 2.81 & 2.52 \tabularnewline
12 & 4.35 & 4.54 & 3.75 & 3.36 \tabularnewline
13 & 5.16 & 5.4 & 4.46 & 3.99 \tabularnewline
14 & 6.79 & 7.1 & 5.86 & 5.25 \tabularnewline
15 & 9.51 & 9.94 & 8.21 & 7.35 \tabularnewline
16 & 6.25 & 6.53 & 5.4 & 4.83 \tabularnewline
17 & 3.26 & 3.41 & 2.81 & 2.52 \tabularnewline
18 & 1.36 & 1.42 & 1.17 & 1.05 \tabularnewline
19 & 0.81 & 0.85 & 0.7 & 0.63 \tabularnewline
7 & 0.27 & 0.28 & 0.23 & 0.21 \tabularnewline
8 & 0.27 & 0.28 & 0.23 & 0.21 \tabularnewline
9 & 1.63 & 1.7 & 1.41 & 1.26 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=181861&T=2

[TABLE]
[ROW][C]Tabulation of Expected Results[/C][/ROW]
[ROW][C]Hapiness  x  Seperated[/C][/ROW]
[ROW][C] [/C][C]A[/C][C]B[/C][C]C[/C][C]D[/C][/ROW]
[C]10[/C][C]1.09[/C][C]1.14[/C][C]0.94[/C][C]0.84[/C][/ROW]
[C]11[/C][C]3.26[/C][C]3.41[/C][C]2.81[/C][C]2.52[/C][/ROW]
[C]12[/C][C]4.35[/C][C]4.54[/C][C]3.75[/C][C]3.36[/C][/ROW]
[C]13[/C][C]5.16[/C][C]5.4[/C][C]4.46[/C][C]3.99[/C][/ROW]
[C]14[/C][C]6.79[/C][C]7.1[/C][C]5.86[/C][C]5.25[/C][/ROW]
[C]15[/C][C]9.51[/C][C]9.94[/C][C]8.21[/C][C]7.35[/C][/ROW]
[C]16[/C][C]6.25[/C][C]6.53[/C][C]5.4[/C][C]4.83[/C][/ROW]
[C]17[/C][C]3.26[/C][C]3.41[/C][C]2.81[/C][C]2.52[/C][/ROW]
[C]18[/C][C]1.36[/C][C]1.42[/C][C]1.17[/C][C]1.05[/C][/ROW]
[C]19[/C][C]0.81[/C][C]0.85[/C][C]0.7[/C][C]0.63[/C][/ROW]
[C]7[/C][C]0.27[/C][C]0.28[/C][C]0.23[/C][C]0.21[/C][/ROW]
[C]8[/C][C]0.27[/C][C]0.28[/C][C]0.23[/C][C]0.21[/C][/ROW]
[C]9[/C][C]1.63[/C][C]1.7[/C][C]1.41[/C][C]1.26[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=181861&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181861&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
Hapiness x Seperated
ABCD
101.091.140.940.84
113.263.412.812.52
124.354.543.753.36
135.165.44.463.99
146.797.15.865.25
159.519.948.217.35
166.256.535.44.83
173.263.412.812.52
181.361.421.171.05
190.810.850.70.63
70.270.280.230.21
80.270.280.230.21
91.631.71.411.26







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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181861&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 Statistic49.16
P value0.05



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