QtiPlot  0.9.8.2
Statistics.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Statistics.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2010 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Abstract base class for statistics data analysis
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef STATISTICS_H
30 #define STATISTICS_H
31 
32 #include <QObject>
33 #include <ApplicationWindow.h>
34 
35 class Table;
36 
38 class Statistics : public QObject
39 {
40  Q_OBJECT
41 
42  public:
43  Statistics(ApplicationWindow *parent, const QString& name = QString());
44  ~Statistics();
45 
47  virtual bool run();
48  bool setData(const QString&);
49  void showResultsLog(bool show = true){d_result_log = show;};
50 
51  QString sampleName(){return d_col_name;};
52 
54  unsigned int dataSize(){return d_n;};
56  virtual int dof(){return d_n - 1;};
57 
59  double* data(){return d_data;};
60 
61  double mean(){return d_mean;};
62  double variance(){return d_variance;};
63  double standardDeviation(){return d_sd;};
64  double standardError(){return d_se;};
65 
66  QString logInfo(bool header = true);
67 
68  protected:
69  void memoryErrorMessage();
71  virtual void freeMemory();
72 
74  QString d_col_name;
78  unsigned int d_n;
80  double *d_data;
83 
84  double d_mean;
85  double d_sd;
86  double d_variance;
87  double d_se;
88 };
89 
90 #endif