Post Reply 
[WP34s] Linear and non-linear regression with L.R.
05-22-2014, 07:39 PM (This post was last modified: 05-22-2014 07:43 PM by Dieter.)
Post: #1
[WP34s] Linear and non-linear regression with L.R.
The 34s offers a L.R. command for various types of regression curves with two parameters. I am not quite happy with a few points:

1. Obviously the function is called "L.R." for historic reasons: earlier HPs like the 34C exclusively offered a Linear Regression, so the command was named accordingly. However, the 34s can do a lot more: It can calculate five different fits, i.e. linear, exponential, logarithmic, a power function, and even "the best of all these". That's why this function should be renamed to something more universal, e.g. REGR. Also the two parameters could simply be called a and b, which would make the whole thing more readable.

2. The PDF manual states that the function returns two regression coefficients a0 and a1. But it does not say where which coefficient is returned. #-) After some tests it seems that a0 is returned in X and a1 in Y. This should be added.

3. and most important: the function does not work as described in the manual. For the exponentional and power fit, the result returned in X is not a0, it is ln a0. This should be fixed. Not in the manual, but in the software.

Example: try an exponential fit for [0, 1] and [1, e]. Since y = ex this should yield 1 for a0 as well as a1. But instead a zero is returned in X.

Dieter
Find all posts by this user
Quote this message in a reply
05-22-2014, 08:07 PM
Post: #2
RE: [WP34s] Linear and non-linear regression with L.R.
Let me try to answer:
  1. In any of the cases covered, it's still a linear regression - either immediately or with transformed variables. For those old enough: it may be a linear regression in a diagram with one or two logarithmic scales.
  2. What you complain about was already taken care of in the manual v3.2 published 15 months ago. #-)
    BTW, from a mathematical point of view, calling the two regression coefficients a0 and a1 is the most general approach - you immediately know that e.g. a1 belongs to x^1.
  3. Thanks for reporting that. We'll look into it.
d:-)
Find all posts by this user
Quote this message in a reply
05-22-2014, 08:39 PM (This post was last modified: 05-22-2014 08:41 PM by Dieter.)
Post: #3
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 08:07 PM)walter b Wrote:  In any of the cases covered, it's still a linear regression - either immediately or with transformed variables.

Yes, I know how the different fits are calculated. But still the result is a linear fit only in one single case. All others are non-linear. And that's how the manual states it: it does not say ln y = ln a0 + a1 x, but y = a0 · ea1 x.

Quote:What you complain about was already taken care of in the manual v3.2 published 15 months ago. #-)

Hm. Sourceforge.net has a manual file dated 2014-02-04. The file name says "3_2.pdf" while the picture on the first page says "v. 3.1_3333". In any case it has the same text in the IOP as my version 3330: "[L.R.] returns the parameters a1 and a0 of the fit curve through the data points accumulated in the summation registers, according to the curve fit model selected (see LINF, EXPF, POWERF, and LOGF)." And that's it. If this is the version from last February, where can I find a newer version that was published a year earlier than this ?-)

Quote:BTW, from a mathematical point of view, calling the two regression coefficients a0 and a1 is the most general approach - you immediately know that e.g. a1 belongs to x^1.

There are different mathematical points of view. Your example is fine for a polynomial fit, where an is the coefficient at xn. Another common application in statistics is a multiple linear regression. Here the coefficients are also called an, but they refer to the variable xn.

Quote:Thanks for reporting that. We'll look into it.

Great, thanks.

Dieter
Find all posts by this user
Quote this message in a reply
05-22-2014, 09:15 PM
Post: #4
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 08:39 PM)Dieter Wrote:  
(05-22-2014 08:07 PM)walter b Wrote:  What you complain about was already taken care of in the manual v3.2 published 15 months ago. #-)

Hm. Sourceforge.net has a manual file dated 2014-02-04. The file name says "3_2.pdf" while the picture on the first page says "v. 3.1_3333". In any case it has the same text in the IOP as my version 3330: "[L.R.] returns the parameters a1 and a0 of the fit curve through the data points accumulated in the summation registers, according to the curve fit model selected (see LINF, EXPF, POWERF, and LOGF)." And that's it. If this is the version from last February, where can I find a newer version that was published a year earlier than this ?-)

No idea where you found that file - I don't see it on the linked site. Confused
Anyway, please let me quote from the manual published on 22.2.2013:

