Problem of robust fitting using the "robustfit" function

3 次查看(过去 30 天)
I am using the function "robustfit" to fit a plane(3D) but I have a problem:
I do three different calls for this function but I have not the same result those are the calls:
data: x, y, z (vectors)
call-1:
p = robustfit([x y],z)
normal = [p(2) p(3) -1]/ norm([p(2) p(3) -1])
normal = 0.5448273 0.8371124 -0.0490510
call-2:
p = robustfit([y z],x)
normal = [-1 p(2) p(3)]/ norm([-1 p(2) p(3)])
normal = 0.5460477 0.8377283 -0.0065613
call-3:
p = robustfit([x z],y)
normal = [p(2) -1 p(3) ]/ norm([p(2) -1 p(3)])
normal = 0.5451328 0.8374704 -0.0043365
So how can I know which is the correct normal
thank you in advance

回答(2 个)

Matt Tearle
Matt Tearle 2011-4-28
There really is no "right" answer, because it's a matter of how you view the problem. robustfit uses the residuals to calculate the weighting, but residual means the difference in the observed/predicted response variable. In your case, it looks like the points lie around a plane that is almost vertical ( normal(3) is small in all cases). This means that the residuals will be much greater when looking at z = f(x,y) than when looking at x = f(y,z) or y = f(x,z). Consequently, the weighting for a given point will be different in each formulation. In other words, different points are "outliers" in different formulations. To see this, try:
[p,s1] = robustfit([x y],z);
[p,s2] = robustfit([y z],x);
[p,s3] = robustfit([x z],y);
plotmatrix([s1.w,s2.w,s3.w])
This will plot the weightings against each other. I'm guessing you'll see reasonable correlation between s2 and s3, but not so great with s1.
This means that each formulation will give you a slightly different plane (because it's down-weighting different data points). I'd probably trust the last two, rather than the first.

Massinissa
Massinissa 2011-4-29
thank you very much for your response!
when I plot the weightings, I see that, I think you're right :)
but the problem is the same when using the ordinary least squares method, which is supposed not using weightings!!
p = robustfit([x y],z,'ols')
p = robustfit([y z],x,'ols')
p = robustfit([x z],y,'ols')
I get 3 result different :(
  1 个评论
Matt Tearle
Matt Tearle 2011-4-29
But OLS still "weights" in that the objective function to minimize is the sum of the square errors, ie the squared residuals. So you have the same problem: the size of the residuals is different depending on how you look at the fit (z = f(x,y) vs. y = f(x,z) vs. x = f(y,z)). And because OLS is *squaring* the errors, again different points will be more "outlier-ish" than others in the different formulations.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Support Vector Machine Regression 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by