]> git.donarmstrong.com Git - mothur.git/blob - efron.cpp
working on pam
[mothur.git] / efron.cpp
1 /*
2  *  efron.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 5/13/09.
6  *  Copyright 2009Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "efron.h"
11
12 /***********************************************************************/
13 EstOutput Efron::getValues(SAbundVector* rank){
14
15         try {
16                 data.resize(1,0);
17                 
18                 double n = (double)rank->getNumSeqs();
19                 if(f > n || f == 0) {   f = n;  }
20                 
21                 double sum = 0;
22                 for(int i = 1; i < rank->size(); i++){
23                         sum += pow(-1., i+1) * pow(((double)f / n), i) * (double)(rank->get(i));
24                 }
25                 data[0] = sum;
26                 
27                 return data;
28         }
29         catch(exception& e) {
30                 m->errorOut(e, "Efron", "getValues");
31                 exit(1);
32         }
33 }
34
35
36 /***********************************************************************/