]> git.donarmstrong.com Git - mothur.git/blobdiff - logsd.cpp
more calculator edits and added coverage and whittaker
[mothur.git] / logsd.cpp
index 94fa4590d79eeac44ee5b1019dc5fb2daf512001..e959ab8cb8c1bcce52350331653903345b89c48b 100644 (file)
--- a/logsd.cpp
+++ b/logsd.cpp
@@ -3,12 +3,11 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/23/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
 #include "logsd.h"
-#include "calculator.h"
 
 /***********************************************************************/
 
@@ -29,7 +28,7 @@ EstOutput LogSD::getValues(SAbundVector* rank){
                SAbundVector rankw = SAbundVector(dvec, mr,nb,ns);
                SAbundVector *rank = &rankw;*/
                
-               data.resize(2,0);
+               data.resize(3,0);
                int numInd = rank->getNumSeqs();
                int numSpec = rank->getNumBins();
                double snRatio = (double)numSpec/numInd;
@@ -79,17 +78,21 @@ EstOutput LogSD::getValues(SAbundVector* rank){
                        if(diff > maxDiff)
                                maxDiff = diff;
                }
-               
-               double DStatistic = (maxDiff + .5)/numSpec;
+
+
                /*cout << "LogSD:\n";
                cout << "D Test Statistic = " << DStatistic << "\n";
                cout << ".05 confidence value = " << .89196/sqrt(numSpec) << "\n";
                cout << "If D Test Statistic is greater than the critical value then the data fits the Log Series Distribution model w/ 95% confidence.\n\n";*/
                
-               data[0] = DStatistic;
-               data[1] = .89196/sqrt(numSpec);
+               data[0] = (maxDiff + .5)/numSpec;
+               data[1] = 0.886/sqrt(numSpec);
+               data[2] = 1.031/sqrt(numSpec);
+               
                if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
                if (isnan(data[1]) || isinf(data[1])) { data[1] = 0; }
+               if (isnan(data[2]) || isinf(data[2])) { data[2] = 0; }
+               
                return data;
        }
        catch(exception& e) {