compareTwoMDVs

PURPOSE ^

Compare the 2 sets of mdvs

SYNOPSIS ^

function [totalz,zscore] = compareTwoMDVs(mdv1,mdv2)

DESCRIPTION ^

 Compare the 2 sets of mdvs

 totalz is the sum of all zscores
 zscore is the calculated difference for each mdv element distributed
       across all the points
 mdv1,mdv2 each containing fields:
        - mdv - the calculated mdv distribution converted from the idv
        solved from each point contained in their respective samples sampX
        - names - the names of the metabolites 
        - ave - the average of each mdv element across all of the points
        - stdev - the standard dev for each mdv element across all points
 Wing Choi 2/11/08

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [totalz,zscore] = compareTwoMDVs(mdv1,mdv2)
0002    
0003 % Compare the 2 sets of mdvs
0004 %
0005 % totalz is the sum of all zscores
0006 % zscore is the calculated difference for each mdv element distributed
0007 %       across all the points
0008 % mdv1,mdv2 each containing fields:
0009 %        - mdv - the calculated mdv distribution converted from the idv
0010 %        solved from each point contained in their respective samples sampX
0011 %        - names - the names of the metabolites
0012 %        - ave - the average of each mdv element across all of the points
0013 %        - stdev - the standard dev for each mdv element across all points
0014 % Wing Choi 2/11/08
0015 
0016 
0017 
0018 if (nargin < 2)
0019     disp '[totalz,zscore] = compareTwoMDVs(mdv1,mdv2)';
0020     return;
0021 end
0022 
0023 %Compute the mean and standard deviation of each mdv and then get a z-score
0024 % between them (=(mean1-mean2)/(sqrt(sd1^2+sd2^2))).
0025 %Add up all the z-scores (their absolute value) and have this function return
0026 % that value.
0027 
0028 names = mdv1.names;
0029 ave1 = mdv1.ave;
0030 std1 = mdv1.stdev;
0031 ave2 = mdv2.ave;
0032 std2 = mdv2.stdev;
0033 zscore = [];
0034 
0035 %zscore = (ave1-ave2)./(sqrt(std1.^2+std2.^2));
0036 a1 = zeros(length(ave1),1);
0037 a1 = (a1+.02).^2;
0038 zscore = (ave1-ave2)./(sqrt(std1.^2+std2.^2+a1));
0039 
0040 % for l = 1:length(names)
0041 %     % sometimes we end up with zeroes for stdev if the mdvs are all exactly the same: i.e. zeroes.
0042 %     if (isnan(zscore(l,1)))
0043 %         disp(sprintf('nan found at %d th name',l));
0044 %         disp('replacing it with a -1');
0045 %         zscore(l,1) = -1;
0046 %         mdv1
0047 %         mdv1.names
0048 %         mdv2
0049 %         pause;
0050 %     end
0051 % end
0052 totalz = sum(abs(zscore));
0053 if isnan(totalz)
0054     totalz = -1;
0055 end
0056 %disp(sprintf('total Z-score is: %d',totalz));
0057 
0058 return
0059 end

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003