QtiPlot  0.9.8.2
Anova.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : Anova.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2010 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : ANOVA
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 Anova_H
00030 #define Anova_H
00031 
00032 #include <StatisticTest.h>
00033 #include <tamu_anova.h>
00034 
00036 class Anova : public StatisticTest
00037 {
00038     Q_OBJECT
00039 
00040     public:
00041         Anova(ApplicationWindow *parent, bool twoWay = false, double level = 0.05);
00042 
00043         void showAnovaTwoWayInteractions(bool show = true){d_show_interactions = show;};
00044         void setAnovaTwoWayModel(int type){d_anova_type = (gsl_anova_twoway_types)type;};
00045         bool addSample(const QString& colName, int aLevel = 1, int bLevel = 1);
00046         bool run();
00047 
00048         virtual QString logInfo();
00049 
00051 
00052         double fStat(){return d_at.F;};
00053         double statistic(){return d_at.F;};
00054         double pValue(){return d_at.p;};
00055         double ssm(){return d_at.SSTr;};
00057 
00059 
00060         double fStatA(){return d_att.FA;};
00061         double fStatB(){return d_att.FB;};
00062         double fStatAB(){return d_att.FAB;};
00063 
00064         double pValueA(){return d_att.pA;};
00065         double pValueB(){return d_att.pB;};
00066         double pValueAB(){return d_att.pAB;};
00067 
00068         double ssa(){return d_att.SSA;};
00069         double ssb(){return d_att.SSB;};
00070         double ssab(){return d_att.SSAB;};
00071 
00072         double msa(){return d_att.MSA;};
00073         double msb(){return d_att.MSB;};
00074         double msab(){return d_att.MSAB;};
00076 
00077         double sse(){if (d_two_way) return d_att.SSE; return d_at.SSE;};
00078         double sst(){if (d_two_way) return d_att.SST; return d_at.SST;};
00079         double mse(){if (d_two_way) return d_att.MSE; return d_at.MSE;};
00080 
00082         virtual Table *resultTable(const QString& name = QString());
00083         virtual void outputResultsTo(Table *);
00084 
00085     protected:
00086         bool twoWayANOVA();
00087         bool oneWayANOVA();
00088         void freeMemory();
00089         QString levelName(int level, bool b = false);
00090 
00091         bool d_two_way;
00092         bool d_show_interactions;
00093         gsl_anova_twoway_types d_anova_type;
00094         QList<Statistics *> d_data_samples;
00095         QList<int> d_factorA_levels;
00096         QList<int> d_factorB_levels;
00097 
00098         tamu_anova_table d_at;
00099         tamu_anova_table_twoway d_att;
00100 };
00101 
00102 #endif