5 * Created by Thomas Ryabin on 5/13/09.
6 * Copyright 2009 __MyCompanyName__. All rights reserved.
13 /***********************************************************************/
14 double Boneh::getV(double f1, double n, double rs) {
16 //cout << "f1 = " << f1 << "\nn = " << n << "\nrs = " << rs << "\n\n";
18 double accuracy = .0001;
21 double ls = v * (1 - pow((1 - f1/(n*v)), n));
23 //cout << "ls = " << ls << "\n";
25 while(abs(ls - rs) > accuracy) {
31 ls = v* (1 - pow((1 - f1/(n*v)), n));
34 // cout << "ls = " << ls << "\n";
40 /***********************************************************************/
41 EstOutput Boneh::getValues(SAbundVector* rank){
48 double n = (double)rank->size() - 1;
49 double f1 = (double)rank->get(1);
51 for(int i = 1; i < rank->size(); i++)
52 sum += (double)rank->get(i) * exp(-i);
54 if(rank->get(1) > sum)
59 for(int j = 1; j < rank->size(); j++)
60 sum += rank->get(j) * pow((1 - (double)j / n), n);
62 double v = getV(f1, n, sum);
64 // cout << "v = " << v << "\n";
67 for(int j = 1; j < rank->size(); j++)
68 sum += pow(1 - (double)rank->get(j) / n, n) * (1 - pow(1 - (double)rank->get(j) / n, m)) + v * pow(1 - f1/(n*v), n) * (1 - pow(1 - f1/(n*v), m));
77 cout << "Standard Error: " << e.what() << " has occurred in the Coverage class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
81 cout << "An unknown error has occurred in the Coverage class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
87 /***********************************************************************/