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
double * data()
Returns the y values of the input data set.
Definition: Statistics.h:59
Table * d_table
A table source of data.
Definition: Statistics.h:82
~Statistics()
Definition: Statistics.cpp:191
double mean()
Definition: Statistics.h:61
Abstract base class for data analysis operations.
Definition: Statistics.h:38
double standardError()
Definition: Statistics.h:64
double d_variance
Definition: Statistics.h:86
Statistics(ApplicationWindow *parent, const QString &name=QString())
Definition: Statistics.cpp:38
double d_se
Definition: Statistics.h:87
QString logInfo(bool header=true)
Definition: Statistics.cpp:120
QtiPlot&#39;s main window.
Definition: ApplicationWindow.h:133
QString d_col_name
The name of the source data set.
Definition: Statistics.h:74
QString sampleName()
Definition: Statistics.h:51
unsigned int d_n
The size of the data set to be analyzed.
Definition: Statistics.h:78
double * d_data
y data set to be analysed
Definition: Statistics.h:80
double d_mean
Definition: Statistics.h:84
double standardDeviation()
Definition: Statistics.h:63
virtual int dof()
Returns the degrees of freedom.
Definition: Statistics.h:56
virtual void freeMemory()
Frees the memory allocated for the X and Y data sets.
Definition: Statistics.cpp:182
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
bool setData(const QString &)
Definition: Statistics.cpp:64
void memoryErrorMessage()
Definition: Statistics.cpp:174
bool d_result_log
Flag specifying if the results should be displayed in the results log.
Definition: Statistics.h:76
unsigned int dataSize()
Returns the size of the input data set.
Definition: Statistics.h:54
double variance()
Definition: Statistics.h:62
double d_sd
Definition: Statistics.h:85
void showResultsLog(bool show=true)
Definition: Statistics.h:49
virtual bool run()
Actually does the job. Should be reimplemented in derived classes.
Definition: Statistics.cpp:49