5 * Created by westcott on 12/17/10.
6 * Copyright 2010 Schloss Lab. All rights reserved.
12 /***********************************************************************/
13 EstOutput MemChi2::getValues(vector<SharedRAbundVector*> shared) {
19 int totalOtus = shared[0]->getNumBins();
20 //int totalGroups = shared.size();
23 for (int i = 0; i < shared[0]->getNumBins(); i++) {
24 if (shared[0]->getAbundance(i) != 0) { nonZeroA++; }
25 if (shared[1]->getAbundance(i) != 0) { nonZeroB++; }
29 for (int i = 0; i < shared[0]->getNumBins(); i++) {
30 int A = shared[0]->getAbundance(i);
31 int B = shared[1]->getAbundance(i);
36 double Aterm = A / (float) nonZeroA;
37 double Bterm = B / (float) nonZeroB;
40 for(int j=0;j<shared.size();j++){
41 if(shared[j]->getAbundance(i) != 0){ incidence++; }
45 sum += (((Aterm-Bterm)*(Aterm-Bterm))/incidence);
49 data[0] = sqrt(totalOtus * sum);
51 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
56 m->errorOut(e, "MemChi2", "getValues");
60 /***********************************************************************/