Re: Code for 2 new Gnumeric functions (logarithmic regression)



On Thu, Sep 12, 2002 at 11:13:25PM -0400, Jody Goldberg wrote:
I like the notion of the functions but can not apply them to the
stable tree.  Please regenerate the patch against the development
version 1.1.x and we can look into integrating.

Hello,

This is a request that you consider to incorporate the attached code
for two new functions into Gnumeric. The patch is now against current
CVS, and the algorithm of LOGFIT has become faster since my last post.

Since some time has passed since my last post, I repeat the needed
information:

The functions both perform logarithmic regression. The fitted
logarithmic equations can mimic the trend of some types of scientific
data and serve as calibration-equations for the calculation of
unknowns.

1.)

``LOGREG'' fits the parameters `a' and `b' of the equation

"y = b + a * log(x)".

It transforms x's to z=log(x) and then calls
``general_linear_regression'' written by others to perform a linear
regression of y's and z's. Although the transformation to log(x) could
also be done within a worksheet, logarithmic regression seemed general
enough to me to deserve an extra function. In Excel, this
functionality is not available as a function, but is available as a
``trend curve'' within graphs. ``general_linear_regression'' written
by others provides multidimensional regression, although the
corresponding ``LINEST'' function is not yet quite ready to deal with
more than one independent variable. ``LOGREG'' is prepared to use this
functionality, as soon as LINEST uses it, too --- although I do not
know if multidimensional regression of logarithmically transformed
independent data is useful in statistical praxis.

2.)

``LOGFIT'' fits the parameters `sign', `a', `b', and `c' of the
equation

"y = a + b * log (sign * (x - c))", with sign in {-1, +1}.

This equation can be well adapted to point clouds which, although
shaped ``logarithmic'', are shifted in the direction of the x-axis. In
these cases, ``LOGREG'' would often fail or produce bad fits. At work,
I have often encountered such data in assays which correlate optical
densities with substance amounts. If sign == -1, the graph of the
equation is mirrored across the y-axis.

``LOGFIT'' performs non-linear fitting. It searches for the best c
while computing the corresponding a and b for each c by a simple
linear regression. This approach could also be carried out using a
general solver, but then the success would depend on the choosing of
suitable starting parameters (I have tried it with the Excel solver),
and the preparation of such a worksheet would be complicated.

A function corresponding to ``LOGFIT'' is not available in Excel.

Regards,

Olaf

Attachment: logfit_logreg.patch
Description: Text document



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