QtiPlot  0.9.8.2
Anova.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Anova.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2010 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : ANOVA
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 Anova_H
30 #define Anova_H
31 
32 #include <StatisticTest.h>
33 #include <tamu_anova.h>
34 
36 class Anova : public StatisticTest
37 {
38  Q_OBJECT
39 
40  public:
41  Anova(ApplicationWindow *parent, bool twoWay = false, double level = 0.05);
42 
43  void showAnovaTwoWayInteractions(bool show = true){d_show_interactions = show;};
44  void setAnovaTwoWayModel(int type){d_anova_type = (gsl_anova_twoway_types)type;};
45  bool addSample(const QString& colName, int aLevel = 1, int bLevel = 1);
46  bool run();
47 
48  virtual QString logInfo();
49 
51 
52  double fStat(){return d_at.F;};
53  double statistic(){return d_at.F;};
54  double pValue(){return d_at.p;};
55  double ssm(){return d_at.SSTr;};
57 
59 
60  double fStatA(){return d_att.FA;};
61  double fStatB(){return d_att.FB;};
62  double fStatAB(){return d_att.FAB;};
63 
64  double pValueA(){return d_att.pA;};
65  double pValueB(){return d_att.pB;};
66  double pValueAB(){return d_att.pAB;};
67 
68  double ssa(){return d_att.SSA;};
69  double ssb(){return d_att.SSB;};
70  double ssab(){return d_att.SSAB;};
71 
72  double msa(){return d_att.MSA;};
73  double msb(){return d_att.MSB;};
74  double msab(){return d_att.MSAB;};
76 
77  double sse(){if (d_two_way) return d_att.SSE; return d_at.SSE;};
78  double sst(){if (d_two_way) return d_att.SST; return d_at.SST;};
79  double mse(){if (d_two_way) return d_att.MSE; return d_at.MSE;};
80 
82  virtual Table *resultTable(const QString& name = QString());
83  virtual void outputResultsTo(Table *);
84 
85  protected:
86  bool twoWayANOVA();
87  bool oneWayANOVA();
88  void freeMemory();
89  QString levelName(int level, bool b = false);
90 
91  bool d_two_way;
93  gsl_anova_twoway_types d_anova_type;
94  QList<Statistics *> d_data_samples;
95  QList<int> d_factorA_levels;
96  QList<int> d_factorB_levels;
97 
98  tamu_anova_table d_at;
99  tamu_anova_table_twoway d_att;
100 };
101 
102 #endif