# Changeset 447

Ignore:
Timestamp:
Dec 15, 2005, 7:51:18 PM (17 years ago)
Message:

added copy constructor for KernelView? and added construction of KernelView? in test

Location:
trunk
Files:
4 edited

Unmodified
Removed
• ## trunk/lib/statistics/Fisher.cc

 r297 Fisher::Fisher(bool b) : Score(b), a_(0), b_(0), c_(0), d_(0) : Score(b), a_(0), b_(0), c_(0), d_(0), cutoff_column_(0), cutoff_row_(0) { } void expected(double& a, double& b, double& c, double& d) { double N=a_+b_+c_+d_; a =((a_+b_)*(a_+c_)) / N; b =((a_+b_)*(b_+d_)) / N; c =((c_+d_)*(a_+c_)) / N; d =((c_+d_)*(b_+d_)) / N; } double Fisher::oddsratio(const double a, // If a column sum or a row sum is zero, the table is nonsense if ((a==0 || d==0) && (c==0 || b==0)){ //Peter, should through exception std::cerr << "Warning: Fisher: Table is not valid\n"; return 1.0; if (absolute_ && ratio<1) return 1/ratio; else return ratio; return ratio; } double Fisher::p_value() const { double p=1; if (a
• ## trunk/lib/statistics/Fisher.h

 r295 namespace statistics { /// /// Class for Fisher's exact test. /// @brief Fisher's exact test. /// Fisher's Exact test is a procedure that you can use for data /// in a two by two contingency table: \f[ \begin{tabular}{|c|c|} /// 10 a Chi-square test is reasonable to use. /// /// @note The statistica assumes that each column and row sum, /// respectively, are fixed. Just because you have a 2x2 table, this /// assumtion does not necessarily match you experimental upset. See /// e.g. Barnard's test for alternative. /// class Fisher : public Score /// /// Cutoff sets the limit whether a value should go into the left /// or the right column. @see score /// /// @return reference to cutoff for column /// inline double& cutoff_column(void) { return cutoff_column_; } /// /// Cutoff sets the limit whether a value should go into the left /// or the right row. @see score /// /// @return reference to cutoff for row /// inline double& cutoff_row(void) { return cutoff_row_; } /// /// Calculates the expected values under the null hypothesis. /// a' = (a+c)(a+b)/(a+b+c+d) /// void expected(u_int& a, u_int& b, u_unt& c, u_int& d); /// /// minimum_size is the threshold for when the p-value calculation /// is performed using a Chi2 approximation. /// /// @return reference to minimum_size /// inline u_int& minimum_size(void){ return minimum_size_; } /// /// If absolute, the p-value is the two-sided p-value. If all /// elements in table is at least minimum_size, a Chi2 /// approximation is used. /// /// @return p-value /// double p_value() const; /// double p_value() const; /// /// calculated as \f$\sum w_i \f$, so when each weight is /// unitary the same table is created as in the unweighted version /// /// @return odds ratio /// /// @note /// double score(const gslapi::vector& x, const gslapi::vector& y, private: double oddsratio(const double a, const double b, const double c, const double d) const; double p_value_approximative(void) const; double p_value_exact(void) const; std::vector train_set_; gslapi::vector weight_; u_int a_; u_int b_; u_int c_; u_int d_; double oddsratio(const double a, const double b, const double c, const double d) const; double a_; double b_; double c_; double d_; double cutoff_column_; double cutoff_row_; double minimum_size_; };
• ## trunk/lib/statistics/ROC.h

 r414 /// /// Changes minimum_size , i.e. the threshold when a normal /// minimum_size is the threshold for when a normal /// approximation is used for the p-value calculation. /// inline void minimum_size(const u_int minimum_size) { minimum_size_ = minimum_size; } /// @return reference to minimum_size /// inline u_int& minimum_size(void){ return minimum_size_; } private:
• ## trunk/test/score_test.cc

 r420 ok = false; } roc.minimum_size(20); roc.minimum_size() = 20; p = roc.p_value(); if (p > pow(10, -8.0) | p < pow(10, -9.0)){
Note: See TracChangeset for help on using the changeset viewer.