org.statcato.statistics.inferential
Class CrossTabulation

java.lang.Object
  extended by org.statcato.statistics.inferential.CrossTabulation

public class CrossTabulation
extends java.lang.Object

Cross tabulation and Chi-square test.

Since:
1.0
Version:
%I%, %G%
Author:
Margaret Yau
See Also:
ContingencyTable

Constructor Summary
CrossTabulation(int a, int b)
          Constructor, given the number of rows and columns.
 
Method Summary
 void addObservation(int i, int j, double frequency)
          Adds the given frequency to the location at row i and column j.
 void computeChiSquare()
          Creates a contingency table object using the cross tabulation data.
 double getColumnSum(int j)
          Return the sum of the given column.
 double getColumnSumPercent(int i)
          Return the percent of the sum of the given column out of the total sum.
 ContingencyTable getContingencyTable()
          Returns the contingency table.
 double getFrequency(int i, int j)
          Returns the frequency at row i and column j.
 double getPercent(int i, int j)
          Returns the percent at row i and column j.
 double getRowSum(int i)
          Return the sum of the given row.
 double getRowSumPercent(int i)
          Return the percent of the sum of the given row out of the total sum.
 double getTotalSum()
          Return the total sum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossTabulation

public CrossTabulation(int a,
                       int b)
Constructor, given the number of rows and columns.

Parameters:
a - number of rows
b - number of columns
Method Detail

addObservation

public void addObservation(int i,
                           int j,
                           double frequency)
Adds the given frequency to the location at row i and column j.

Parameters:
i - row index
j - column index
data - double array

getFrequency

public double getFrequency(int i,
                           int j)
Returns the frequency at row i and column j.

Parameters:
i - row index
j - column index
Returns:
frequency

getPercent

public double getPercent(int i,
                         int j)
Returns the percent at row i and column j.

Parameters:
i -
j -
Returns:
percent

getRowSum

public double getRowSum(int i)
Return the sum of the given row.

Parameters:
i - row index
Returns:
row sum

getRowSumPercent

public double getRowSumPercent(int i)
Return the percent of the sum of the given row out of the total sum.

Parameters:
i - row index
Returns:
row sum percent

getColumnSum

public double getColumnSum(int j)
Return the sum of the given column.

Parameters:
j - column index
Returns:
column sum

getColumnSumPercent

public double getColumnSumPercent(int i)
Return the percent of the sum of the given column out of the total sum.

Parameters:
i - column index
Returns:
column sum percent

getTotalSum

public double getTotalSum()
Return the total sum.

Returns:
total sum

computeChiSquare

public void computeChiSquare()
Creates a contingency table object using the cross tabulation data.


getContingencyTable

public ContingencyTable getContingencyTable()
Returns the contingency table.

Returns:
ContingencyTable object