Changes

Jump to navigation Jump to search
3,810 bytes added ,  11:03, 22 November 2006
no edit summary
Line 107: Line 107:     
};
 
};
 +
</code>
 +
 +
==AnovaDataSet==
 +
The AnovaDataSet object contains the DataCells that are going to be analyzed, and their arrangment into rows and columns. Data is therefore poured into the cells of the AnovaDataSet, which then calculates the ANOVA results.
 +
 +
''To do: need to add some API glue so that outside routines can add cells, rows, and columns to the AnovaDataSet (at the moment, it reads sample data from a file); and need to specify and calculate repeated vs. unrepeated measures.''
 +
 +
===Declaration===
 +
 +
<code>
 +
class AnovaDataSet {
 +
 +
 +
:// of course, need to put in textual labels, etc...
 +
 +
:public:
 +
 +
:
 +
 +
::char name[256]; // name of the data set
 +
 +
 +
 +
::unsigned long num_of_rows;
 +
 +
::unsigned long num_of_columns;
 +
 +
 +
 +
::ListObject *cells; // all cell objects
 +
 +
::ListObject *rows; // LineOfCells objects
 +
 +
::ListObject *columns; // LineOfCells objects
 +
 +
:::// the lists of cell, rows, and columns are "1" indexed
 +
 +
 +
 +
 +
::double grand_total; // overall sum of all observations in all cells
 +
 +
::double grand_N; // overall number of observations in all the cells:::
 +
 +
::double grand_mean; // mean of all the observations in all the cells
 +
 +
::double grand_SS;
 +
 +
::double grand_biased_variance; // SS_total divided by grand_N; multiply by grand_N to get SS_total
 +
 +
::double grand_deviation; // biased standard deviation of all observations
 +
 +
 +
 +
::double mean_of_cell_means;
 +
 +
::double deviation_of_cell_means;
 +
 +
 +
::AnovaResultsTable results_table;
 +
 +
 +
 +
::AnovaDataSet(char *new_name);
 +
 +
::AnovaDataSet();
 +
 +
::~AnovaDataSet(); // destructor to deallocate the ListObjects,
 +
 +
:::::// and tell the cells, rows and columns to destroy themselves too
 +
 +
 +
 +
::void SetUpCells(void);
 +
 +
::void SetUpRowsAndColumns(void);
 +
 +
::void Update(void);
 +
 +
::void ReadDataFromFile(void);
 +
 +
 +
:::// need to add some API glue so that outside routines can add cells, rows, and columns
 +
 +
 +
::void UpdateAnovaResultsTable(void);
 +
 +
 +
 +
:protected:
 +
 +
:
 +
 +
::// internal routines for calculating the ANOVA
 +
 +
 +
 +
::double GetSSWithinCells(void);
 +
 +
::double GetSSBetweenCells(void);
 +
 +
::double GetSSBetweenLinesOfCells(ListObject *lineList,unsigned long num_of_cells,double *variance);
 +
 +
::double GetSSBetweenRows(void);
 +
 +
::double GetSSBetweenColumns (void);
 +
 +
::double GetSSBetweenInteraction(void);
 +
 +
 +
::double GetMSWithinCells(void);
 +
 +
::double GetMSBetweenCells(void);
 +
 +
::double GetMSBetweenRows(void);
 +
 +
::double GetMSBetweenColumns (void);
 +
 +
::double GetMSBetweenInteraction(void);
 +
 +
 +
 +
 +
::double GetNumCells(void);
 +
 +
::double GetDfTotal(void);
 +
 +
::double GetDfWithinCells(void);
 +
 +
::double GetDfError(void);
 +
 +
::double GetDfBetweenCells(void);
 +
 +
::double GetDfBetweenRows(void);
 +
 +
::double GetDfBetweenColumns(void);
 +
 +
::double GetDfBetweenInteraction(void);
 +
 +
 +
 +
:://interface with data table...
 +
 +
::void Read2WayDataFromDataTable(DataTable dt,AnovaParameters factors);
 +
 +
 +
};
 +
 +
</code>
 +
 +
==AnovaResultsTable==
 +
 +
The results table is a structure inside of the AnovaDataSet object. When the dataset is updated, the results of the ANOVA are placed in this table.
 +
 +
''To do:  need a way to report errors, and some routines to nicely format the results table for display, or copying to clipboard, etc.''
 +
 +
 +
===Declaration===
 +
<code>
 +
typedef struct {
 +
 +
 +
 +
::double DF_between_groups;
 +
 +
 +
 +
::double cell_SS_within;
 +
 +
::double cell_DF_within; // aka DF_error
 +
 +
::double cell_MS_within;
 +
 +
 +
 +
::double cell_variance;
 +
 +
::double cell_SS_between;
 +
 +
::double cell_DF_between;
 +
 +
::double cell_MS_between;
 +
 +
 +
 +
::double row_variance;
 +
 +
::double row_SS_between;
 +
 +
::double row_DF_between;
 +
 +
::double row_MS_between;
 +
 +
::double row_F;
 +
 +
::double row_p;
 +
 +
 +
 +
::double col_variance;
 +
 +
::double col_SS_between;
 +
 +
::double col_DF_between;
 +
 +
::double col_MS_between;
 +
 +
::double col_F;
 +
 +
::double col_p;
 +
 +
 +
 +
::double inter_SS_between;
 +
 +
::double inter_DF_between;
 +
 +
::double inter_MS_between;
 +
 +
::double inter_F;
 +
 +
::double inter_p;
 +
 +
 +
} AnovaResultsTable;
 +
 +
 
</code>
 
</code>

Navigation menu