Changes from tags/0.4.2 at r4197 to tags/0.4.3 at r4197


Ignore:
Location:
tags/0.4.3
Files:
1 added
67 edited

Legend:

Unmodified
Added
Removed
  • tags/0.4.3/AUTHORS

    r4197 r4197  
    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
  • tags/0.4.3/ChangeLog

    r4197 r4197  
    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
     
    2525======================================================================
    2626
     27version 0.4.3:
     28  - http://dev.thep.lu.se/yat/log/branches/0.4-stable?rev=1743&stop_rev=1436
     29  - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.3&order=id
     30
    2731version 0.4.2:
    2832  - http://dev.thep.lu.se/yat/log/branches/0.4-stable?rev=1435&stop_rev=1302
    29   - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.1&order=id
     33  - http://dev.thep.lu.se/yat/query?milestone=yat+0.4.2&order=id
    3034
    3135version 0.4.1:
  • tags/0.4.3/NEWS

    r4197 r4197  
    22
    33See the end of this file for copyrights and conditions.
     4
     5Version 0.4.3 (released 23 January 2009)
     6
     7  - Fisher::p_value is now correct (bug #461)
     8  - Fisher::oddsratio is now correct (bug #460)
     9
     10  A complete list of closed tickets can be found here [[br]]
     11  http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.4.3
    412
    513Version 0.4.2 (released 25 August 2008)
     
    5664{{{
    5765Copyright (C) 2003, 2006 Jari Häkkinen
    58 Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    59 Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     66Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     67Copyright (C) 2009 Peter Johansson
    6068
    6169This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/TODO

    r4197 r4197  
    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
  • tags/0.4.3/bootstrap

    r4197 r4197  
    77# Copyright (C) 2006 Jari Häkkinen
    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
  • tags/0.4.3/build_support/version.m4

    r4197 r4197  
    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://trac.thep.lu.se/yat
     
    2930m4_define([MINOR_VERSION], [4])
    3031# PATCH - Modify for every released patch
    31 m4_define([PATCH_VERSION], [2])
     32m4_define([PATCH_VERSION], [3])
    3233
    3334# DEV_BUILD - When rolling a tarball we set this to `false'. In
     
    5455# yat-0.4.1  1:0:0
    5556# yat-0.4.2  1:1:0
     57# yat-0.4.3  1:2:0
    5658#
    57 m4_define([LT_VERSION], [1:1:0])
     59m4_define([LT_VERSION], [1:2:0])
    5860
    5961
  • tags/0.4.3/doc/doxygen.config.in

    r4197 r4197  
    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#
  • tags/0.4.3/doc/namespaces.doxygen

    r4197 r4197  
    44  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2006, 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
  • tags/0.4.3/test/Makefile.am

    r4197 r4197  
    3636  consensus_inputranker_test data_lookup_1d_test  distance_test \
    3737  ensemble_test feature_selection_test fileutil_test \
    38   index_test inputranker_test \
     38  fisher_test index_test inputranker_test \
    3939  iterator_test kernel_lookup_test kernel_test \
    4040  knn_test matrix_lookup_test matrix_test \
     
    6666feature_selection_test_SOURCES = feature_selection_test.cc
    6767fileutil_test_SOURCES = fileutil_test.cc
     68fisher_test_SOURCES = fisher_test.cc
    6869index_test_SOURCES = index_test.cc
    6970inputranker_test_SOURCES = inputranker_test.cc
  • tags/0.4.3/test/README

    r4197 r4197  
    55Copyright (C) 2006 Jari Häkkinen
    66Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     7Copyright (C) 2008 Peter Johansson
    78
    89This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/test/crossvalidation_test.cc

    r4197 r4197  
    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
  • tags/0.4.3/test/distance_test.cc

    r4197 r4197  
    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
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/test/ensemble_test.cc

    r4197 r4197  
    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
  • tags/0.4.3/test/iterator_test.cc

    r4197 r4197  
    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
  • tags/0.4.3/test/subset_generator_test.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/Makefile.am

    r4197 r4197  
    55# Copyright (C) 2003 Daniel Dalevi, Jari Häkkinen, Peter Johansson
    66# Copyright (C) 2004 Jari Häkkinen, Peter Johansson, Cecilia Ritz
    7 # Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    8 # Copyright (C) 2008 Jari Häkkinen
     7# Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    98#
    109# This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/yat/classifier/BootstrapSampler.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/ConsensusInputRanker.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/ConsensusInputRanker.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/CrossValidationSampler.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/FeatureSelectorIR.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/FeatureSelectorRandom.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/GaussianKernelFunction.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/GaussianKernelFunction.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/IGP.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/IRRank.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/IRRetrieve.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/InputRanker.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_ReciprocalDistance.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_ReciprocalDistance.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_ReciprocalRank.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_ReciprocalRank.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_Uniform.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KNN_Uniform.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/KernelFunction.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/PolynomialKernelFunction.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/utility.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/classifier/utility.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/random/Makefile.am

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/Kernel.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/KernelBox.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/KernelBox.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/KernelTriCube.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/KernelTriCube.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/Makefile.am

    r4197 r4197  
    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
  • tags/0.4.3/yat/regression/OneDimensionalWeighted.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/statistics/Averager.cc

    r4197 r4197  
    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
    6   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2008 Peter Johansson
     7  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/yat/statistics/Averager.h

    r4197 r4197  
    77  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
    88  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2008 Peter Johansson
     9  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    1110
    1211  This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/yat/statistics/AveragerPair.cc

    r4197 r4197  
    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
    7   Copyright (C) 2008 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
    87
    98  This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/yat/statistics/AveragerPair.h

    r4197 r4197  
    77  Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2008 Peter Johansson
     9  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    1110
    1211  This file is part of the yat library, http://dev.thep.lu.se/yat
  • tags/0.4.3/yat/statistics/AveragerPairWeighted.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/statistics/AveragerWeighted.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/statistics/Fisher.cc

    r4197 r4197  
    3131#include <gsl/gsl_randist.h>
    3232
     33#include <algorithm>
     34
    3335namespace theplu {
    3436namespace yat {
     
    3739 
    3840  Fisher::Fisher()
    39     : a_(0), b_(0), c_(0), d_(0), oddsratio_(1.0)
     41    : a_(0), b_(0), c_(0), d_(0), minimum_size_(10), oddsratio_(1.0)
    4042  {
    4143  }
     
    9395      throw std::runtime_error("runtime_error: Table in Fisher is not valid\n");
    9496    }
     97    a_ = a;
     98    b_ = b;
     99    c_ = c;
     100    d_ = d;
    95101
    96     oddsratio_=(a*d)/(b*d);
     102    oddsratio_=static_cast<double>(a*d)/static_cast<double>(b*c);
    97103    return oddsratio_;
    98104  }
     
    101107  double Fisher::p_value() const
    102108  {
    103     if (oddsratio_>1.0)
    104       return 2*p_value_one_sided();
    105     if (oddsratio_<1.0){
    106       // If oddsratio is less than unity
    107       // Two-sided p-value is
    108       // P(X <= oddsratio) + P(X >= 1/oddsratio) =
    109       // P(X <= oddsratio) + P(X <= oddsratio)
    110       // 2 * (P(X < oddsratio) + P(X = oddsratio))
    111       // 2 * (1 - P(X >= oddsratio) + P(X = oddsratio))
    112       if (calculate_p_exact())
    113         return 2*(1-p_value_one_sided()+
    114                   gsl_ran_hypergeometric_pdf(a_,a_+b_,c_+d_, a_+c_)
    115                   );
    116       // if p is calculated approximatively correction is not needed
    117       return 2*(1-p_value_one_sided());
    118 
    119     }
    120     return 1.0;
     109    if (calculate_p_exact())
     110      return p_value_exact();
     111    return p_value_approximative();
    121112  }
    122113
     
    124115  double Fisher::p_value_one_sided() const
    125116  {
    126     if ( calculate_p_exact() )
    127       return p_value_exact();
    128     return p_value_approximative();
     117    if (!calculate_p_exact()) {
     118      if (oddsratio_<1.0)
     119        return 1.0-p_value_approximative()/2.0;
     120      return p_value_approximative()/2.0;
     121    }
     122    return statistics::cdf_hypergeometric_P(c_, c_+d_, a_+b_, a_+c_);
    129123  }
    130124
     
    137131  double Fisher::p_value_exact() const
    138132  {
    139     // Since the calculation is symmetric and cdf_hypergeometric_P
    140     // loops up to k we choose the smallest number to be k and mirror
    141     // the matrix. This choice makes the p-value two-sided.
     133    double res=0;
     134    double a, c, tmp;
     135    expected(a, tmp, c, tmp);
     136    // sum P(x) over x for which abs(x-E(a))>=abs(a-E(a)) 
    142137
    143     if (a_<b_ && a_<c_ && a_<d_)
    144       return statistics::cdf_hypergeometric_P(a_,a_+b_,c_+d_,a_+c_);
    145     else if (b_<a_ && b_<c_ && b_<d_)
    146       return  statistics::cdf_hypergeometric_P(b_,a_+b_,c_+d_,b_+d_);
    147     else if (c_<a_ && c_<b_ && c_<d_)
    148       return  statistics::cdf_hypergeometric_P(c_,c_+d_,a_+b_,a_+c_);
     138    // counting left tail
     139    int k = static_cast<int>(a - std::abs(a_-a));
     140    if (k>=0)
     141      res = cdf_hypergeometric_P(k, a_+b_, c_+d_, a_+c_);
     142    // counting right tail
     143    k = static_cast<int>(c - std::abs(c_-c));
     144    if (k>=0)
     145      res += cdf_hypergeometric_P(k, c_+d_, a_+b_, a_+c_);
    149146
    150     return statistics::cdf_hypergeometric_P(d_,c_+d_,a_+b_,b_+d_);
    151 
     147    // avoid p>1 due to double counting middle one
     148    return std::min(1.0, res);
    152149  }
    153150
  • tags/0.4.3/yat/statistics/Fisher.h

    r4197 r4197  
    8484         
    8585   
    86     ///
    87     /// @return Chi2 score
    88     ///
     86    /**
     87       The Chi2 score is calculated as \f$ \sum
     88       \frac{(O_i-E_i)^2}{E_i}\f$ where \a E is expected value and \a
     89       O is observed value.
     90
     91       \return Chi2 score
     92    */
    8993    double Chi2(void) const;
    9094
     
    114118    const unsigned int& minimum_size(void) const;
    115119
    116     ///
    117     /// If oddsratio is larger than unity, two-sided p-value is equal
    118     /// to 2*p_value_one_sided(). If oddsratio is smaller than unity
    119     /// two-sided p-value is equal to 2*(1-p_value_one_sided()). If
    120     /// oddsratio is unity two-sided p-value is equal to unity.
    121     ///
    122     /// If all elements in table is at least minimum_size(), a Chi2
    123     /// approximation is used.
    124     ///
    125     /// @return 2-sided p-value
    126     ///
     120    /**
     121       If all elements in table is at least minimum_size(), a Chi2
     122       approximation is used.
     123       
     124       Otherwise a two-sided p-value is calculated using the
     125       hypergeometric distribution
     126       \f$ \sum_k P(k) \f$ where summation runs over \a k such that
     127       \f$ |k-<a>| \ge |a-<a>| \f$.
     128
     129       \return two-sided p-value
     130    */
    127131    double p_value() const;
    128132   
     
    142146       \hline a&b \tabularnewline \hline c&d \tabularnewline \hline
    143147       \end{tabular} \f] as \f$ \frac{ad}{bc} \f$
     148
     149       Object will remember the values of \a a, \a b, \a c, and \a d.
    144150
    145151       @return odds ratio.
  • tags/0.4.3/yat/statistics/tTest.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/statistics/utility.cc

    r4197 r4197  
    3131#include <gsl/gsl_statistics_double.h>
    3232
     33#include <algorithm>
    3334#include <cassert>
    3435
     
    4142  {
    4243    double p=0;
    43     for (size_t i=0; i<=k; i++)
     44    size_t top = std::min(k, std::min(n1, t));
     45    for (size_t i=std::max(0, static_cast<int>(t-n2)); i<=top; i++)
    4446      p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t);
    4547    return p;
  • tags/0.4.3/yat/utility/ColumnStream.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/ColumnStream.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/Index.h

    r4197 r4197  
    3333namespace utility {
    3434
    35   ///
    36   /// Internal Class keeping track of which samples are support vectors and
    37   /// not. The first nof_sv elements in the vector are indices of the
    38   /// support vectors
    39   ///
     35  /**
     36     \brief Class for storing indices of, e.g., a MatrixLookup.
     37
     38     This class is basically a wrapper around std::vector<size_t>. The
     39     major differences are that the class is constant and copying is
     40     performed in constant time (shallow copy).
     41   */
    4042  class Index
    4143  {
  • tags/0.4.3/yat/utility/OptionHelp.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/OptionSwitch.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/OptionSwitch.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/TypeInfo.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/WeNNI.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/stl_utility.cc

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/stl_utility.h

    r4197 r4197  
    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
  • tags/0.4.3/yat/utility/utility.cc

    r4197 r4197  
    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.