[HP12C] Angular coefficent from linear regression off by 1

05012016, 11:23 AM
(This post was last modified: 05022016 12:08 AM by Marcio.)
Post: #1




[HP12C] Angular coefficent from linear regression off by 1
While doing linear regression on the 12C, I noticed the last digit of the angular coefficient is usually off by 1. Does anyone know why? I thought the 12C used the same algorithm as the 15C.
Example: Code:
The 15C will return y=0.159340862+11.09933164. The 12C gives ...165 instead. Thank you. 

05012016, 07:12 PM
Post: #2




RE: HP15C and 12C give different results to the same data set
My HP38C, predecessor to the HP12C (12C is modeled after the 38C) also gives 11.09933165. However my iPhone emulator of the 38C, which carries 15 or 16 digit accuracy yields 11.09933164.
Regards, Bob 

05012016, 11:37 PM
Post: #3




RE: [HP12C] 9digit angular coefficent from linear regression off by 1
(05012016 07:12 PM)bshoring Wrote: My HP38C, predecessor to the HP12C (12C is modeled after the 38C) also gives 11.09933165. However my iPhone emulator of the 38C, which carries 15 or 16 digit accuracy yields 11.09933164. Hmm... in this case all variables of the equation for calculating the regression slope (i.e. the various sums accumulated by Σ+) have at most five significant digits. So the result can be calculated exactly even with merely 10 digits, while both the 38C and the 12C should use 13 digits internally. Using the formulas in the 15C manual, the exact result for the slope of the given data is 48,16 : 4,339 which any HP should be able to calculate exactly. ;) So something else must be going on here. Dieter 

05022016, 11:16 AM
Post: #4




RE: [HP12C] Angular coefficent from linear regression off by 1
(05012016 11:37 PM)Dieter Wrote: Using the formulas in the 15C manual, the exact result for the slope of the given data is 48,16 : 4,339 which any HP should be able to calculate exactly. ;) So something else must be going on here.Can't say it's a bug in the new firmware because the 38C also has it. HP powered this machine on an airplane engine. The thing is faster than speed of light. I wonder what the battery (2x CR2032) consumption is like, though. It still has the doubleregistering problem but that seems to be fading as I use it. Marcio 

05022016, 11:48 AM
Post: #5




RE: [HP12C] Angular coefficent from linear regression off by 1
I don't know either the 12C or the 15C very well but I have emulators on my phone ;)
So, correct me if I'm wrong, but the 12C doesn't have linear regression as a function, just xintercept and yintercept. So you calculate the slope in two steps: y  x=1 minus y  x=0 or 1 g(y,r) (11.25867251) 0 g(y,r) (0.15934086.19) X<>Y RDN  If you do the same on a 15C, you get the same result. But a 15C has a f(L.R.) function delivering the result without 10digit intermediate calculations. Hence the difference. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L 

05022016, 12:09 PM
Post: #6




RE: [HP12C] Angular coefficent from linear regression off by 1
You nailed it.
Thank you. 

05022016, 12:30 PM
Post: #7




RE: [HP12C] Angular coefficent from linear regression off by 1
(05022016 12:09 PM)Marcio Wrote: You nailed it. OK – so you did a manual calculation to obtain slope and intercept. This was not clear to me reading your first post where you said that "the 12C used the same algorithm as the 15C". That's why I expected the 12C to offer a builtin L.R. function, like the 15C. In fact the 12C manual suggests a manual method similar to Werner's to obtain the two coefficients. This of course explains why the result may be off by a ULP or two. #) Now, what about a short program that calculates slope and intercept directly from the sums in R1...R6 ?) Dieter 

05022016, 02:50 PM
(This post was last modified: 05022016 06:29 PM by Werner.)
Post: #8




RE: [HP12C] Angular coefficent from linear regression off by 1
Something like this?
Code: RCL 6 Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L 

05032016, 11:56 AM
Post: #9




RE: [HP12C] Angular coefficent from linear regression off by 1
(05022016 02:50 PM)Werner Wrote: Something like this? Sort of, yes. ;) After you posted your code I wanted to add an improved version, but you were faster. Personally, I would prefer the slope returned in X and the yintercept in Y, but this can be changed easily. On the other hand your code returns the results the same way as my good old 34C (and maybe other HPs as well). BTW the 34C shows the correct slope: 11,09933164. ;) Dieter 

05032016, 12:14 PM
Post: #10




RE: [HP12C] Angular coefficent from linear regression off by 1
(05022016 11:16 AM)Marcio Wrote: HP powered this machine on an airplane engine. The thing is faster than speed of light. I wonder what the battery (2x CR2032) consumption is like, though. I guess you mean the new ARM powered version? I have a 3 battery 12C from the 1980s and the batteries last about 10 years... It ain't OVER 'till it's 2 PICK 

05032016, 12:37 PM
Post: #11




