X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=trialSwap2.cpp;h=71c3027db2c8bbe97265cb40af839c6a81a17b33;hb=9b53f130ac9af5e95444ce2e817fce25ed19ff03;hp=1524890c9c9ddda83a1d777982e59ac23ebb037b;hpb=e4470c6d8ddc83db4e55a2c530e804920c62b855;p=mothur.git diff --git a/trialSwap2.cpp b/trialSwap2.cpp index 1524890..71c3027 100644 --- a/trialSwap2.cpp +++ b/trialSwap2.cpp @@ -293,26 +293,30 @@ double TrialSwap2::t_test (double initialscore, int runs, double nullMean, vecto /**************************************************************************************************/ double TrialSwap2::getSD (int runs, vector scorevec, double nullMean) { - double sum = 0; - for(int i=0;icontrol_pressed) { return 0; } - sum += pow((scorevec[i] - nullMean),2); - } - return sqrt( (1/runs) * sum ); + try{ + double sum = 0; + for(int i=0;icontrol_pressed) { return 0; } + sum += pow((scorevec[i] - nullMean),2); + } + return sqrt( (1/double(runs)) * sum ); + } + catch(exception& e) { + m->errorOut(e, "TrialSwap2", "getSD"); + exit(1); + } } /**************************************************************************************************/ double TrialSwap2::get_zscore (double sd, double nullMean, double initscore) { - map ztable; - - ztable["0.00"] = 0.5; - - double z; - - z = (initscore - nullMean) / sd; - - return z; + try { + return (initscore - nullMean) / sd; + } + catch(exception& e) { + m->errorOut(e, "TrialSwap2", "get_zscore"); + exit(1); + } } /**************************************************************************************************/ int TrialSwap2::print_matrix(vector > &matrix, int nrows, int ncols)