5 * Created by westcott on 12/15/10.
6 * Copyright 2010 Schloss Lab. All rights reserved.
12 /***********************************************************************/
13 EstOutput Spearman::getValues(vector<SharedRAbundVector*> shared) {
17 SAbundVector savA = shared[0]->getSAbundVector();
18 SAbundVector savB = shared[1]->getSAbundVector();
20 double sumRanks = 0.0;
21 int numOTUS = shared[0]->getNumBins();
23 //calc the 2 denominators
24 for (int i = 0; i < shared[0]->getNumBins(); i++) {
26 int Aij = shared[0]->getAbundance(i);
27 int Bij = shared[1]->getAbundance(i);
29 int rankA = savA.get(Aij);
30 int rankB = savB.get(Bij);
32 sumRanks += ((rankA - rankB) * (rankA - rankB));
35 data[0] = 1.0 - ((6 * sumRanks) / (float) (numOTUS * (numOTUS-1)));
37 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
42 m->errorOut(e, "Soergel", "getValues");
46 /***********************************************************************/