help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: leasqr help


From: Francesco Potorti`
Subject: Re: leasqr help
Date: Wed, 09 Apr 2008 17:54:06 +0200

>> >In case a have a "Matrix" as data, would it work right ?
>> >In this case my "function" should return a matrix as well ?
>> 
>> Supposing that by "data" you mean the "observed values", the answer is
>> no: the function should return a scalar value.
>
>Sorry, but this is not true ... if you do not mean a different
>'leasqr.m'; I have the one with the help text below in mind.
>
>leasqr accepts vectors of observed values, and the user-supplied
>function should compute a vector with as many elements as observed
>values.

Yes, this is true.  But the vectors are intended as "one observation per
row", like this:

% x = column vector or matrix of independent variables, 1 row per
%   observation: x = [x0 x1....xm].
% y = column vector of observed values, same number of rows as x.

This is conceptually the same as calling f once per row, that is,
f(x,p)(i) only depends on x(i,:) and p.  True, you can write an f
function that behaves differently, but this is not how leasqr is
intended to be used.

The main issue is that the error that leasqr minimises is the sum of
squared differences y-f(x,p), so the only distance measure available is
point by point.  If you want to minimise something different, you could
look inside leasqr.m ancd change the few lines where the sum of sqared
differences is computed (look for the variable called ss).

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key


reply via email to

[Prev in Thread] Current Thread [Next in Thread]