## Friday, October 30, 2009

### Comparing two methods of measurement in Matalb or Octave

How to compare two methods that measure the same variable? How to check if one method produces results constantly higher than the other method and if the difference is significant? How to determine whether new method, can replace the old one? The anwser to these question lies in the analysis of bias between the two method of measurement . Below is a Matlab implementation of Ordinary least products (OLP) regression analysis  that can be used to anwser to these questions.

```function res = mgr(X,Y,varargin) % res = mgr(X,Y) % Mean Geometric Regression (i.e. Ordinary least products (OLP) regression) % % Used to evaluate two measurement methods in terms of fixed and % proportional bias as described in . % % INPUT % X - vector of values calculated by the first method. % Y - vector of values calculated by the second method. % boolean - plot or not scattergram of the values % string - label of x axis of scattergram % string - label of y axis of scattergram % % % EXAMPLE from : % % M1=[132 138 144 146 148 152 158 130 162 168 172 174 180 180 188 194 194 200 200 204 210 210 216 220 220]; % M2=[130 134 132 140 150 144 150 122 160 150 160 178 168 174 186 172 182 178 196 188 180 196 210 190 202]; % % res=mgr(M1,M2) %res = % % a: 13.9506 % b: 0.8611 % a_CI95: [-6.9476 32.3364] % b_CI95: [0.7576 0.9788] % % res=mgr(M1,M2,true); % produces scattergram % res=mgr(M1,M2,true,'SBP(M1)','SBP(M2)'); % produces scattergram with x and y axis % % labels of 'SBP(M1)' and 'SBP(M2)' % % NOTE: % The above calculated values of a and b agree with the values in  % Values of CI95 are marginally different, becouse, as expalined in , % they are calculated using approximate formulas. % %REFERENCE: % J Ludbrook, Comparing methods of measurement, Clinical and % Experimental Pharmacology and Physiology, 1997:24,193-203 % % %```Full code of the above script is here.
Script was tested on Matlab 2007a and in Octave 3.2. En example of the scattergram that is generated by the script is below. This scattergram is the same as an example given in .

### References

 J Ludbrook, Comparing methods of measurement, Clinical and Experimental Pharmacology and Physiology, 1997:24,193-203.