Matrix Science header

ms_quant_stats.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_quant_stats.hpp                                                   #
00004 # 'msparser' toolkit                                                         #
00005 # Statistics routines and distributions for peptide and protein quantitation #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2012 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #     $Author: martins $ #
00012 #       $Date: 2015/01/08 15:34:26 $ #
00013 #   $Revision: 1.8 $ #
00014 # $NoKeywords::                                                            $ #
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_QUANT_STATS_HPP
00019 #define MS_QUANT_STATS_HPP
00020 
00021 #ifdef _WIN32
00022 #pragma warning(disable:4251)   // Don't want all classes to be exported
00023 #pragma warning(disable:4786)   // Debug symbols too long
00024 #   ifndef _MATRIX_USE_STATIC_LIB
00025 #       ifdef MS_MASCOTRESFILE_EXPORTS
00026 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00027 #       else
00028 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00029 #       endif
00030 #   else
00031 #       define MS_MASCOTRESFILE_API
00032 #   endif
00033 #else
00034 #   define MS_MASCOTRESFILE_API
00035 #endif
00036 
00037 #include <deque>
00038 #include <string>
00039 #include <vector>
00040 
00041 namespace matrix_science {
00042 
00048 
00049 
00058     class MS_MASCOTRESFILE_API ms_quant_stats
00059     {
00060         public:
00061 
00063             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, unsigned int * const numLow, unsigned int * const numHigh);
00064 
00066             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
00067 
00069             static void testRosners(const std::vector<double> &sample, unsigned int maxOutliers, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
00070 
00072             static int testDixonsN9(unsigned long sampleSize, double min, double x2, double xn_1, double max, double sigLevel);
00073 
00075             static int testGrubbsN2(unsigned long sampleSize, double min, double mean, double max, double stdev, double sigLevel);
00076 
00078             static bool testShapiroWilkW(const std::vector<double> &sample, double * const W, double * const pValue);
00079 
00081             static double binomialCoefficient(unsigned int n, unsigned int k);
00082 
00084             static double sum(const std::vector<double> &data);
00085 
00087             static double sumsq(const std::vector<double> &data);
00088 
00090             static std::vector<double> meanCentre(const std::vector<double> &data, double mean);
00091 
00093             static std::vector<double> logTransform(const std::vector<double> &data);
00094 
00096             static std::vector<double> expTransform(const std::vector<double> &logData);
00097 
00099             static double sortedMedian(const std::vector<double> &data);
00100 
00102             static double sortedMedian(const std::deque<double> &data);
00103 
00105             static double unsortedMedian(const std::vector<double> &data);
00106 
00108             static double arithmeticMean(const std::vector<double> &data);
00109 
00111             static double weightedArithmeticMean(const std::vector<double> &data, const std::vector<double> &weights);
00112 
00114             static double geometricMean(const std::vector<double> &data);
00115 
00117             static double weightedGeometricMean(const std::vector<double> &data, const std::vector<double> &weights);
00118 
00120             static double arithmeticStandardDeviation(const std::vector<double> &data, double arithmeticMean);
00121 
00123             static double arithmeticStandardErrorOfMean(double arithmeticStdev, unsigned long sampleSize);
00124 
00126             static double geometricStandardDeviation(const std::vector<double> &data, double geometricMean);
00127 
00129             static double arithmeticStandardErrorOfMedian(double arithmeticStdev, unsigned long sampleSize);
00130 
00132             static double weightedArithmeticStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
00133 
00135             static double weightedArithmeticStandardError(const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
00136 
00138             static double weightedGeometricStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
00139 
00141             static double normalCumulativeProbability(double x0);
00142 
00144             static double normalCriticalValue(double p);
00145 
00147             static double studentsCriticalValue(unsigned int df, double sigLevel);
00148 
00150             static double chisqUpperCriticalValue(unsigned int df, double sigLevel);
00151 
00153             static double chisqLowerCriticalValue(unsigned int df, double sigLevel);
00154 
00156             static double snedecorsCriticalValue(unsigned int df1, unsigned int df2, double sigLevel);
00157 
00159             static double calculateNormalMeanPvalue(double populationMean, double mean, double stdev, unsigned long sampleSize);
00160 
00162             static double calculateNormalMedianPvalue(double populationMedian, double median, double stdev, unsigned long sampleSize);
00163 
00165             static double calculateNormalWeightedPvalue(double populationMean, double weightedMean, const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
00166 
00168             static double medianStandardErrorCorrection(unsigned long sampleSize);
00169 
00171             static double poissonDensity(double lambda, unsigned int k);
00172 
00173         private:
00174             // No instances.
00175             ms_quant_stats();
00176             ~ms_quant_stats();
00177 
00178             // No copying.
00179             ms_quant_stats(const ms_quant_stats& src);
00180             ms_quant_stats& operator=(const ms_quant_stats& right);
00181     }; // end of quantitation_group
00183 }   // matrix_science namespace
00184 
00185 #endif // MS_QUANT_STATS_HPP
00186 
00187 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51