X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=efron.cpp;fp=efron.cpp;h=7e1cba8ce055b9c47042806839ea80236f10b3d4;hb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;hp=0000000000000000000000000000000000000000;hpb=1b73ff67c83892a025e597dabd9df6fe7b58206a;p=mothur.git diff --git a/efron.cpp b/efron.cpp new file mode 100644 index 0000000..7e1cba8 --- /dev/null +++ b/efron.cpp @@ -0,0 +1,36 @@ +/* + * efron.cpp + * Mothur + * + * Created by Thomas Ryabin on 5/13/09. + * Copyright 2009Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "efron.h" + +/***********************************************************************/ +EstOutput Efron::getValues(SAbundVector* rank){ + + try { + data.resize(1,0); + + double n = (double)rank->getNumSeqs(); + if(f > n || f == 0) { f = n; } + + double sum = 0; + for(int i = 1; i < rank->size(); i++){ + sum += pow(-1., i+1) * pow(((double)f / n), i) * (double)(rank->get(i)); + } + data[0] = sum; + + return data; + } + catch(exception& e) { + m->errorOut(e, "Efron", "getValues"); + exit(1); + } +} + + +/***********************************************************************/