RE: [HP12C] Angular coefficent from linear regression off by 1
(05032016 12:14 PM)HP67 Wrote:(05022016 11:16 AM)Marcio Wrote: HP powered this machine on an airplane engine. The thing is faster than speed of light. I wonder what the battery (2x CR2032) consumption is like, though. I think so. The 12C I have is one of the most recent, guessing from 2009. I bought it to save wear on my nearmint 15C. The keys will doubleregister sometimes and the labels are painted on. The display is not very good quality either, read somewhere that life expectancy is about 34 years if used daily. Replacing batteries once a year is fine with me. We'll see. 

05032016, 01:01 PM
Post: #12




RE: [HP12C] Angular coefficent from linear regression off by 1
I haven't heard of the new 12Cs key bouncing. That's unfortunate. I wonder if there is a key delay function like on some other ARM powered HP calcs.
It ain't OVER 'till it's 2 PICK 

05032016, 01:20 PM
Post: #13




RE: [HP12C] Angular coefficent from linear regression off by 1
(05032016 01:01 PM)HP67 Wrote: I haven't heard of the new 12Cs key bouncing. That's unfortunate. I wonder if there is a key delay function like on some other ARM powered HP calcs. No, there is no such function on the voyagers. Unfortunate indeed, and yes, it is common. I also heard that 1215% of 15C LE units produced suffer from the same doubleregistering problem. Guess youd have to be lucky. Still, very nice little calc with a good amount of scientific functions. L.R. is the one I use the most. 

05032016, 01:33 PM
Post: #14




RE: [HP12C] Angular coefficent from linear regression off by 1
I knew that Voyagers don't have it. I meant the newer ARM versions running emulation. Since they added a few other tricks I thought maybe it was supported. If it bothers you maybe you can pick up a pre ARM 12C. They're just wonderful, wonderful calculators. Mine paid for itself the day I bought it. I have no idea how available/expensive they are on the used market. One one hand I can't imagine anyone parting with one. On the other hand many people want the latest and greatest model and don't like old stuff.
It ain't OVER 'till it's 2 PICK 

05032016, 01:49 PM
Post: #15




RE: [HP12C] Angular coefficent from linear regression off by 1
The old ones are the best.
I missed the opportunity to buy a 11C in good condition for the equivalent to US$60 (shipping included) from the same auction site I bought the ARM powered 12C I have now. I've been kicking myself since then. 

05032016, 01:59 PM
Post: #16




RE: [HP12C] Angular coefficent from linear regression off by 1
Well, hang in there and you'll probably get lucky.
I'm kicking myself for not buying a 41CX back in the day. I didn't have the money for both at the time so I bought an HP 67 and never regretted the choice. Still, I would love to have a 41 and it looks unlikely now. But we never know. It ain't OVER 'till it's 2 PICK 

05052016, 07:07 AM
Post: #17




RE: [HP12C] Angular coefficent from linear regression off by 1  
05062016, 07:50 AM
Post: #18




RE: [HP12C] Angular coefficent from linear regression off by 1
(05052016 07:07 AM)Csaba Tizedes Wrote:(05032016 11:56 AM)Dieter Wrote: ... an improved version... Hey, guys, what's the problem? This is the greatest improvement since the sliced bread. Far better than muck about those registers and better than the "classic" solution from the Owner's Handbook. 6 steps only. OK, I have a big face, but I'm groved up here (MoHPC), and I can remember the discussions at the 2000's. And yes, I'm not really clever, just googled the simple linear regression on Wikipedia  but really missing those clever discussions like 15 years before... BTW: the result is 11.09933164 and 0.1593408619. I don't know it is good for you or not... Csaba PS.: and yes, I know you're will reflect only my words, not my 6 steps solution... That is exactly what I want to say... 

05062016, 01:11 PM
Post: #19




RE: [HP12C] Angular coefficent from linear regression off by 1
(05062016 07:50 AM)Csaba Tizedes Wrote: [ 6step solution using r and s ] In this particular case it's good enough of course, as this is the exact 10digit result. ;) The method you suggested is short and elegant. However, it uses the regression coefficient and the two standard deviations, where all three are internally calculated using square roots. That's why this method is prone to slight errors in the last digit, just as the method suggested in the manual. And that's why the suggested direct solution using the six registers is inherently more exact. As long as these data do not have too many significant digits (which usually is the case with empirical data) the results are exact. Even in the last digit. ;) So you can choose between a shorter and a potentially more exact solution. Dieter 

05062016, 01:55 PM
Post: #20




RE: [HP12C] Angular coefficent from linear regression off by 1
(05032016 01:20 PM)Marcio Wrote: I also heard that 1215% of 15C LE units produced suffer from the same doubleregistering problem.My bet would be 100%. The debouncing algorithm just doesn't work, and it's the same in all 15C LEs. If it repeats an entry, which is rare but happens, you immediately see e.g. the two numbers in the display. It appears to me the emulation executes the original 15C debouncing code, disregarding the higher speed of the ARMhardware. Tim? 

« Next Oldest  Next Newest »

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