"Returns the parameters a1 (in Y) and a0 (in X) of the fit curve through the data points accumulated in the summation registers, according to the curve fit model selected (see LINF, EXPF, POWERF, and LOGF)."

You find that manual here though I bet you've known that. BTW, there will be a v3.3 manual available soon as advertized in another thread.

d:-)
Find all posts by this user
Quote this message in a reply
05-22-2014, 09:27 PM
Post: #5
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 09:15 PM)walter b Wrote:  No idea where you found that file - I don't see it on the linked site.

Hm. Should I add a screenshot with a big red arrow ?-)
Click the link, take a look at the file list, find "Manual_wp_34s_3_1.pdf".

Quote:Anyway, please let me quote from the manual published on 22.2.2013:

Ah, that's the printed manual. So the one I quoted still is the last PDF version?

Quote:"Returns the parameters a1 (in Y) and a0 (in X) of the fit curve through the data points accumulated in the summation registers, according to the curve fit model selected (see LINF, EXPF, POWERF, and LOGF)."

That sounds better. ;-)

Quote:BTW, there will be a v3.3 manual available soon as advertized in another thread.

PDF or print?

Dieter
Find all posts by this user
Quote this message in a reply
05-22-2014, 10:47 PM
Post: #6
RE: [WP34s] Linear and non-linear regression with L.R.
...3_1.pdf vs 3_2.pdf.

Be gentle Walter...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-23-2014, 06:15 AM (This post was last modified: 05-23-2014 06:16 AM by Dieter.)
Post: #7
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 10:47 PM)rprosperi Wrote:  ...3_1.pdf vs 3_2.pdf.

Ah, yes, sorry - it's indeed ...3_1.pdf. Must have been changed by the evil dwarfs. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
05-24-2014, 02:45 PM
Post: #8
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 09:27 PM)Dieter Wrote:  
(05-22-2014 09:15 PM)walter b Wrote:  BTW, there will be a v3.3 manual available soon as advertized in another thread.

PDF or print?

Spiral bound for you. Smile

d:-)
Find all posts by this user
Quote this message in a reply
05-25-2014, 01:42 PM
Post: #9
RE: [WP34s] Linear and non-linear regression with L.R.
(05-22-2014 07:39 PM)Dieter Wrote:  For the exponentional and power fit, the result returned in X is not a0, it is ln a0. This should be fixed. Not in the manual, but in the software.

As promised we looked into that and fixed it so it will work the way it did on the HP-42S. Pauli uploaded the update so it will be in next build of WP 34S as well as WP 31S. Thanks for the head up.

d:-)
Find all posts by this user
Quote this message in a reply
05-28-2014, 01:39 PM
Post: #10
RE: [WP34s] Linear and non-linear regression with L.R.
(05-25-2014 01:42 PM)walter b Wrote:  As promised we looked into that and fixed it

Great, thank you.

Quote:so it will work the way it did on the HP-42S.

Whatever this means, I never had a 42s. Did I already say that I do not think it's a good idea for a user manual to refer to half a dozen of other manuals?

Quote:Pauli uploaded the update so it will be in next build of WP 34S as well as WP 31S.

Just to be sure: I updated to the latest available version today, which seems to be 3.3 3653. Here the L.R. bug is still present.

Dieter
Find all posts by this user
Quote this message in a reply
05-28-2014, 02:58 PM
Post: #11
RE: [WP34s] Linear and non-linear regression with L.R.
(05-28-2014 01:39 PM)Dieter Wrote:  ... I never had a 42s. Did I already say that I do not think it's a good idea for a user manual to refer to half a dozen of other manuals?

That can be cured easily: get Thomas Okken's Free42S Smile Well worthwhile IMHO.

Did I tell you already I hate copying & pasting other people's thoughts? Call me conservative but whenever I find a good explanation of a particular function elsewhere exceeding some lines of text I prefer pointing to the respective manual instead of just copying said text into my manual. YMMV

(05-28-2014 01:39 PM)Dieter Wrote:  
Walter B Wrote:Pauli uploaded the update so it will be in next build of WP 34S as well as WP 31S.

Just to be sure: I updated to the latest available version today, which seems to be 3.3 3653. Here the L.R. bug is still present.

Please look up the date of build 3653 and you will be sure. #-/ We need Marcus building a new build ...

d:-)
Find all posts by this user
Quote this message in a reply
05-28-2014, 05:29 PM (This post was last modified: 05-28-2014 05:29 PM by SlideRule.)
Post: #12
RE: [WP34s] Linear and non-linear regression with L.R.
Anyone care to tackle Curve Fitting?

