5 * Created by Sarah Westcott on 1/7/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
12 /***********************************************************************/
14 EstOutput RareCalc::getValues(int n){
16 EstOutput output(3,0);
18 double richness = (double)numBins;
21 double varTerm1 = 0.0000;
22 double varTerm2 = 0.0000;
24 double rSummation = 0;
25 for(int i=0;i<numBins;i++){
26 int N_ni = numSeqs - bins->get(i);
27 rSummation += (bMatrix[N_ni][n]);
29 varTerm1 += (bMatrix[N_ni][n] * (1.0 - bMatrix[N_ni][n] / bMatrix[numSeqs][n]));
31 for(int j=i+1;j<numBins;j++){
32 varTerm2 += ( bMatrix[N_ni-bins->get(j)][n] - bMatrix[N_ni][n] * bMatrix[numSeqs-bins->get(j)][n] / bMatrix[numSeqs][n]);
36 richness -= (rSummation / bMatrix[numSeqs][n]);
37 varS = (varTerm1 + 2 * varTerm2) / bMatrix[numSeqs][n];
38 float sd = pow(varS, 0.5);
42 output[1] = richness - 1.96 * sd;
43 output[2] = richness + 1.96 * sd;
48 m->errorOut(e, "RareCalc", "getValues");
53 /***********************************************************************/