Changeset 1746


Ignore:
Timestamp:
Jan 23, 2009, 5:59:11 PM (12 years ago)
Author:
Peter
Message:

Merged patch release 0.4.3 to the trunk. Delta 0.4.3 - 0.4.2.

Location:
trunk
Files:
61 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/AUTHORS

    r1487 r1746  
    55Copyright (C) 2005 Jari Häkkinen, Peter Johansson
    66Copyright (C) 2006 Jari Häkkinen
    7 Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    8 Copyright (C) 2008 Jari Häkkinen
     7Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    98
    109Files are copyright by their respective authors. The contributions to
  • trunk/ChangeLog

    r1487 r1746  
    33======================================================================
    44Copyright (C) 2003 Daniel Dalevi
    5 Copyright (C) 2005, 2006 Jari Häkkinen
    6 Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    7 Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     5Copyright (C) 2006 Jari Häkkinen
     6Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7Copyright (C) 2009 Peter Johansson
    88
    99This file is part of yat library, http://dev.thep.lu.se/yat
     
    2323======================================================================
    2424
    25 
    2625version 0.5:
    2726  - http://dev.thep.lu.se/yat/log/trunk?rev=HEAD&stop_rev=1277
    2827  - http://dev.thep.lu.se/yat/query?milestone=0.5&order=id
    2928
     29version 0.4.3:
     30  - http://dev.thep.lu.se/yat/log/branches/0.4-stable?rev=1743&stop_rev=1436
     31  - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.3&order=id
     32
    3033version 0.4.2:
    3134  - http://dev.thep.lu.se/yat/log/branches/0.4-stable?rev=1435&stop_rev=1302
    32   - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.1&order=id
     35  - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.2&order=id
    3336
    3437version 0.4.1:
  • trunk/NEWS

    r1701 r1746  
    2020  A complete list of closed tickets can be found here [[br]]
    2121  http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.5
     22
     23Version 0.4.3 (released 23 January 2009)
     24
     25  - Fisher::p_value is now correct (bug #461)
     26  - Fisher::oddsratio is now correct (bug #460)
     27
     28  A complete list of closed tickets can be found here [[br]]
     29  http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.4.3
    2230
    2331Version 0.4.2 (released 25 August 2008)
  • trunk/TODO

    r1487 r1746  
    33======================================================================
    44Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     5Copyright (C) 2008 Peter Johansson
    56
    67This file is part of yat library, http://dev.thep.lu.se/yat
  • trunk/build_support/version.m4

    r1606 r1746  
    22#
    33# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     4# Copyright (C) 2009 Peter Johansson
    45#
    56# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    5253# yat-0.4.1  1:0:0
    5354# yat-0.4.2  1:1:0
     55# yat-0.4.3  1:2:0
    5456#
    5557m4_define([YAT_LT_CURRENT], [1])
    56 m4_define([YAT_LT_REVISION], [1])
     58m4_define([YAT_LT_REVISION], [2])
    5759m4_define([YAT_LT_AGE], [0])
    5860
  • trunk/doc/doxygen.config.in

    r1556 r1746  
    33
    44# Copyright (C) 2003, 2004 Jari Häkkinen
    5 # Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     5# Copyright (C) 2005 Peter Johansson
     6# Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    67# Copyright (C) 2008 Peter Johansson, Markus Ringnér
    78#
  • trunk/test/Makefile.am

    r1694 r1746  
    4949  data_weight_test data_weight_proxy_test distance_test \
    5050  ensemble_test feature_selection_test fileutil_test \
    51   index_test inputranker_test interpolation_test \
     51  fisher_test index_test inputranker_test interpolation_test \
    5252  iterator_test kernel_lookup_test kernel_test \
    5353  knn_test kolmogorov_smirnov_test large_file_test matrix_lookup_test \
     
    8383feature_selection_test_SOURCES = feature_selection_test.cc
    8484fileutil_test_SOURCES = fileutil_test.cc
     85fisher_test_SOURCES = fisher_test.cc
    8586index_test_SOURCES = index_test.cc
    8687inputranker_test_SOURCES = inputranker_test.cc
  • trunk/test/crossvalidation_test.cc

    r1487 r1746  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/test/distance_test.cc

    r1704 r1746  
    22
    33/*
    4   Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     4  Copyright (C) 2007 Jari Häkkinen, Markus Ringnér
     5  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    56  Copyright (C) 2009 Peter Johansson
    67
  • trunk/test/ensemble_test.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
     4  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    56  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    67
  • trunk/test/fisher_test.cc

    r1745 r1746  
    9898
    9999  f.oddsratio(10, 20, 20, 200);
    100   suite.add(suite.equal(f.p_value(), 0.0008119060627676223));
    101   suite.add(suite.equal(f.p_value_one_sided(), 0.0008119060627676223));
     100  suite.add(suite.equal_fix(f.p_value(), 0.000811906062767622,2e-17));
     101  suite.add(suite.equal_fix(f.p_value_one_sided(), 0.000811906062767622,2e-17));
    102102
    103103  // testing symmetry
     
    108108
    109109  f.oddsratio(1, 1, 1, 2);
    110   suite.add(suite.equal(f.p_value(), 1.0));
     110  suite.add(suite.equal(f.p_value(), 1.0, 2));
    111111  suite.add(suite.equal(f.p_value_one_sided(), 0.7));
    112112
    113113  f.oddsratio(1, 1, 2, 1);
    114   suite.add(suite.equal(f.p_value(), 1.0));
     114  suite.add(suite.equal(f.p_value(), 1.0, 2));
    115115  suite.add(suite.equal(f.p_value_one_sided(), 0.9));
    116116
  • trunk/test/iterator_test.cc

    r1585 r1746  
    22
    33/*
    4   Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     4  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/test/subset_generator_test.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     4  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/BootstrapSampler.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/ConsensusInputRanker.cc

    r1487 r1746  
    66  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/ConsensusInputRanker.h

    r1487 r1746  
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    99  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     10  Copyright (C) 2008 Peter Johansson
    1011
    1112  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/CrossValidationSampler.h

    r1487 r1746  
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    88  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2008 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/FeatureSelectorIR.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/FeatureSelectorRandom.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/GaussianKernelFunction.cc

    r1487 r1746  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/GaussianKernelFunction.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2004, 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/IGP.h

    r1487 r1746  
    55
    66/*
    7   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
     7  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
     8  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    89  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    910
  • trunk/yat/classifier/IRRank.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/IRRetrieve.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/InputRanker.cc

    r1487 r1746  
    55  Copyright (C) 2005 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_ReciprocalDistance.cc

    r1522 r1746  
    44
    55/*
    6   Copyright (C) 2008 Markus Ringnér
     6  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_ReciprocalDistance.h

    r1522 r1746  
    55
    66/*
    7   Copyright (C) 2008 Markus Ringnér
     7  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_ReciprocalRank.cc

    r1522 r1746  
    22
    33/*
    4   Copyright (C) 2008 Markus Ringnér
     4  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_ReciprocalRank.h

    r1522 r1746  
    55
    66/*
    7   Copyright (C) 2008 Markus Ringnér
     7  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_Uniform.cc

    r1522 r1746  
    22
    33/*
    4   Copyright (C) 2008 Markus Ringnér
     4  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KNN_Uniform.h

    r1522 r1746  
    55
    66/*
    7   Copyright (C) 2008 Markus Ringnér
     7  Copyright (C) 2008 Peter Johansson, Markus Ringnér
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/KernelFunction.h

    r1487 r1746  
    99  Copyright (C) 2005 Peter Johansson
    1010  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     11  Copyright (C) 2008 Peter Johansson
    1112
    1213  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/PolynomialKernelFunction.h

    r1487 r1746  
    77  Copyright (C) 2003 Peter Johansson
    88  Copyright (C) 2004, 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2008 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/classifier/utility.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
     4  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2008 Peter Johansson
  • trunk/yat/classifier/utility.h

    r1487 r1746  
    55
    66/*
    7   Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
     7  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    88  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    99  Copyright (C) 2008 Peter Johansson
  • trunk/yat/random/Makefile.am

    r1493 r1746  
    55# Copyright (C) 2005, 2006 Jari Häkkinen
    66# Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7# Copyright (C) 2008 Peter Johansson
    78#
    89# This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/Kernel.h

    r1487 r1746  
    99  Copyright (C) 2006 Jari Häkkinen
    1010  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     11  Copyright (C) 2008 Peter Johansson
    1112
    1213  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/KernelBox.cc

    r1487 r1746  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/KernelBox.h

    r1487 r1746  
    99  Copyright (C) 2006 Jari Häkkinen
    1010  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     11  Copyright (C) 2008 Peter Johansson
    1112
    1213  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/KernelTriCube.cc

    r1683 r1746  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/KernelTriCube.h

    r1487 r1746  
    55
    66/*
    7   Copyright (C) 2005 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2005 Peter Johansson
    88  Copyright (C) 2006 Jari Häkkinen
    99  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     10  Copyright (C) 2008 Peter Johansson
    1011
    1112  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/Makefile.am

    r1663 r1746  
    55# Copyright (C) 2006 Jari Häkkinen
    66# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7# Copyright (C) 2008 Peter Johansson
    78#
    89# This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/regression/OneDimensionalWeighted.cc

    r1487 r1746  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/statistics/Averager.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2005 Peter Johansson
    56  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    67  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
  • trunk/yat/statistics/AveragerPair.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2005 Peter Johansson
     6  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/statistics/AveragerPairWeighted.cc

    r1487 r1746  
    33/*
    44  Copyright (C) 2005 Peter Johansson, Markus Ringnér
    5   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    67  Copyright (C) 2008 Peter Johansson
    78
  • trunk/yat/statistics/AveragerWeighted.cc

    r1487 r1746  
    22
    33/*
    4   Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2004, 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    75  Copyright (C) 2008 Peter Johansson
    86
  • trunk/yat/statistics/Fisher.cc

    r1487 r1746  
    2929#include <gsl/gsl_randist.h>
    3030
     31#include <algorithm>
     32
    3133namespace theplu {
    3234namespace yat {
     
    3537 
    3638  Fisher::Fisher()
    37     : a_(0), b_(0), c_(0), d_(0), oddsratio_(1.0)
     39    : a_(0), b_(0), c_(0), d_(0), minimum_size_(10), oddsratio_(1.0)
    3840  {
    3941  }
     
    9193      throw std::runtime_error("runtime_error: Table in Fisher is not valid\n");
    9294    }
     95    a_ = a;
     96    b_ = b;
     97    c_ = c;
     98    d_ = d;
    9399
    94     oddsratio_=(a*d)/(b*d);
     100    oddsratio_=static_cast<double>(a*d)/static_cast<double>(b*c);
    95101    return oddsratio_;
    96102  }
     
    99105  double Fisher::p_value() const
    100106  {
    101     if (oddsratio_>1.0)
    102       return 2*p_value_one_sided();
    103     if (oddsratio_<1.0){
    104       // If oddsratio is less than unity
    105       // Two-sided p-value is
    106       // P(X <= oddsratio) + P(X >= 1/oddsratio) =
    107       // P(X <= oddsratio) + P(X <= oddsratio)
    108       // 2 * (P(X < oddsratio) + P(X = oddsratio))
    109       // 2 * (1 - P(X >= oddsratio) + P(X = oddsratio))
    110       if (calculate_p_exact())
    111         return 2*(1-p_value_one_sided()+
    112                   gsl_ran_hypergeometric_pdf(a_,a_+b_,c_+d_, a_+c_)
    113                   );
    114       // if p is calculated approximatively correction is not needed
    115       return 2*(1-p_value_one_sided());
    116 
    117     }
    118     return 1.0;
     107    if (calculate_p_exact())
     108      return p_value_exact();
     109    return p_value_approximative();
    119110  }
    120111
     
    122113  double Fisher::p_value_one_sided() const
    123114  {
    124     if ( calculate_p_exact() )
    125       return p_value_exact();
    126     return p_value_approximative();
     115    if (!calculate_p_exact()) {
     116      if (oddsratio_<1.0)
     117        return 1.0-p_value_approximative()/2.0;
     118      return p_value_approximative()/2.0;
     119    }
     120    return statistics::cdf_hypergeometric_P(c_, c_+d_, a_+b_, a_+c_);
    127121  }
    128122
     
    135129  double Fisher::p_value_exact() const
    136130  {
    137     // Since the calculation is symmetric and cdf_hypergeometric_P
    138     // loops up to k we choose the smallest number to be k and mirror
    139     // the matrix. This choice makes the p-value two-sided.
     131    double res=0;
     132    double a, c, tmp;
     133    expected(a, tmp, c, tmp);
     134    // sum P(x) over x for which abs(x-E(a))>=abs(a-E(a)) 
    140135
    141     if (a_<b_ && a_<c_ && a_<d_)
    142       return statistics::cdf_hypergeometric_P(a_,a_+b_,c_+d_,a_+c_);
    143     else if (b_<a_ && b_<c_ && b_<d_)
    144       return  statistics::cdf_hypergeometric_P(b_,a_+b_,c_+d_,b_+d_);
    145     else if (c_<a_ && c_<b_ && c_<d_)
    146       return  statistics::cdf_hypergeometric_P(c_,c_+d_,a_+b_,a_+c_);
     136    // counting left tail
     137    int k = static_cast<int>(a - std::abs(a_-a));
     138    if (k>=0)
     139      res = cdf_hypergeometric_P(k, a_+b_, c_+d_, a_+c_);
     140    // counting right tail
     141    k = static_cast<int>(c - std::abs(c_-c));
     142    if (k>=0)
     143      res += cdf_hypergeometric_P(k, c_+d_, a_+b_, a_+c_);
    147144
    148     return statistics::cdf_hypergeometric_P(d_,c_+d_,a_+b_,b_+d_);
    149 
     145    // avoid p>1 due to double counting middle one
     146    return std::min(1.0, res);
    150147  }
    151148
  • trunk/yat/statistics/Fisher.h

    r1487 r1746  
    8282         
    8383   
    84     ///
    85     /// @return Chi2 score
    86     ///
     84    /**
     85       The Chi2 score is calculated as \f$ \sum
     86       \frac{(O_i-E_i)^2}{E_i}\f$ where \a E is expected value and \a
     87       O is observed value.
     88
     89       \return Chi2 score
     90    */
    8791    double Chi2(void) const;
    8892
     
    112116    const unsigned int& minimum_size(void) const;
    113117
    114     ///
    115     /// If oddsratio is larger than unity, two-sided p-value is equal
    116     /// to 2*p_value_one_sided(). If oddsratio is smaller than unity
    117     /// two-sided p-value is equal to 2*(1-p_value_one_sided()). If
    118     /// oddsratio is unity two-sided p-value is equal to unity.
    119     ///
    120     /// If all elements in table is at least minimum_size(), a Chi2
    121     /// approximation is used.
    122     ///
    123     /// @return 2-sided p-value
    124     ///
     118    /**
     119       If all elements in table is at least minimum_size(), a Chi2
     120       approximation is used.
     121       
     122       Otherwise a two-sided p-value is calculated using the
     123       hypergeometric distribution
     124       \f$ \sum_k P(k) \f$ where summation runs over \a k such that
     125       \f$ |k-<a>| \ge |a-<a>| \f$.
     126
     127       \return two-sided p-value
     128    */
    125129    double p_value() const;
    126130   
     
    140144       \hline a&b \tabularnewline \hline c&d \tabularnewline \hline
    141145       \end{tabular} \f] as \f$ \frac{ad}{bc} \f$
     146
     147       Object will remember the values of \a a, \a b, \a c, and \a d.
    142148
    143149       @return odds ratio.
  • trunk/yat/statistics/tTest.cc

    r1487 r1746  
    66  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/statistics/utility.cc

    r1553 r1746  
    2929#include <gsl/gsl_statistics_double.h>
    3030
     31#include <algorithm>
    3132#include <cassert>
    3233
  • trunk/yat/utility/ColumnStream.cc

    r1487 r1746  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
  • trunk/yat/utility/ColumnStream.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of svndigest, http://dev.thep.lu.se/svndigest
  • trunk/yat/utility/Index.h

    r1528 r1746  
    3131namespace utility {
    3232
    33   ///
    34   /// Internal Class keeping track of which samples are support vectors and
    35   /// not. The first nof_sv elements in the vector are indices of the
    36   /// support vectors
    37   ///
     33  /**
     34     \brief Class for storing indices of, e.g., a MatrixLookup.
     35
     36     This class is basically a wrapper around std::vector<size_t>. The
     37     major differences are that the class is constant and copying is
     38     performed in constant time (shallow copy).
     39   */
    3840  class Index
    3941  {
  • trunk/yat/utility/OptionHelp.cc

    r1487 r1746  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/utility/OptionSwitch.cc

    r1634 r1746  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/utility/OptionSwitch.h

    r1487 r1746  
    66/*
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/utility/TypeInfo.cc

    r1487 r1746  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/utility/WeNNI.h

    r1726 r1746  
    66/*
    77  Copyright (C) 2004 Jari Häkkinen
    8   Copyright (C) 2005 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2005 Peter Johansson
    99  Copyright (C) 2006 Jari Häkkinen
    1010  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
  • trunk/yat/utility/stl_utility.cc

    r1487 r1746  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2008 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/yat/utility/stl_utility.h

    r1487 r1746  
    77  Copyright (C) 2004 Jari Häkkinen
    88  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2006 Jari Häkkinen
     10  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    1011  Copyright (C) 2008 Peter Johansson
    1112
  • trunk/yat/utility/utility.cc

    r1487 r1746  
    44  Copyright (C) 2005, 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2008 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
Note: See TracChangeset for help on using the changeset viewer.