SlideRule
Find all posts by this user
Quote this message in a reply
05-28-2014, 06:12 PM
Post: #13
RE: [WP34s] Linear and non-linear regression with L.R.
(05-28-2014 05:29 PM)SlideRule Wrote:  Anyone care to tackle Curve Fitting?

Well, this is curve fitting. The L.R. command fits linear, exponential, logarithmic or power functions with two parameters to a given data set with one independent variable. So what exactly are you looking for? Polynomial fits? Multiple linear regression? Rational approximations?

Dieter
Find all posts by this user
Quote this message in a reply
05-28-2014, 10:00 PM
Post: #14
RE: [WP34s] Linear and non-linear regression with L.R.
Sorry for the confusion - rhetorical question - slight attempt at veiled humor.

SlideRule
Find all posts by this user
Quote this message in a reply
05-29-2014, 01:30 PM
Post: #15
RE: [WP34s] Linear and non-linear regression with L.R.
(05-28-2014 02:58 PM)walter b Wrote:  
(05-28-2014 01:39 PM)Dieter Wrote:  Just to be sure: I updated to the latest available version today, which seems to be 3.3 3653. Here the L.R. bug is still present.

Please look up the date of build 3653 and you will be sure. #-/ We need Marcus building a new build ...

FYI, build 3658 is available now for testing.

d:-)
Find all posts by this user
Quote this message in a reply
05-29-2014, 01:44 PM
Post: #16
RE: [WP34s] Linear and non-linear regression with L.R.
(05-29-2014 01:38 PM)fhub Wrote:  
(05-29-2014 01:30 PM)walter b Wrote:  FYI, build 3658 is available now for testing.
Yep, many thanks to Pauli for the last fixes and Marcus for the new build! Smile

Walter would also get a 'thanks', if he would either finally provide an updated PDF manual (3.3),
or at least allow me to publish my manual update to 3.3. Wink

Oh, I can perfectly live without that. Wink

d:-)
Find all posts by this user
Quote this message in a reply
05-29-2014, 03:07 PM (This post was last modified: 05-29-2014 04:06 PM by Dieter.)
Post: #17
RE: [WP34s] Linear and non-linear regression with L.R.
(05-29-2014 01:54 PM)fhub Wrote:  And as it seems also with a completely outdated manual on the WP34s Sourceforge site ...

It's completely outdated indeed. The PDF offered there is named Manual_wp_34s_3_1.pdf and has 211 pages. The first page shows a 34s displaying version 3.1 3330, the footer on each page says "edition 3.1".

I do not remember where and when I got it, but my current PDF manual is "Manual_wp_34s_3_2.pdf" and it has 226 pages. The first page shows a 34s displaying version 3.1 3333 and the footer on each page says "edition 3.2".

So at least one newer version must have been offered for download. I wonder why at least this one is not available on Sourceforge. The current software version is different in many aspects from what the manual says, so a manual update is mandatory. You simply cannot offer current software along with a manual that reflects a version one or two years ago: the last release notes are from November resp. December 2012.

Dieter
Find all posts by this user
Quote this message in a reply
05-29-2014, 04:08 PM (This post was last modified: 05-29-2014 04:16 PM by Dieter.)
Post: #18
RE: [WP34s] Linear and non-linear regression with L.R.
(05-29-2014 03:18 PM)fhub Wrote:  So I guess it would indeed be no license violation (because it's GPLed) to publish my updated manual ...

Sounds like an easy decision: if it really is okay, go ahead, publish your version and see what happens.
If it's not, don't complain. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
05-29-2014, 04:21 PM
Post: #19
RE: [WP34s] Linear and non-linear regression with L.R.
Quote:So I guess it would indeed be no license violation (because it's GPLed) to publish my updated manual ...

I don't know about this specific case (because I don't care). But in general, whoever owns the code, doc, etc. can make whatever conditions he wants. And just because the code is GPL does not mean the doc is GPL. Actually, I don't think the GPL works for doc but the GPL people do have some sort of license agreement (GNU FDL?) that they use when they want to.

If the owner says you can't publish or change the doc that should be good enough to stop you in theory. In practice, he has to bring suit against you which wastes time and money and gets hard across international boundaries. I don't think enforcement is very likely. But people should still behave responsibly. You would think the authors of so-called open source or community projects would be open to receiving diffs for code and doc but really they can do whatever they want.

It ain't OVER 'till it's 2 PICK
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)