]> git.donarmstrong.com Git - mothur.git/blobdiff - calculator.cpp
modified some calculators and other stuff - pds
[mothur.git] / calculator.cpp
index ffd452a479c16c9df3e133d09576eac67d33c5fa..71aa99cfb1c6f4f887389e530c1ceeed9dbfeef3 100644 (file)
@@ -746,96 +746,7 @@ void KS2SampleTest::doKSTest(vector<double> abun1, vector<double> abun2)//abun1
 }
 
 /***********************************************************************/
-double logS(double num)
-{
-       return -(1-num)*log(1-num)/num;
-}
 
-/***********************************************************************/
-/*void LogSD::doLogSD(vector<double> indVec, vector<double> specVec) //indVec = individuals vector, specVec = species vector
-{      try {
-               VecCalc vecCalc;
-               double numSpec = vecCalc.sumElements(specVec);//numSpec = The total number of species
-               cout << "number of species = " << numSpec << "\n";
-               double numInd = vecCalc.sumElements(vecCalc.multVecs(indVec, specVec));
-               double snRatio = numSpec/numInd;
-               double x = .5;
-               double step = .4999999999;
-               while(fabs(snRatio - logS(x)) > .00001) //This uses a binary search to find the value of x.
-               {
-                       if(logS(x) > snRatio)
-                               x += step;
-                       else
-                               x -= step;
-                       step /= 2;
-               }
-               double alpha = numInd*(1-x)/x;
-       
-               int ind;
-               cout << "Number of individuals:"; //Ask the user for the number of individuals.
-               cin >> ind;
-               double spec = alpha*pow(x, ind)/ind;
-               cout << "Number of species expected = " << spec << "\n" << "X value = " << x << "\n" << "Alpha value= " << alpha << "\n";//Outputs the number of species expected with the given number of individuals.
-       
-               vector<double> obsSpec;
-               vector<double> cObsSpec;
-               vector<double> expSpec;
-               vector<double> cExpSpec;
-               vector<double> cDiff;
-       
-               // Generates the cumulative observed species vector.
-               int oct = 1;
-               double octSumObs = 0;
-               for(int y = 0; y < specVec.size(); y++)
-               {
-                       if(indVec.at(y) - .5 < pow(2.0, oct))
-                               octSumObs += specVec.at(y);
-                       else
-                       {
-                               obsSpec.push_back(octSumObs);
-                               octSumObs = specVec.at(y);
-                               oct++;
-                       }
-                       if(y == specVec.size()-1)
-                               obsSpec.push_back(octSumObs);
-               }
-               cObsSpec = vecCalc.genCVec(obsSpec);
-               cObsSpec = vecCalc.add(cObsSpec,-.5);
-       
-               // Generates the cumulative expected species vector.
-               oct = 1;
-               double octSumExp = 0;
-               for(int g = 1; g <= indVec.at(indVec.size()-1); g++)
-               {
-                       if(g - .5 < pow(2.0, oct))
-                               octSumExp += alpha*pow(x,g)/(g);
-                       else
-                       {
-                               expSpec.push_back(octSumExp);
-                               octSumExp = alpha*pow(x,g)/(g);
-                               oct++;
-                       }
-                       if(g == indVec.at(indVec.size()-1))
-                               expSpec.push_back(octSumExp);
-               }
-               cExpSpec = vecCalc.genCVec(expSpec);
-       
-               // Statistical Analysis
-               double dTStat = vecCalc.findDStat(cObsSpec, cExpSpec, numSpec);
-               cout << "D Test Statistic = " << dTStat << "\n";
-               cout << ".05 confidence value = " << .89196/sqrt(numSpec) << "\n";
-               cout << ".01 confidence value = " << 1.0471/sqrt(numSpec) << "\n\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the LogSD class Function doLogSD. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the LogSD class function doLogSD. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}*/
-/***********************************************************************/
 void QStatistic::doQStat(vector<double> vec)//vec = The data vector.
 {      try {
                VecCalc vecCalc;