]> git.donarmstrong.com Git - mothur.git/blobdiff - efron.cpp
added get.repseqs command, started matrix output command
[mothur.git] / efron.cpp
index e84364160e2a48dd6e87927ade301c942565088d..aeeb4c2f33e79102a77d891abd9961c9e616992e 100644 (file)
--- a/efron.cpp
+++ b/efron.cpp
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 5/13/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
@@ -16,15 +16,16 @@ EstOutput Efron::getValues(SAbundVector* rank){
        try {
                data.resize(1,0);
                
-               if(m > rank->size()-1) {
-                       cout << "Error in the 'efron' calculator. 'size' must be less than the length of the smalled sabund vector.\n";
+               double n = (double)rank->getNumSeqs();
+               if(m > n) {
+                       cout << "Error in the 'efron' calculator. 'size' must be less than the length of the smallest sabund vector.\n";
                        data[0] = 0;
                        return data;
                }
                
                double sum = 0;
                for(int i = 1; i < rank->size(); i++)
-                       sum += pow(-1, (double)(i+1)) * pow(((double)m / (double)(rank->size()-1)), i) * (double)(rank->get(i));
+                       sum += pow(-1, (double)(i+1)) * pow(((double)m / n), i) * (double)(rank->get(i));
 
                data[0] = sum;