Calculation STATBEANS®

 

STATBEAN Name: Crosstabulation

 

Purpose: Cross-tabulation analysis with 2 columns of data. For categorical data, Statgraphics cross-tabulation software finds the frequency of all unique values. For numeric data, finds the frequency within specified intervals. Also computes summary statistics for the resulting two-way table.

DataSource for cross-tabulation software:
any.

Cross-Tabulation Software Read/Write Properties
Name Type Description Possible Values Default Value
byColumn double Width of intervals (continuous data only). Any double value > 0. 0.1
byRow double Width of intervals (continuous data only). Any double value > 0. 0.1
caseSensitiveColumn boolean Whether placing data values into classes is case sensitive. true,false false
caseSensitiveRow boolean Whether placing data values into classes is case sensitive. true,false false
dataTypeColumn String The type of data to be tabulated. If Categorical, shows unique values. If Discrete, shows all integer values. If Continuous, shows number of values within intervals. "Categorical",
"Discrete",
"Continuous"
"Categorical"
dataTypeRow String The type of data to be tabulated. If Categorical, shows unique values. If Discrete, shows all integer values. If Continuous, shows number of values within intervals. "Categorical",
"Discrete",
"Continuous"
"Categorical"
fromColumn double Lower limit for first interval (numeric data only). Any double value. 0.0
fromRow double Lower limit for first interval (numeric data only). Any double value. 0.0
toColumn double Upper limit for last interval (numeric data only). Double value > from. 1.0
toRow double Upper limit for last interval (numeric data only). Double value > from. 1.0
rowVariableName String The name of the row variable with data values to be tabulated. Any string. "X"
columnVariableName String The name of the column variable with data values to be tabulated. Any string. ""

Other Public Methods For Cross-Tabulation Analysis
Name Description Arguments Return Value
int getCountAboveColumn() For Continuous datatype, the number of data values greater than the last class. None. Number of values.
int getCountAboveRow() For Continuous datatype, the number of data values greater than the last class. None. Number of values.
int getCountBelowColumn() For Continuous datatype, the number of data values less than the first class. None. Number of values.
int getCountBelowRow() For Continuous datatype, the number of data values less than the first class. None. Number of values.
double getFrequencyCell(int row,int column) The number of data values in the selected row and column. Row and column numbers (0 origin). Number of values.
String getLabelsColumn() Returns the labels for each column class, separated by a tab character. None. Labels.
String getLabelsRow() Returns the labels for each row class, separated by a tab character. None. Labels.
double getLowerLimitColumn() For Continuous and Discrete datatypes, the lower limit of the first class. None. Lower limit.
double getLowerLimitRow() For Continuous and Discrete datatypes, the lower limit of the first class. None. Lower limit.
int getMeanColumn() For Continuous and Discrete datatypes, the sample mean for the column variable. None. Mean.
int getMeanRow() For Continuous and Discrete datatypes, the sample mean for the row variable. None. Mean.
int getNumberOfClassesColumn() Returns the number of classes k into which the data was tabulated. None. Number of classes.
int getNumberOfClassesRow() Returns the number of classes k into which the data was tabulated. None. Number of classes.
double getPercentageCellOfColumn(int row,int column) The percentage of data values in the selected row and column with respect to its column. Row and column numbers (0 origin). Percentage.
double getPercentageCellOfRow(int row,int column) The percentage of data values in the selected row and column with respect to its row. Row and column numbers (0 origin). Percentage.
double getPercentageCellOfTable(int row,int column) The percentage of data values in the selected row and column with respect to the entire table. Row and column numbers (0 origin). Percentage.
int getSigmaColumn() For Continuous and Discrete datatypes, the sample standard deviation for the column variable. None. Standard deviation.
int getSigmaRow() For Continuous and Discrete datatypes, the sample standard deviation for the row variable. None. Standard deviation.
int getTotalCount() Returns the sum of the frequencies. None. Total count.
double getUpperLimitColumn() For Continuous and Discrete datatypes, the upper limit of the last class. None. Upper limit.
double getUpperLimitRow() For Continuous and Discrete datatypes, the upper limit of the last class. None. Upper limit.

Output Variables For Cross-Tabulation Analysis
Name Description
FrequencyColumn Numbers of data values in each class for the column variable.
FrequencyRow Numbers of data values in each class for the row variable.
LabelColumn Labels for each class.
LabelRow Labels for each class.
PercentageColumn Percentage of data values in each class for the row variable.
PercentageRow Percentage of data values in each class for the column variable.


Code Sample For The Cross-Tabulation Software

//create a filedatasource bean 
FileDataSource fileDataSource1 = new FileDataSource(); 

//set the file name 
fileDataSource1.setFileName("c:\\statbeans\\samples\\cardata.txt"); 

//create a calculation bean 
Correlations correlations1 = new Correlations(); 

//set missing value handling 
correlations1.setMissingValueExclusion("Columnwise"); 

//set the column names 
String[] temp = new String[5]; 
temp[0] = new String("mpg"); 
temp[1] = new String("weight"); 
temp[2] = new String("horsepower"); 
temp[3] = new String("displace"); 
temp[4] = new String("price"); 
correlations1.setColumnNames(temp); 

//create a table bean 
CorrelationsTable correlationsTable1 = new CorrelationsTable(); 

//set table size 
correlationsTable1.setScaleRowsToFit(false); 
correlationsTable1.setScaleColumnsToFit(false); 
correlationsTable1.setNumberOfRowsInDisplay(15); 
correlationsTable1.setNumberOfColumnsInDisplay(5); 

//prevent some rows and columns from scrolling 
correlationsTable1.setHoldRows(3); 
correlationsTable1.setHoldColumns(1); 

//add the table to the display panel 
add(correlationsTable1); 

//register the calculation StatBean as a listener to the datasource 
fileDataSource1.addDataChangeListener(correlations1.listenerForDataChange); 

//register the table StatBean as a listener to the calculation StatBean 
correlations1.addDataChangeListener(correlationsTable1.listenerForDataChange); 

//read the file 
fileDataSource1.readData(); 

//notify all listeners 
fileDataSource1.updateListeners();