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: villek@matrixscience.com $ #
00012 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00013 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00014 # $NoKeywords::                                                            $ #
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_QUANT_STATS_HPP
00019 #define MS_QUANT_STATS_HPP
00020 
00021 
00022 #include <deque>
00023 #include <string>
00024 #include <vector>
00025 
00026 namespace matrix_science {
00027 
00033 
00034 
00043     class MS_MASCOTRESFILE_API ms_quant_stats
00044     {
00045         public:
00046 #ifndef SWIG
00047 
00048             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, unsigned int * const numLow, unsigned int * const numHigh);
00049 
00051             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
00052 
00054             static void testRosners(const std::vector<double> &sample, unsigned int maxOutliers, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
00055 #else // SWIG Multiple return values
00056             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod,                unsigned int * const OUTPUT, unsigned int * const OUTPUT);
00057             static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod,  double sigLevel, unsigned int * const OUTPUT, unsigned int * const OUTPUT);
00058             static void testRosners(const std::vector<double> &sample, unsigned int maxOutliers, double sigLevel, unsigned int * const OUTPUT, unsigned int * const OUTPUT);
00059 #endif
00060 
00062             static int testDixonsN9(unsigned long sampleSize, double min, double x2, double xn_1, double max, double sigLevel);
00063 
00065             static int testGrubbsN2(unsigned long sampleSize, double min, double mean, double max, double stdev, double sigLevel);
00066 #ifndef SWIG
00067 
00068             static bool testShapiroWilkW(const std::vector<double> &sample, double * const W, double * const pValue);
00069 #else // SWIG Multiple return values
00070             static bool testShapiroWilkW(const std::vector<double> &sample, double * const OUTPUT, double * const OUTPUT);
00071 #endif
00072 
00073             static double binomialCoefficient(unsigned int n, unsigned int k);
00074 
00076             static double sum(const std::vector<double> &data);
00077 
00079             static double sumsq(const std::vector<double> &data);
00080 
00082             static std::vector<double> meanCentre(const std::vector<double> &data, double mean);
00083 
00085             static std::vector<double> logTransform(const std::vector<double> &data);
00086 
00088             static std::vector<double> expTransform(const std::vector<double> &logData);
00089 
00091             static double sortedMedian(const std::vector<double> &data);
00092 
00094             static double sortedMedian(const std::deque<double> &data);
00095 
00097             static double unsortedMedian(const std::vector<double> &data);
00098 
00100             static double arithmeticMean(const std::vector<double> &data);
00101 
00103             static double weightedArithmeticMean(const std::vector<double> &data, const std::vector<double> &weights);
00104 
00106             static double geometricMean(const std::vector<double> &data);
00107 
00109             static double weightedGeometricMean(const std::vector<double> &data, const std::vector<double> &weights);
00110 
00112             static double arithmeticStandardDeviation(const std::vector<double> &data, double arithmeticMean);
00113 
00115             static double arithmeticStandardErrorOfMean(double arithmeticStdev, unsigned long sampleSize);
00116 
00118             static double geometricStandardDeviation(const std::vector<double> &data, double geometricMean);
00119 
00121             static double arithmeticStandardErrorOfMedian(double arithmeticStdev, unsigned long sampleSize);
00122 
00124             static double weightedArithmeticStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
00125 
00127             static double weightedArithmeticStandardError(const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
00128 
00130             static double weightedGeometricStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
00131 
00133             static double normalCumulativeProbability(double x0);
00134 
00136             static double normalCriticalValue(double p);
00137 
00139             static double studentsCriticalValue(unsigned int df, double sigLevel);
00140 
00142             static double chisqUpperCriticalValue(unsigned int df, double sigLevel);
00143 
00145             static double chisqLowerCriticalValue(unsigned int df, double sigLevel);
00146 
00148             static double snedecorsCriticalValue(unsigned int df1, unsigned int df2, double sigLevel);
00149 
00151             static double calculateNormalMeanPvalue(double populationMean, double mean, double stdev, unsigned long sampleSize);
00152 
00154             static double calculateNormalMedianPvalue(double populationMedian, double median, double stdev, unsigned long sampleSize);
00155 
00157             static double calculateNormalWeightedPvalue(double populationMean, double weightedMean, const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
00158 
00160             static double medianStandardErrorCorrection(unsigned long sampleSize);
00161 
00163             static double poissonDensity(double lambda, unsigned int k);
00164 
00165         private:
00166             // No instances.
00167             ms_quant_stats();
00168             ~ms_quant_stats();
00169 
00170             // No copying.
00171             ms_quant_stats(const ms_quant_stats& src);
00172             ms_quant_stats& operator=(const ms_quant_stats& right);
00173     }; // end of quantitation_group
00175 }   // matrix_science namespace
00176 
00177 #endif // MS_QUANT_STATS_HPP
00178 
00179 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:30