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 computationSun, 21 Oct 2012 14:01:15 -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/21/t1350842489zjgicjwviwhwf1m.htm/, Retrieved Sun, 28 Apr 2024 19:49:30 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=181126, Retrieved Sun, 28 Apr 2024 19:49:30 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact59
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-21 18:01:15] [fec1d01507e8c19b843fb6b1ea3b7bfc] [Current]
- R  D    [Chi-Squared Test, McNemar Test, and Fisher Exact Test] [] [2012-10-21 18:15:40] [8fb02a06fa197bf14378f27a41ead604]
Feedback Forum

Post a new message
Dataseries X:
38	39
37	38
33	31
31	33
39	32
44	39
33	36
35	33
32	33
28	32
40	37
27	30
37	38
32	29
28	22
34	35
30	35
35	34
31	35
32	34
30	34
30	35
31	23
40	31
32	27
36	36
32	31
35	32
38	39
42	37
34	38
35	39
35	34
33	31
36	32
32	37
33	36
34	32
32	35
34	36




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Herman Ole Andreas Wold' @ wold.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 & 3 seconds \tabularnewline
R Server & 'Herman Ole Andreas Wold' @ wold.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=181126&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]3 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Herman Ole Andreas Wold' @ wold.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=181126&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181126&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 time3 seconds
R Server'Herman Ole Andreas Wold' @ wold.wessa.net







Tabulation of Results
Connected x Seperated
2223272930313233343536373839
2700001000000000
2810000010000000
3000000000120000
3101000001010000
3200110101110100
3300000200002000
3400000010011010
3500000011200001
3600000010001000
3700000000000020
3800000000000002
3900000010000000
4000000100000100
4200000000000100
4400000000000001

\begin{tabular}{lllllllll}
\hline
Tabulation of Results \tabularnewline Connected x Seperated \tabularnewline & 22 & 23 & 27 & 29 & 30 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 \tabularnewline 27 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \tabularnewline 28 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \tabularnewline 30 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 2 & 0 & 0 & 0 & 0 \tabularnewline 31 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \tabularnewline 32 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 \tabularnewline 33 & 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 \tabularnewline 34 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 \tabularnewline 35 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 2 & 0 & 0 & 0 & 0 & 1 \tabularnewline 36 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \tabularnewline 37 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 & 0 \tabularnewline 38 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 \tabularnewline 39 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \tabularnewline 40 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \tabularnewline 42 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \tabularnewline 44 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=181126&T=1

