First take a base year. It has to be a normal year when no natural calamity took place and the value decided to all the goods is 100. Changes in the prices are measured as a percentage of the base...
The same way you measure CPI, but you only take into consideration domestic goods. So if the prices of Sony, Siemens (any product produced outside USA)etc notebooks rises up 20% in USA this year, but...
In our simulations, we use this (in Matlab/Octave): function l=linearityindex(matrix) m=(matrix>matrix')+.5*(matrix==matrix'); rowsums=sum(m,2)-.5; n=length(rowsums);...