QtiPlot 0.9.8.2
Statistics.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : Statistics.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2010 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Abstract base class for statistics data analysis
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef STATISTICS_H
00030 #define STATISTICS_H
00031 
00032 #include <QObject>
00033 #include <ApplicationWindow.h>
00034 
00035 class Table;
00036 
00038 class Statistics : public QObject
00039 {
00040     Q_OBJECT
00041 
00042     public:
00043         Statistics(ApplicationWindow *parent, const QString& name = QString());
00044         ~Statistics();
00045 
00047         virtual bool run();
00048         bool setData(const QString&);
00049         void showResultsLog(bool show = true){d_result_log = show;};
00050 
00051         QString sampleName(){return d_col_name;};
00052 
00054         unsigned int dataSize(){return d_n;};
00056         virtual int dof(){return d_n - 1;};
00057 
00059         double* data(){return d_data;};
00060 
00061         double mean(){return d_mean;};
00062         double variance(){return d_variance;};
00063         double standardDeviation(){return d_sd;};
00064         double standardError(){return d_se;};
00065 
00066         QString logInfo(bool header = true);
00067 
00068     protected:
00069         void memoryErrorMessage();
00071         virtual void freeMemory();
00072 
00074         QString d_col_name;
00076         bool d_result_log;
00078         unsigned int d_n;
00080         double *d_data;
00082         Table *d_table;
00083 
00084         double d_mean;
00085         double d_sd;
00086         double d_variance;
00087         double d_se;
00088 };
00089 
00090 #endif