[TABLE]
[ROW]
Tabulation of Results[/C][/ROW] [ROW]Connected x Seperated[/C][/ROW] [ROW][C] [/C][C]22[/C][C]23[/C][C]27[/C][C]29[/C][C]30[/C][C]31[/C][C]32[/C][C]33[/C][C]34[/C][C]35[/C][C]36[/C][C]37[/C][C]38[/C][C]39[/C][/ROW] [C]27[/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][C]0[/C][/ROW] [C]28[/C][C]1[/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]30[/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]1[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][/ROW] [C]31[/C][C]0[/C][C]1[/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]32[/C][C]0[/C][C]0[/C][C]1[/C][C]1[/C][C]0[/C][C]1[/C][C]0[/C][C]1[/C][C]1[/C][C]1[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][/ROW] [C]33[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]2[/C][C]0[/C][C]0[/C][C]0[/C][/ROW] [C]34[/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]1[/C][C]1[/C][C]0[/C][C]1[/C][C]0[/C][/ROW] [C]35[/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]2[/C][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][/ROW] [C]36[/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]1[/C][C]0[/C][C]0[/C][C]0[/C][/ROW] [C]37[/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][C]0[/C][C]0[/C][C]0[/C][C]2[/C][C]0[/C][/ROW] [C]38[/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][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]2[/C][/ROW] [C]39[/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][C]0[/C][C]0[/C][/ROW] [C]40[/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]1[/C][C]0[/C][C]0[/C][/ROW] [C]42[/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][C]0[/C][C]0[/C][C]1[/C][C]0[/C][C]0[/C][/ROW] [C]44[/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][C]0[/C][C]0[/C][C]0[/C][C]0[/C][C]1[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=181126&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181126&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
Connected x Seperated
2223272930313233343536373839
2700001000000000
2810000010000000
3000000000120000
3101000001010000
3200110101110100
3300000200002000
3400000010011010
3500000011200001
3600000010001000
3700000000000020
3800000000000002
3900000010000000
4000000100000100
4200000000000100
4400000000000001







Tabulation of Expected Results
Connected x Seperated
2223272930313233343536373839
270.020.020.020.020.020.10.120.080.10.120.10.080.080.1
280.050.050.050.050.050.20.250.150.20.250.20.150.150.2
300.080.080.080.080.080.30.380.220.30.380.30.220.220.3
310.080.080.080.080.080.30.380.220.30.380.30.220.220.3
320.180.180.180.180.180.70.880.520.70.880.70.520.520.7
330.10.10.10.10.10.40.50.30.40.50.40.30.30.4
340.10.10.10.10.10.40.50.30.40.50.40.30.30.4
350.120.120.120.120.120.50.620.380.50.620.50.380.380.5
360.050.050.050.050.050.20.250.150.20.250.20.150.150.2
370.050.050.050.050.050.20.250.150.20.250.20.150.150.2
380.050.050.050.050.050.20.250.150.20.250.20.150.150.2
390.020.020.020.020.020.10.120.080.10.120.10.080.080.1
400.050.050.050.050.050.20.250.150.20.250.20.150.150.2
420.020.020.020.020.020.10.120.080.10.120.10.080.080.1
440.020.020.020.020.020.10.120.080.10.120.10.080.080.1

\begin{tabular}{lllllllll}
\hline
Tabulation of Expected Results \tabularnewline Connected x Seperated \tabularnewline & 22 & 23 & 27 & 29 & 30 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 \tabularnewline 27 & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 & 0.1 & 0.12 & 0.08 & 0.1 & 0.12 & 0.1 & 0.08 & 0.08 & 0.1 \tabularnewline 28 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.2 & 0.25 & 0.15 & 0.2 & 0.25 & 0.2 & 0.15 & 0.15 & 0.2 \tabularnewline 30 & 0.08 & 0.08 & 0.08 & 0.08 & 0.08 & 0.3 & 0.38 & 0.22 & 0.3 & 0.38 & 0.3 & 0.22 & 0.22 & 0.3 \tabularnewline 31 & 0.08 & 0.08 & 0.08 & 0.08 & 0.08 & 0.3 & 0.38 & 0.22 & 0.3 & 0.38 & 0.3 & 0.22 & 0.22 & 0.3 \tabularnewline 32 & 0.18 & 0.18 & 0.18 & 0.18 & 0.18 & 0.7 & 0.88 & 0.52 & 0.7 & 0.88 & 0.7 & 0.52 & 0.52 & 0.7 \tabularnewline 33 & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 & 0.4 & 0.5 & 0.3 & 0.4 & 0.5 & 0.4 & 0.3 & 0.3 & 0.4 \tabularnewline 34 & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 & 0.4 & 0.5 & 0.3 & 0.4 & 0.5 & 0.4 & 0.3 & 0.3 & 0.4 \tabularnewline 35 & 0.12 & 0.12 & 0.12 & 0.12 & 0.12 & 0.5 & 0.62 & 0.38 & 0.5 & 0.62 & 0.5 & 0.38 & 0.38 & 0.5 \tabularnewline 36 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.2 & 0.25 & 0.15 & 0.2 & 0.25 & 0.2 & 0.15 & 0.15 & 0.2 \tabularnewline 37 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.2 & 0.25 & 0.15 & 0.2 & 0.25 & 0.2 & 0.15 & 0.15 & 0.2 \tabularnewline 38 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.2 & 0.25 & 0.15 & 0.2 & 0.25 & 0.2 & 0.15 & 0.15 & 0.2 \tabularnewline 39 & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 & 0.1 & 0.12 & 0.08 & 0.1 & 0.12 & 0.1 & 0.08 & 0.08 & 0.1 \tabularnewline 40 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.2 & 0.25 & 0.15 & 0.2 & 0.25 & 0.2 & 0.15 & 0.15 & 0.2 \tabularnewline 42 & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 & 0.1 & 0.12 & 0.08 & 0.1 & 0.12 & 0.1 & 0.08 & 0.08 & 0.1 \tabularnewline 44 & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 & 0.1 & 0.12 & 0.08 & 0.1 & 0.12 & 0.1 & 0.08 & 0.08 & 0.1 \tabularnewline \hline \end{tabular} %Source: https://freestatistics.org/blog/index.php?pk=181126&T=2

[TABLE]
[ROW]
Tabulation of Expected Results[/C][/ROW] [ROW]Connected x Seperated[/C][/ROW] [ROW][C] [/C][C]22[/C][C]23[/C][C]27[/C][C]29[/C][C]30[/C][C]31[/C][C]32[/C][C]33[/C][C]34[/C][C]35[/C][C]36[/C][C]37[/C][C]38[/C][C]39[/C][/ROW] [C]27[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.1[/C][C]0.12[/C][C]0.08[/C][C]0.1[/C][C]0.12[/C][C]0.1[/C][C]0.08[/C][C]0.08[/C][C]0.1[/C][/ROW] [C]28[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.2[/C][C]0.25[/C][C]0.15[/C][C]0.2[/C][C]0.25[/C][C]0.2[/C][C]0.15[/C][C]0.15[/C][C]0.2[/C][/ROW] [C]30[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.3[/C][C]0.38[/C][C]0.22[/C][C]0.3[/C][C]0.38[/C][C]0.3[/C][C]0.22[/C][C]0.22[/C][C]0.3[/C][/ROW] [C]31[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.08[/C][C]0.3[/C][C]0.38[/C][C]0.22[/C][C]0.3[/C][C]0.38[/C][C]0.3[/C][C]0.22[/C][C]0.22[/C][C]0.3[/C][/ROW] [C]32[/C][C]0.18[/C][C]0.18[/C][C]0.18[/C][C]0.18[/C][C]0.18[/C][C]0.7[/C][C]0.88[/C][C]0.52[/C][C]0.7[/C][C]0.88[/C][C]0.7[/C][C]0.52[/C][C]0.52[/C][C]0.7[/C][/ROW] [C]33[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.4[/C][C]0.5[/C][C]0.3[/C][C]0.4[/C][C]0.5[/C][C]0.4[/C][C]0.3[/C][C]0.3[/C][C]0.4[/C][/ROW] [C]34[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.1[/C][C]0.4[/C][C]0.5[/C][C]0.3[/C][C]0.4[/C][C]0.5[/C][C]0.4[/C][C]0.3[/C][C]0.3[/C][C]0.4[/C][/ROW] [C]35[/C][C]0.12[/C][C]0.12[/C][C]0.12[/C][C]0.12[/C][C]0.12[/C][C]0.5[/C][C]0.62[/C][C]0.38[/C][C]0.5[/C][C]0.62[/C][C]0.5[/C][C]0.38[/C][C]0.38[/C][C]0.5[/C][/ROW] [C]36[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.2[/C][C]0.25[/C][C]0.15[/C][C]0.2[/C][C]0.25[/C][C]0.2[/C][C]0.15[/C][C]0.15[/C][C]0.2[/C][/ROW] [C]37[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.2[/C][C]0.25[/C][C]0.15[/C][C]0.2[/C][C]0.25[/C][C]0.2[/C][C]0.15[/C][C]0.15[/C][C]0.2[/C][/ROW] [C]38[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.2[/C][C]0.25[/C][C]0.15[/C][C]0.2[/C][C]0.25[/C][C]0.2[/C][C]0.15[/C][C]0.15[/C][C]0.2[/C][/ROW] [C]39[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.1[/C][C]0.12[/C][C]0.08[/C][C]0.1[/C][C]0.12[/C][C]0.1[/C][C]0.08[/C][C]0.08[/C][C]0.1[/C][/ROW] [C]40[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.05[/C][C]0.2[/C][C]0.25[/C][C]0.15[/C][C]0.2[/C][C]0.25[/C][C]0.2[/C][C]0.15[/C][C]0.15[/C][C]0.2[/C][/ROW] [C]42[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.1[/C][C]0.12[/C][C]0.08[/C][C]0.1[/C][C]0.12[/C][C]0.1[/C][C]0.08[/C][C]0.08[/C][C]0.1[/C][/ROW] [C]44[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.02[/C][C]0.1[/C][C]0.12[/C][C]0.08[/C][C]0.1[/C][C]0.12[/C][C]0.1[/C][C]0.08[/C][C]0.08[/C][C]0.1[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=181126&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181126&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
Connected x Seperated
2223272930313233343536373839
270.020.020.020.020.020.10.120.080.10.120.10.080.080.1
280.050.050.050.050.050.20.250.150.20.250.20.150.150.2
300.080.080.080.080.080.30.380.220.30.380.30.220.220.3
310.080.080.080.080.080.30.380.220.30.380.30.220.220.3
320.180.180.180.180.180.70.880.520.70.880.70.520.520.7
330.10.10.10.10.10.40.50.30.40.50.40.30.30.4
340.10.10.10.10.10.40.50.30.40.50.40.30.30.4
350.120.120.120.120.120.50.620.380.50.620.50.380.380.5
360.050.050.050.050.050.20.250.150.20.250.20.150.150.2
370.050.050.050.050.050.20.250.150.20.250.20.150.150.2
380.050.050.050.050.050.20.250.150.20.250.20.150.150.2
390.020.020.020.020.020.10.120.080.10.120.10.080.080.1
400.050.050.050.050.050.20.250.150.20.250.20.150.150.2
420.020.020.020.020.020.10.120.080.10.120.10.080.080.1
440.020.020.020.020.020.10.120.080.10.120.10.080.080.1







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

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

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=181126&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 Statistic220.45
P value0.04



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