Sip Posted November 1, 2005 Report Share Posted November 1, 2005 I've been banging my head against this for a couple of days now ... I have managed to confuse myself beyond belief so if you guys can help out, I'd really appreciate it! So I have n values in the form of a vector x. Call each of them x_i where 1 <= i <=n. Suppose I had to make a guess y that minimizes "error" with respect to these n values. If "error" is sum of absolute differences, then y = median(x) does the trick, right? If "error" is sum of squares of differences, then y = mean(x) does the trick, right? If I'm mistaken so far, please correct me! NOW, I want to pick a guess that minimizes relative error. So in other words, I want to minimize: sum i=1 to n of | (x_i - y) / x_i | Forget about divide by 0 problems for now. Is there an easy way to pick y in this case? Quote Link to comment Share on other sites More sharing options...
DominO123 Posted November 1, 2005 Report Share Posted November 1, 2005 Sip, I don't understand your question, what do you mean by picking y? Quote Link to comment Share on other sites More sharing options...
Sip Posted November 1, 2005 Author Report Share Posted November 1, 2005 (edited) Think of y as a guess for x. Suppose we know all x_i = 100. Then a really good guess for y = 100 since that will minimize both L1 error (sum abs(x_i - y) for all i) and L2 error (sum (x_i - y)^2 for all i) since both sums will be 0. Picking y=12 would be another choice but clearly worse than y=100 in this case Does it make sense what I mean by "pick y"? It's basically a best guess on what you think a given x_i will be. Now given any x, I think y=median(x) will minimize L1 error (among all possible y's from -inf to +inf). My question now is regarding the relative error. I think the median will also minimize the relative error but I'm not sure. As a side note, if all we knew about x is that it will be distributed uniformly from -inf to +inf (as in all possible real numbers are equally likely to occur in x), then obviously the best guess y=0. Edited November 1, 2005 by Sip Quote Link to comment Share on other sites More sharing options...
vava Posted November 1, 2005 Report Share Posted November 1, 2005 Sip - the reason you're confused, is 'cause you're all upside down. Maybe if your 'right' yourself, you'll be ablt to figure out your y. Quote Link to comment Share on other sites More sharing options...
DominO123 Posted November 1, 2005 Report Share Posted November 1, 2005 Think of y as a guess for x. Suppose we know all x_i = 100. Then a really good guess for y = 100 since that will minimize both L1 error (sum abs(x_i - y) for all i) and L2 error (sum (x_i - y)^2 for all i) since both sums will be 0. Picking y=12 would be another choice but clearly worse than y=100 in this case Does it make sense what I mean by "pick y"? It's basically a best guess on what you think a given x_i will be. Now given any x, I think y=median(x) will minimize L1 error (among all possible y's from -inf to +inf). My question now is regarding the relative error. I think the median will also minimize the relative error but I'm not sure. As a side note, if all we knew about x is that it will be distributed uniformly from -inf to +inf (as in all possible real numbers are equally likely to occur in x), then obviously the best guess y=0. Sip, why don't you use JMP? Quote Link to comment Share on other sites More sharing options...
Sip Posted November 1, 2005 Author Report Share Posted November 1, 2005 What's a JMP? and Vava, Movses did that Quote Link to comment Share on other sites More sharing options...
DominO123 Posted November 1, 2005 Report Share Posted November 1, 2005 (edited) What's a JMP? http://www.jmp.com/ I used to use that thing for statistics, I haven't used it much for non-numeric stuff. But since you did not know what it is, I doubt you would want to learn it just to use it just for that, but it is a very practicle software with such things, more particularly when you must enter data, it gives you various informations and has many options for comparing error ranges between samples and stuff. Edited November 1, 2005 by QueBeceR Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.