Least Absolute Deviation solution of a linear system

Ben Abbott bpabbott at mac.com
Sat Jan 24 21:38:19 CST 2009


On Jan 24, 2009, at 11:03 PM, etienne at isr.ist.utl.pt wrote:
> Quoting "James R. Van Zandt" <jrvz at comcast.net> (Thu, 22 Jan 2009  
> 21:17:49 -0500):
>>
>> Octave has a function ols which find the least squares solution of an
>> overdetermined linear system.  I propose the following function,  
>> which
>> finds the "least abolute deviation" solution - the one that minimizes
>> the sum of the absolute values of the deviations.  It is more work to
>> find (requiring solution of a linear program), but is more robust to
>> outliers.  See below for references.
>>
>> The LAD solution is the analog of the median.  You will recall that
>> the median of an odd number of values is well defined, but for an  
>> even
>> number of values we normally add a condition so we get the center of
>> the interval between the centermost values.  This implementation of
>> the LAD does not have this kind of rule.  If there is more than one
>> solution that minimizes the sum of absolute values of the deviations,
>> it doesn't attempt to return the "middle" one.
>>
>>            - Jim Van Zandt

>
>  Hi All,
>
> just to say that I tested (summarily) James' olad() function w/  
> Octave 3.0.3 and it worked fine. Should it go to octave, or octave- 
> forge?
>
>  Cheers,
>
>  Etienne

Personally, I'd like to have this contribution be included in Octave's  
core (optimization).

However, the code needs some work to be compliant with Octave's  
standard.

	http://wiki.octave.org/wiki.pl?StandardsMFiles

Specifically ...

	* put spaces after commas and before open parenthesis

	* spaces surrounding equals

For example ...

>  Aeq=[A eye(ra) -eye(ra)];
>  CHI=zeros(ca,cy);

should be

>  Aeq = [A, eye(ra), -eye(ra)];

>  CHI = zeros (ca, cy);

It is my understanding that lowercase is preferred (?)

>  chi = zeros (ca, cy);


Ben


More information about the Octave-maintainers mailing list