To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=78250





------- Additional comments from [EMAIL PROTECTED] Thu Jun 14 19:09:32 +0000 
2007 -------
The 2nd spreadsheet contains the calculations using a stable algorithm. You can
test this algorithm for RSQ() and see how it behaves comparatively to the
default implementation of RSQ().

Basically, the algorithm goes like this:
 1.) N*sum(Xi^2) - (sum(Xi))^2 is replaced by:
     N * sum(Xi - Xm)^2, where Xm = the MEAN of X
     the N will cancel later, so I did NOT multiply with N

 2.) N*sum(Xi*Yi) - (sum(Xi))*(sum(Yi)) is equivalent to:
     N*sum[(Xi-Xm)*(Yi-Ym)]

 3.) dividing the previous 2 quantities and canceling N gives:
     b = sum[(Xi-Xm)*(Yi-Ym)]/sum(Xi-Xm)^2

 4.) Ycalc-i = a + b * Xi
     adding every Ycalc gives:
     sum(Yc-i) = sum(a) + b*sum(Xi)
     however sum(Yc-i) = sum(Yi) = N*Ym, therefore
     N*Ym = N*a + N*b*Xm => canceling N
     Ym = a + b * Xm =>
     a = Ym - b * Xm
     [I actually could mathematically show that *this is indeed TRUE*.]

 5.) and final step, calculating R^2
     first calculate:
     Yfirst  = Yi - Ym
     Ysecond = Yi - Ycalc, then
     Yfirst - Ysecond, and
     Yfirst + Ysecond
     and finally:
     R^2 = (Yf - Ys)*(Yf + Ys)/((Yi - Ym)^2

As you can see, this algorithm works even for the very difficult test case I
provided.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to