Hi Rafael,

you are right: when the magnitude of the outliers is too large, lsq_splin is not always good. But if you increase the number of points, you could have something better (with the same example (ie 50 rather than 5) replace x by x = %pi * [-1:0.01:1]').

Best regards

Calixte

On 05/03/2013 04:15, Rafael Guerra wrote:

Hi Calixte,

Thanks for your feedback, the beatiful example and very useful script.

The weighted least squares cubic spline fitting function (lsq_splin) seems to work very well for outliers of moderate magnitude. However, it seems to fail for larger outliers:

// Replace for instance the three outliers defined in your script by:

z(10,10)=50;

z(30,20)=50;

z(10,40)=50;

Sinha and Schunck (1992) address this problem using a two-stage procedure, where a robust local algorithm MLMS (moving least median of squares of error) is run first to get rid of the outliers. Thereafter, weighted least squares cubic splines are used. MLMS seems very computationally intensive.

A different approach is the Loess method - see for instance W.G. Jacoby (2000).

Best regards,

Rafael G.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Calixte Denizet
Sent: Monday, March 04, 2013 4:01 PM
To: [email protected]
Subject: Re: [Scilab-users] Surface smoothing in Scilab, immune to outliers

Hi Rafael,

You can try to use lsq_splin along the axes x and y.

It seems to work on the following example:

x = %pi * [-1:0.05:1]';

z = sin(x)*cos(x)';

f = gcf();

f.color_map = jetcolormap(32);

subplot(131);

xtitle("Exact values");

plot3d(x, x, z, 70, 70);

e=gce();

e.color_flag = 1;

z = z + 0.5*rand(z);

z(10,10)=5;

z(30,20)=5;

z(10,40)=5;

subplot(132);

xtitle("Perturbated values");

plot3d(x, x, z, 70, 70);

e=gce();

e.color_flag = 1;

zz=zeros(z);

w=linspace(-%pi,%pi,5)';

for i=1:size(z,'r')

[y,d]=lsq_splin(x', z(i,:), w);

zz(i,:)=interp(x', w, y, d);

end

for i=1:size(zz,'c')

[y,d]=lsq_splin(x, zz(:,i), w);

zz(:,i)=interp(x, w, y, d);

end

subplot(133);

xtitle("Smoothed values");

plot3d(x, x, zz, 70, 70);

e=gce();

e.color_flag = 1;

Best regards

Calixte

On 04/03/2013 04:36, Rafael Guerra wrote:

> Hello,

>

> Does somebody know if there are Scilab functions capable of replacing

> outliers via some local robust fitting in 2D, i.e., that smooths

> experimental data z=f(x,y) and is immune to strong outliers.

>

> PS: CASCI in Atoms has a lowess function which does this via local

> robust linear fitting but for functions of one variable only.

>

> Thanks and regards,

> Rafael Guerra

>

>

>

>

> --

> View this message in context:

> http://mailinglists.scilab.org/Surface-smoothing-in-Scilab-immune-to-o

> utliers-tp4026119.html Sent from the Scilab users - Mailing Lists

> Archives mailing list archive at Nabble.com.

> _______________________________________________

> users mailing list

> [email protected] <mailto:[email protected]>

> http://lists.scilab.org/mailman/listinfo/users

--

Calixte Denizet

Software Development Engineer

-----------------------------------------------------------

Scilab Enterprises

143bis rue Yves Le Coz - 78000 Versailles, France http://www.scilab-enterprises.com

_______________________________________________

users mailing list

[email protected] <mailto:[email protected]>

http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users


--
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
http://www.scilab-enterprises.com

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to