\HeaderA{calcPearsonChi}{Pearsons chi-square statistic for comparing the probability 
binned datasets}{calcPearsonChi}
\keyword{misc}{calcPearsonChi}
\begin{Description}\relax
This function calculates the Pearsons chi-squared statistic for comparing 
data binned using the \code{proBin} and \code{binByRef} functions.Internally, the 
function utilizes the chisq.test function.
\end{Description}
\begin{Usage}
\begin{verbatim}
calcPearsonChi(ctrlRes,sampRes)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{ctrlRes}] The result generated by calling the \code{probBin}
function on a control dataset.
\item[\code{sampRes}] The result generated by calling the \code{byByRef}
function on a sample dataset
\end{ldescription}
\end{Arguments}
\begin{Value}
A list containing the statistic, p.value, observed, expected counts
and the residuals
\end{Value}
\begin{Author}\relax
Nishant Gopalakrishnan
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{proBin}{proBin}}, \code{\LinkA{calcPBChiSquare}{calcPBChiSquare}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

data(GvHD)
# flow frame 1 is treated as  control dataset and used to generate bins
resCtrl<-proBin(GvHD[[1]][,c("FSC-H","SSC-H","Time")],200)  
plotBins(resCtrl,GvHD[[1]],channels=c("FSC-H","SSC-H","Time"),title="Binned control data")
# Same bins are applied to flowFrame 16
resSample<-binByRef(resCtrl,GvHD[[16]][,c("FSC-H","SSC-H","Time")])
stat<-calcPearsonChi(resCtrl,resSample)
\end{ExampleCode}
\end{Examples}

