\documentclass[a4paper]{jsarticle}
\usepackage{amsmath, graphics}
\newcommand{\mathsym}[1]{{}}  %
\newcommand{\unicode}[1]{{}}  %

\usepackage{pifont}
%\ding{30} & \ding{31} & \ding{32} & \ding{33} & �B�B�B & \ding{254} 

%% AMS-LaTeX Created by Wolfram Mathematica 7.0 : www.wolfram.com

\usepackage{latexsym,amsmath,theorem}
\usepackage[psamsfonts]{amssymb}
\usepackage{wrapfig}
%\begin{proof}[Proof of hogehoge]
%   �藝�̏ؖ�
%\end{proof}
%\usepackage{mathpazo}            
%\usepackage{amsmath,amssymb}
%\usepackage{booktabs}
%\usepackage[dvips]{graphicx,color}

\usepackage{shadethm}
\newshadetheorem{theorem}{�藝}[section]
\newshadetheorem{cor}[theorem]{�n}
\newtheorem{remark}[theorem]{����}
\newtheorem{unshadedtheorem}[theorem]{�藝}
%\newtheorem{comment}{�R�����g}[section]

\newtheorem{prop}{����}[section]%����
\newtheorem{defn}{��`}[section]%��`
\newtheorem{assm}{����}[section]%����
%                       theorem ---> theorem
%\newtheorem{theorem}{�藝}[section]%�藝
\newtheorem{cory}{�n�@}[section]%�n
\newtheorem{lema}{���}[section]%���
\newtheorem{remk}{����}[section]%����
\newtheorem{exap}{���}[section]%���
\newtheorem{yotn}{�v�_}[section]%�v�_
\newcommand{\proof}{\textbf{�ؖ��F}}%�ؖ�
\newtheorem{Toi}{��}[section]   %�₢ 


%\newcommand{\hxi}{\matheorem{\xi}}
%\newcommand{\remark}{\textbf{����}}

\renewcommand{\theequation}{%
\thesection.\arabic{equation}}
\numberwithin{equation}{section}   % amsmath �p�b�P�[�W
%%%
%%%\@addtoreset{equation}{section} 
%%%\def\theequation{\thesection.\arabic{equation}}


\begin{document}
%\maketitle

\hfill
{\bf\LARGE 
  �����\�̌v�Z
}
\qquad
%$\Box \, \Box \, \Box \, \Box \, \Box$ 
\\
\hfill
$\Box \, \Box \, \Box \, \Box \, \Box$
$\Box \, \Box \, \Box \, \Box \, \Box$
$\Box \, \Box \, \Box \, \Box \, \Box$
$\Box \, \Box \, \Box \, \Box \, \Box$
$\Box \, \Box \, \Box \, \Box \, \Box$
$\Box \, \Box \, \Box \, \Box \, \Box$
\hfill
\today ��

\noindent
\ding{48}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{46}

\vspace{-4ex}
\tableofcontents
\noindent
\ding{46}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{47}
\dotfill
\quad\ding{48}


�����\�ɂ�����Ɨ����̌���́A�悭�p�����邪
�e�}�X�̓x����5�ȉ��̏ꍇ�ł́A�J�C2�擝�v�ʂ�
�������邱�Ƃ͋ߎ����ł���A���ꂪ�傫����
������B�����ł͋ߎ��������Ȃ�Ȃ��v�Z�A
���Ȃ킿���􉽕��z�̊m���v�Z�ƃJ�C�Q��l�Ƃ�
��r���ӂ܂��Ȃ���c�_�����Ă݂�B

���ꂪ���ڂ����悤�ɂȂ����A�K��Ƃ��������
�����̏������\�ɂȂ��Ă����Ƃ������R�ł���B

R.A.Fisher�̒��ڌv�Z��
�J�C2�敪�z�ɂ��ߎ��v�Z�𒲂ׂ悤�B

\section{���ڌv�Z�m���@}
\subsection{���_�v�Z}
�Q�~�Q�̕����\�Ƃ́A���ɗ^������悤�Ȍ`:
\begin{tabular}{|c|cc|c|}
\hline
  �x�� &  $B_1$  & $B_2$ & �v(����) \\ \hline
 $A_1$ & $n_{11}$ & $n_{11}$  & $n_{1.}$ \\ 
 $A_2$ & $n_{21}$ & $n_{21}$  & $n_{2.}$ \\ \hline
  �v(����) & $n_{.1}$ & $n_{.2}$  & $n$ \\ 
 \hline
\end{tabular}
\label{tb:table1}�Ƃ����s��`�ł���B���Ƃ���
�\�h���˂̌��p�𒲂ׂ�Ƃ��A
������A,B�̓�ł��ꂼ�ꂪ�܂�2�ɕ�����B
$A_1$:�\�h���˂��󂯂�, $A_2$:�󂯂Ȃ��A
�܂����̌��ʂɂ��āA$B_1$:��늳,$B_2$:�늳�Ƃ����`��
���ނ���B 
%�\\ref{tb:table1}�ł́A
4�̗�ƍs�̍��v�i���ӓx���j
$n_{1.}$�A$n_{2.}$�A$n_{.1}$�A$n_{.2}$��^���āA
�����F
\[
 \begin{array}{ll}
  n_{1.} = n_{11} + n_{12}, \quad & 
  n_{2.} = n_{21} + n_{22} \\ 
  n_{.1} = n_{11} + n_{21}, \quad & 
  n_{.2} = n_{21} + n_{22} 
 \end{array}
\]
�𖞂����悤��4�̐�$(n_{11},n_{12},n_{21},n_{22})$
�����߂�B�������Z���̑����v��$n=n_{1.}+n_{2.}=n_{.1}+n_{.2}$�Ƃ������B
�������̑������Ɨ��ŁA�e�X�̍��ڂɊ܂ފm��������$A$�ɂ��Ă�
$p_1,p_2(=1-p_1)$ �Ƃ��āA����$B$�ł�$q_1,q_2(=1-q_1)$�Ƃ��A
�����̊Ԃɂ́A�Ɨ��Ɖ��肷��B����Ƃ���𖞂����悤�ȏꍇ
�̐��́A���􉽕��z�ɏ]���B
���ꂩ��̖ړI�́A���ӓx��($n_{1.}$,$n_{2.}$,$n_{.1}$,$n_{.2}$)��
�^�����Ƃ��A�e�Z���̐���$(n_{11},n_{12},n_{21},n_{22})$�ƂȂ�
���ۂ̏����t���m���i�ȗ������ĕ\�����āj
 $p(n_{ij}\,|\,n_{.i},n_{j.}),$ $(i,j=1,2)$�����߂�B
��ʂ�r�ss��̃f�[�^$i=1,2,\cdots,r,j=1,2,\cdots,s$�ł����Ă����l�̌v�Z�ł���B
�����t���m���ɑ΂���
$p(n_{ij}\,|\,n_{.i},n_{j.}) = \dfrac{p(n_{ij})}{p(n_{.i},n_{j.})}$
�����߂�B���q�ɂ͓����m���ł��邩��
\(
 p(n_{ij}) = \dfrac{n!}{\Pi_{i,j}n_{ij}!} \,
 \left(p_1^{n_{1.}} p_2^{n_{2.}} \right)
 \left(q_1^{n_{.1}} q_2^{n_{.2}} \right)\)
�܂�
\[
%,\qquad\mbox(i.e.)\quad
 p(n_{11},n_{12},n_{21},n_{22}) 
 = \dfrac{n!}{n_{11}!n_{12}!n_{21}!n_{22}!} \,\,
 p_1^{n_{1.}} p_2^{n_{2.}} 
 q_1^{n_{.1}} q_2^{n_{.2}} 
\]
������̊m��$p(n_{i.},n_{.j})$�͎��Ӗ��x�Ƃ��Čv�Z����B
�����𖞂������̂ɂ킽���Ęa���Ƃ邩��A
$
p(n_{i.},n_{.j})= \displaystyle\sum_* p(n_{ij}),
$
������$*$�͏���$(i,j) : \sum_i n_{ij} = n_{.j},\sum_j n_{ij} = n_{i.}$�ƂȂ�
���ׂĂ�$n_{ij}$�ɂ��Ă̘a��\���Ƃ���B����
\[
 \begin{array}{lll}
  p(n_{i.},n_{j.}) &=& \displaystyle\sum_* p(n_{ij}) 
 = \displaystyle\sum_* \dfrac{n!}{\Pi_{i,j} n_{ij}!} 
 \left(p_1^{n_{1.}} p_2^{n_{2.}} \right)
 \left(q_1^{n_{.1}} q_2^{n_{.2}} \right) \\
 &=& n! \,\, \displaystyle\sum_* \dfrac{1}{\Pi_{i,j} n_{ij}!}
 \left(p_1^{n_{1.}} p_2^{n_{2.}} \right)
 \left(q_1^{n_{.1}} q_2^{n_{.2}} \right)
 \,\,=\,\, \dfrac{(n!)^2}{n_{11}!\, n_{12}!\, n_{21}!\, n_{22}!}
 \left(p_1^{n_{1.}} p_2^{n_{2.}} \right)
 \left(q_1^{n_{.1}} q_2^{n_{.2}} \right)
 \end{array}
\]
�ƂȂ�B�Ȃ��Ȃ�΁A
�������̓W�J
$(x_1+x_2)^{n_{.1}}(x_1+x_2)^{n_{.2}} 
= (x_1+x_2)^{n_{.1}+n_{.2}}
= (x_1+x_2)^{n}$
�ɂ����ČW��$x_1^{n_{1.}}x_2^{n_{2.}}$���r�����
$
 \displaystyle\sum_* \dfrac{n_{.1}!}{n_{11}!\, n_{21}!}
 \, \dfrac{n_{.2}!}{n_{12}!\, n_{22}!}  
= \dfrac{n!}{n_{1.}!\,\, n_{2.}!}
$
�ł��邩��,
$
 \displaystyle\sum_* \dfrac{1}{n_{11}!\, n_{21}!\, n_{12}!\, n_{22}!}  
= \dfrac{n!}{n_{1.}!\, n_{2.}!\, n_{.1}!\, n_{.2}!}
$�𓾂�B
����������
\[
\begin{array}{l}
 p(n_{ij} \,|\, n_{i.}, n_{.j} ) 
= \dfrac{(\Pi_i n_{i.}!)(\Pi_j n_{.j}!) }{n!\,\,  \Pi_{i,j}n_{ij}!}, 
 \qquad \forall i,j \\
 p(n_{11},n_{12},n_{21},n_{22} \,|\, n_{1.},n_{2.}, n_{.1}, n_{.2} ) 
 = \begin{array}[t]{l}
  \dfrac{1}{ n_{11}!\, n_{12}!\, n_{21}!\, n_{22}!}
  \left(
   \dfrac{n_{1.}!\, n_{2.}!\,  n_{.1}! \, n_{.2}! }{n!}
  \right) \\
 = (n_{ij}�ɂ��Ȃ��萔)\dfrac{1}{ n_{11}! \, n_{12}! \, n_{21}!\, n_{22}!}
   \end{array}
\end{array}
\]
��ŏq�ׂ������𖞂������ׂĂ�$(n_{11},n_{12},n_{21},n_{22})$��
�������킹��΁A$1$�ƂȂ���̂��i$n_{ij}$�ɂ��Ȃ��萔)�ł���B



��̗�̐��l�ōl���Ă݂�ƁA(�F�엘�Y�A���v���K�F�Q�P�P�y�[�W
)
\begin{tabular}{c|cc|c}
       &   ��늳  &  �늳  & �v  \\ \hline
�\�h    &     $n_{11}$   & $n_{12}$ & $11$ \\
��\�h  &     $n_{21}$   & $n_{22}$ & $8$ \\ \hline
  �v    &     $12$       & $7$   &   $19$
\end{tabular}
�ƂȂ�悤��$n_{ij}$�́A�ǂ̂��炢�̊m���ŋN���邩�H���v�Z���Ă���
�̂ł���B

�t�B�V���[�ɂ��l������
�ϑ��f�[�^�����΂������̂��N����m�������鐅���A
���Ƃ���$0.05$�ȉ��ł���ΓƗ��ł���Ƃ������������p���悤�Ƃ������
�ł���B�΂�Ƃ������Ƃ̓Z���̍ŏ��l��$k$�ł���΁A$k-1,k-2,\cdots,0$��
���v�����ꍇ�̊m�������߂�B

���Ƃ��΁A��L�̐ݒ�ŁA���̃f�[�^$n_{11}=9,n_{12}=2,n_{21}=3,n_{22}=5$�ł���΁A�΂�ꍇ�́A
\begin{center}
\begin{tabular}{|ll|} \hline
 9 & 2 \\
 3 & 5 \\ \hline
\end{tabular}
\quad 
\begin{tabular}{|ll|} \hline
 10 & 1 \\
 2 & 6 \\ \hline
\end{tabular}
\quad
\begin{tabular}{|ll|} \hline
 11 & 0 \\
 1 & 7  \\ \hline
\end{tabular}
\end{center}
�ł��邩��A
\[
 P�l 
 = \dfrac{11! 8! 12! 7!}{19!}\left( \dfrac{1}{9! 2! 3! 5!} 
 + \dfrac{1}{10! 1! 2! 6!} + \dfrac{1}{11! 0! 1! 7!} \right) 
 \fallingdotseq 0.067
\]

���������ۂ̌v�Z���s�͌������قǊȒP�ł͂Ȃ��B�K��̌v�Z��
����߂Ė��Ȃ��̂ł���B�v�Z�@�̐i���Ŕ�r�ȒP��
�s����ɂȂ��Ă��Ă���B���͂��̐��������V�X�e����
�q�ׂ悤�B






\section{�������� Mathematica}


\begin{minipage}[t]{0.45\textwidth}     %[];t,c,b  {};cm,pt
{\bf ���P}�@�F��A���v���K�F�Q�P�P�y�[�W

���̎�������A�\�h���˂̌��\�𒲂ׂ�B
\begin{tabular}{c|cc|c}
       &   ���a��  &  ��a��  & �v  \\ \hline
�\�h���˂��󂯂���    &     $9$   & $2$ & $11$ \\
%�\�h���˂�
�󂯂Ȃ�������  &     $3$   & $5$ & $8$ \\ \hline
  �v    &     $12$       & $7$   &   $19$
\end{tabular}

\vspace{2ex}

(��@)
�܂�����͂œd�여�̌v�Z���s���B

\fbox{
���������ɂ�钼�ړI���l�v�Z}


\noindent\(\pmb{\text{In[1]:=a1}=1/(9!*2!*3!*5!)}\)

\noindent\({\text{Out[1]=}\frac{1}{522547200}}\)

\noindent\(\pmb{\text{In[2]:=a2}=1/(10!*1!*2!*6!)}\)

\noindent\(\text{Out[2]=}\frac{1}{5225472000}\)

\noindent\(\pmb{\text{In[3]:=a3}=1/(11!*0!*1!*7!)}\)

\noindent\(\text{Out[3]=}\frac{1}{201180672000}\)

\noindent\(\pmb{\text{In[4]:=}(\text{a1}+\text{a2}+\text{a3})*(11!*8!*12!*7!)/19!}\)

\noindent\(\text{Out[4]=}\frac{283}{4199}\)

\noindent\(\pmb{\text{In[5]:=}N[\%]}\)

\noindent\(\text{Out[5]=}0.067397\)
\end{minipage}
\hfill
\begin{minipage}[t]{.45\linewidth}
%\noindent\(\pmb{\text{ClearAll}}\)
%\noindent\(\text{ClearAll}\)
����A
\textit{Mathematica} (�}�j���A��178��)
�ɂ��������A�v���O��������͂��Ď��s����Ǝ��̌��ʂ�����ꂽ�B
\fbox{
�����\�ɂ�����J�C2��ߎ��l�v�Z�v���O����}

\noindent\(\pmb{\text{ClearAll}[\text{$\texttt{"}$Global$\grave{ }$*$\texttt{"}$}]}\)

\noindent\(\pmb{\text{In[1]:=Needs}[\text{$\texttt{"}$HypothesisTesting$\grave{ }\texttt{"}$}];}\)

\noindent\(\pmb{\text{In[2]:=chiSquareContingencyTable}[\text{x$\_$}]
\text{:=}}\\
\pmb{\text{\hspace{2ZW}Module}[\{l,m,t,\text{chi},\text{df}\},\{l,m\}=\text{Dimensions}[x];}\\
\pmb{\hspace{2ZW}t=N[\text{Outer}[\text{Times},
\text{Total}[\text{Transpose}[x]],\text{Total}[x]]/}\\
\pmb{\text{\hspace{2ZW}Total}[\text{Flatten}[x]]];}\\
\pmb{\text{\hspace{2ZW}chi}=\sum _{i=1}^l \sum _{j=1}^m \frac{(x[[i,j]] -t[[i,j]]){}^{\wedge}2}{t[[i,j]]};}\\
\pmb{\text{\hspace{2ZW}df}=(l-1)*(m-1);}\\
\pmb{\hspace{2ZW}\{\text{chi},\text{df},
\text{ChiSquarePValue}[\text{chi},\text{df}]\}]}\)

\noindent\(\pmb{\text{In[3]:=
chiSquareContingencyTable}[\{\{9,2\},\{3,5\}\}]}\)

\noindent\(\text{Out[4]=}\{3.9095,1,\text{OneSidedPValue}\to 0.048014\}\)

����𒼐ړI�v�Z���ʂƔ�r����ƁA�����̂��ꂪ���R�o�Ă���B�i��@�I��j
\end{minipage}


\vspace{2ex}


�����\textit{Mathematica} �}�j���A��180�łɂ́A$data$ �Ƃ��āA�����\���s����͂��Čv�Z����
���߂̉��L�̃v���O����������B2�s2��̃f�[�^����A�Б��Ɨ�����P�l(PValue)
���o�͂���B

%\noindent\(\pmb{�@}\)
\dotfill

\noindent\(\pmb{\text{twowayTableFishersTest}[\text{data$\_$}]\text{:=}}
  \pmb{\text{Module}[\{e,f,g,h,m,\text{m1},\text{m2},\text{one},\text{two},s\},}\\
  \pmb{\hspace{2ZW}\{e,f\}=\text{Total}[\text{data}]; \{g,h\}=\text{Total}[\text{data},\{2\}];}\\
  \pmb{\hspace{2ZW}m=\text{Table}[\{\{x,g-x\},\{y=(e-x),h-y\}\},\{x,0,g\}];}\\
 \pmb{\hspace{2ZW}\text{fishersExactTest}[\{\{\text{a$\_$},\text{b$\_$}\},\{\text{c$\_$},
  \text{d$\_$}\}\}]\text{:=}}
  \pmb{\text{Block}[\{g=a+c,h=b+d,e=a+b,f=c+d,n=e+f\},}\\
 \pmb{\hspace{4ZW}(e!*f!*g!*h!)/(n!*a!*b!*c!*d!)\text{//}N];}\\
  \pmb{\hspace{2ZW}\text{m1}[\{\{\text{a$\_$},\text{b$\_$}\},\{\text{c$\_$},
  \text{d$\_$}\}\}]
  \text{:=}}
  \pmb{\text{Block}[\{\},\{a*d - b*c,\text{fishersExactTest}[\{\{a,b\},\{c,d\}\}]\}];}\\
  \pmb{\hspace{2ZW}\text{m2}=\text{Map}[\text{m1},m];s=\text{m1}[\text{data}][[1]];}\\
  \pmb{\hspace{2ZW}\text{one}=\text{Rule}[\text{$\texttt{"}$One SidedPValue$\texttt{"}$},
  \text{Total}[\text{If}[s>0,}
  \pmb{\hspace{.2ZW}\text{Select}[\text{m2},\#[[1]] \geq  s\&],}
  \pmb{\hspace{.2ZW}\text{Select}[\text{m2},\#[[1]] \leq  s\&]]][[2]]];}\\
  \pmb{\hspace{2ZW}\text{two}
  =\text{Rule}[\text{$\texttt{"}$TwoSidedPvalue$\texttt{"}$},}
  \pmb{\hspace{.2ZW}\text{Total}[\text{Select}[\text{Map}[\text{fishersExactTest},m],}
  \pmb{\# \leq  \text{fishersExactTest}[\text{data}]\&]]];}\\
  \pmb{\hspace{2ZW}\{\text{one},\text{two}\}}\\
\pmb{]}\)

\dotfill

{\bf ���2} ���̓}�j���A���ɂ�������m�F�̂��߂Ɏ��s�����B

\noindent\(\pmb{\text{twowayTableFishersTest}[\{\{10,2\},\{9,10\}\}]}\)

\noindent\(\{\text{One SidedPValue}\to 0.0499879,\text{TwoSidedPvalue}\to 0.0651757\}\)

{\bf ���3}�i�F��211�Łj�O�̗����ēx�s�������ʂł���B

\noindent\(\pmb{\text{twowayTableFishersTest}[\{\{9,2\},\{3,5\}\}]}\)

\noindent\(\{\text{One SidedPValue}\to 0.067397,\text{TwoSidedPvalue}\to 0.0739462\}\)


\end{document}

\section{��}
\subsection{��}
\label{sec:sec11}
����\cite{siryo}�ɂ���$\cdots$

\begin{tabular}{|c|c|}
\hline
�Z��1 & �Z��2 \\ \hline
�Z��3 & �Z��4 \\ \hline
�Z��5 & �Z��6 \\ \hline
\end{tabular}
\label{tb:table2}
�\\ref{tb:table2}�ł�$\cdots$
yasuda\cite[(1946)]{siryo99}
\begin{eqnarray}
a+b=c
\label{eq:a_plus_b}
\end{eqnarray}
��(\ref{eq:a_plus_b})��\pageref{eq:a_plus_b}�y�[�W�ڂɂ���B

\section{�I��̃Z�N�V����}
�O��\ref{sec:sec11}�ŏq�ׂ��悤��$\cdots$

\subsection{��}
\label{sec:sec11}
����\cite{siryo}�ɂ���$\cdots$

\begin{tabular}{|c|c|}
\hline
�Z��1 & �Z��2 \\ \hline
�Z��3 & �Z��4 \\ \hline
�Z��5 & �Z��6 \\ \hline
\end{tabular}
\label{tb:table1}
�\\ref{tb:table1}�ł�$\cdots$


�Q�l����


\begin{thebibliography}{9}
\bibitem{siryo99}
����1, "����," pp.1-5, 1946

\bibitem[si]{siryo}
����1, "����," pp.1-5

\bibitem[ya]{yasu}
���Җ��A��ځA�o�ŎЁA���s�N

\bibitem[ya2]{yasu2}
���Җ��A��ځA�o�ŎЁA���s�N
\end{thebibliography}

\end{document}

