in reply to Numerical Analysis Challenge

Basically, you're trying to find the regresssion for the function:
sales = base_sale + K * log( i )
where K = multiple/log( logbase ). There's no way by regression alone to determine multiple or logbase separately.

The above regression is not strictly linear, but if you tranform i to x via

 x = log i 
(or
i = e^x
), then you get:
sales = base_sale + K * x
which is a straight linear regression once you apply the transform correctly to your interval variable. Thus, you simply have to do some stat summation over your data set, and you're all set; the exact equations for that should be in any numerical math text (I don't see any Perl modules that do regression easily, but the routine isn't hard for this).

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: Numerical Analysis Challenge
by scain (Curate) on Jan 03, 2002 at 01:01 UTC
    Oh course, Masem is largely right; however it looks to me like there is a module Statistics::OLS that will do linear least squares, which is exactly what you would want. I have never used it though, so YMMV for sure.

    Scott

Re: Re: Numerical Analysis Challenge
by LogicalChaos (Beadle) on Jan 03, 2002 at 05:45 UTC
Re: Re: Numerical Analysis Challenge
by tomazos (Deacon) on Jan 03, 2002 at 01:22 UTC
    Dooh. You are right: $multiple and $log combine to give a single constant.

    Transforming on x = log i turns into into a straight linear regression and from some java code I found laying around the net I've got the alrgorithym for getting the line of best fit.

    Theoretically I should be all set. Thanks for your help.