source: trunk/c++_tools/statistics/SAM.h @ 675

Last change on this file since 675 was 675, checked in by Jari Häkkinen, 15 years ago

References #83. Changing project name to yat. Compilation will fail in this revision.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1#ifndef _theplu_statistics_sam
2#define _theplu_statistics_sam
3
4// $Id: SAM.h 675 2006-10-10 12:08:45Z jari $
5
6/*
7  Copyright (C) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include "yat/statistics/Score.h"
28
29namespace theplu {
30  namespace utility {
31    class vector;
32  }
33  namespace classifier {
34    class DataLookWeighted1D;
35  }
36namespace statistics { 
37
38  /**
39     @brief Class for score used in Significance Analysis of
40     Microarrays (SAM).
41 
42     The score is similar to the Student t-test but with an added
43     fudge factor in denominator to avoid groups with small variance
44     getting a large score. \f$ \frac{m_x-m_y}{s+s_0} \f$
45
46     see http://www.pnas.org/cgi/content/abstract/98/9/5116 for
47     details
48  */   
49  class SAM : public Score
50  {
51
52  public:
53    ///
54    /// @param s0 \f$ s_0 \f$ is a fudge factor
55    ///
56    SAM(const double s0, bool absolute=true);
57
58    /**
59       \f$ \frac{m_x-m_y}{s+s_0} \f$ where \f$ m = \frac{1}{n_x}\sum
60       x_i \f$, \f$ s^2 = \left(\frac{1}{n_x}+\frac{1}{n_y} \right)
61       \frac{\sum (x_i-m_x)^2 + \sum(y_i-m_y)^2}{n_x+n_y-2} \f$, and
62       \f$ s_0 \f$ is the fudge factor.
63
64       @return SAM score. If absolute=true absolute value of t-score
65       is returned
66    */
67    double score(const classifier::Target& target, 
68                 const utility::vector& value); 
69
70    /**
71       \f$ \frac{m_x-m_y}{s+s_0} \f$ where \f$ m = \frac{\sum
72       w_ix_i}{w_i} \f$, \f$ s_0 \f$ is the fudge factor, and \f$ s^2
73       = \left(\frac{1}{n_x}+\frac{1}{n_y} \right) \frac{\sum
74       w_i(x_i-m_x)^2 + \sum w_i(y_i-m_y)^2}{n_x+n_y-2} \f$ where \f$
75       n \f$ is weighted version of number of data points \f$
76       \frac{\left(\sum w_i\right)^2}{\sum w_i^2} \f$.
77
78       @return weighted version of SAM score. If absolute=true
79       absolute value is returned
80    */
81    double score(const classifier::Target& target, 
82                 const classifier::DataLookupWeighted1D& value);         
83
84    /**
85       \f$ \frac{m_x-m_y}{s+s_0} \f$ where \f$ m = \frac{\sum
86       w_ix_i}{w_i} \f$, \f$ s_0 \f$ is the fudge factor, and \f$ s^2
87       = \left(\frac{1}{n_x}+\frac{1}{n_y} \right) \frac{\sum
88       w_i(x_i-m_x)^2 + \sum w_i(y_i-m_y)^2}{n_x+n_y-2} \f$ where \f$
89       n \f$ is weighted version of number of data points \f$
90       \frac{\left(\sum w_i\right)^2}{\sum w_i^2} \f$.
91
92       @return weighted version of SAM score. If absolute=true
93       absolute value is returned
94    */
95    double score(const classifier::Target& target, 
96                 const utility::vector& value, 
97                 const utility::vector& weight);         
98  private:
99    double s0_;
100  };
101
102}} // of namespace statistics and namespace theplu
103
104#endif
105
Note: See TracBrowser for help on using the repository browser.