hp41 howto do simple linear regression? « Next Oldest | Next Newest »

 ▼ David E Unregistered Posts: 25 Threads: 9 Joined: Sep 2011 12-17-2002, 07:17 PM HI. I have the stat pac for hp41, and neither of the linear regressions sets seems to do what I need. I need something that I can input my data (x and y) and from that get R, slope, and y (y=mx+b). Thanks for any guidance . ▼ Dave Shaffer (Arizona) Unregistered Posts: 776 Threads: 25 Joined: Jun 2007 12-17-2002, 08:02 PM Well, David, you can always do it the semi-hard way - with just the '41 itself. If you use the sigma+ button (top left on the keypad)(after clearing the summation registers using the CLSigma button - shift x<>y key, just below the sigma+ key), you can accumulate the sums of x, x^2, y, y^2, and xy in memory registers 11 through 15 respectively, while register 16 will get the value of n (the number of x,y pairs). To put in your numbers, enter y first, then "ENTER", and then enter your x value - then hit the sigma+ key. After you have entered all you pairs of values, you need to remember (or be told - or, left as an exercise for the student, derive!) the least-squares fitting expressions for slope, intercept, and correlation coefficient. In case you are rusty: the slope is (n*SUMxy - SUMx*Sumy)/(n*SUMx^2 - (Sumx)^2) the intercept has the numerator SUMy*SUMx^2 - SUMxy*SUMx (with the same denominator as for the slope) r is (n*SUMXY - SUMx*SUMy) / ( SQRT(n*SUMx^2 - (SUMx)^2) * SQRT(n*SUMy^2 - (SUMy)^2) ) I hope my notation is clear. SUMx means the summation of x, and (SUMx)^2 means to square this sum (whereas SUMx^2 means the summation of x-squared). Have fun. ▼ David Unregistered Posts: 84 Threads: 29 Joined: Sep 2010 12-17-2002, 09:45 PM Boy, that scares me just looking at it. lol. maybe i will try to write a prog for that. thanks ▼ Mike (Stgt) Unregistered Posts: 858 Threads: 80 Joined: Feb 2009 12-18-2002, 10:07 AM Citation from Dave's append: "After you have entered all you pairs of values, you need to remember (or be told - or, left as an exercise for the student, derive!) the least-squares fitting expressions for slope, intercept, and correlation coefficient." To ease the exercise for the student just take the values of X as free of error. My little (basic) routine is based on this assumption. Next step in students exercise would be to take Y values for true and the fault is in X :-) And if you have some time and piles of paper left, just take X as faulty as Y ;-) Ciao.....Mike Vieira, Luiz C. (Brazil) Unregistered Posts: 4,027 Threads: 172 Joined: Aug 2005 12-17-2002, 09:40 PM Hi; Dave Shaffer's post contains ALL information you need, but you can do it in the "easy way" by using the STAT pack programs. Get your Stat Pack manual and open it on page 32, under "Curve Fitting". On page 33, top left, you'll see your Y = a + bX expression. Now go to page 34 and you'll see that you should [XEQ] [SIGMA]LIN program for a straight line sample (or any of the other three: LOG, EXP or POW), being [SIGMA] the summation symbol. You should enter each pair in the REVERSED orther (why do some applications are against Y and X registers?), say:` X [ENTER^] Y [A]` for each pair; to correct any mistakes:` X [ENTER^] Y [C]` After the last (x,y) pair, simply press [E] and you'll have:``` R2 = (corr. coef.) [R/S] a = (intercept) [R/S] b = (slope)``` Hope this is waht you want. BUT if you really want to know the mechanics, read D. Shaffer's post. It is complete reference. Success. ▼ Kenneth Unregistered Posts: 1 Threads: 0 Joined: Jan 1970 12-17-2002, 11:10 PM hi i'm trying to operate my 42s rpn scietific and i can't do a simple problem with it, i don't have a manual or instructions on how to operate it can you help me? ▼ Richard Garner Unregistered Posts: 237 Threads: 20 Joined: Mar 2006 12-18-2002, 01:32 PM Here is a quick primer 4+5=9 4 Enter 5 + (4+5)x10=90 4 Enter 5 + 10 x (4+5)/3=3 4 Enter 5 + 3 / I hope this helps. Depending on how the numbers are set in the stack, you can load the stack with you numbers and the perform the operations all at once. As in (4x5)+7=27 7 Enter 5 Enter 4 x + Have fun. Tom (UK) Unregistered Posts: 298 Threads: 35 Joined: Jan 1970 12-19-2002, 01:02 PM The HP42S is a tricky beast to master, and much harder without the manual. Best thing to do is pop it in the post to me and I'll return a much easier to use calculator in exchange... how about a Casio FX580? But seriously: The HP42S is a nice tool, once you have mastered it (doesn't take long) you will wonder how you got along without it. To start using it this site has a brief introduction on RPN. To get a manual buy the DVD/CD's from this web site, it will be well worth it in the long run. Mike (Stgt) Unregistered Posts: 858 Threads: 80 Joined: Feb 2009 12-18-2002, 07:34 AM I just did an 'edit/copy-edit/paste' from my emulator on the IBM-host, so the § stands for Sigma: ```01·LBL "§" 02 §REG 10 03 CL§ 04 MEAN 05 X<>Y 06 RCL 10 07 ST* Z 08 * 09 RCL 14 10 - 11 X<>Y 12 RCL 11 13 - 14 / 15 STO 04 16 MEAN 17 LASTX 18 * 19 - 20 STO 05 21 RCL 04 22 STOP 23 SDEV 24 RCL 04 25 * 26 X<>Y 27 / 28 END ``` That's the minimum code, to make life easier just use the Alpha capabilities of the HP-41 and add some literals and prompts. Ciao.....Mike ▼ Vieira, Luiz C. (Brazil) Unregistered Posts: 4,027 Threads: 172 Joined: Aug 2005 12-18-2002, 09:02 AM Hi; I did not load the program and run it, but I am curious about one sequence: CL§ and MEAN. How can you compute MEAN if CL§ clears all statistic data? As you change the §REGS to R10 instead of original R16 and you execute CL§, I thought you created a buffer to compute partial data and return to §REG 16 before using MEAN. But right after that you clear statistic data and execute MEAN with all registers down to zero. Is that what you want? Did I miss something? If I am wrong, sorry. I just want to understand. Cheers. ▼ Mike (Stgt) Unregistered Posts: 858 Threads: 80 Joined: Feb 2009 12-18-2002, 09:44 AM No, you did not miss something. I gave no clear explanation. This is my LinReg prgm that fits in every HP-41, independent what other BIG routines use up all memory. There are no literals and no prompts to ease the user input and result output. After line 03 you may add the two lines "Y enter X §+" PROMPT. Without it you just see DATA ERROR and must know that this is the point to enter data. Ciao.....Mike

 Possibly Related Threads… Thread Author Replies Views Last Post HP prime: linear solver app Alberto Candel 1 1,427 11-21-2013, 01:57 AM Last Post: Michael Carey Simple Tetris. free for you to improve on cyrille de Brébisson 3 1,923 11-20-2013, 05:43 PM Last Post: Erwin Ried HP Prime: Linear Solver app bug BruceH 0 1,136 11-15-2013, 06:36 PM Last Post: BruceH [HP-Prime] Simple Game (Bugs) CompSystems 1 1,421 11-01-2013, 10:18 AM Last Post: Han Quadratic & Cubic Regression RPN progs Matt Agajanian 9 2,927 09-17-2013, 11:37 AM Last Post: Jeff O. New article on a new type of neo linear equations Namir 0 1,273 08-11-2013, 10:27 AM Last Post: Namir Simple Math Question Namir 2 1,399 08-09-2013, 06:13 PM Last Post: Eddie W. Shore Linear Optimization/Programming fhub 14 4,061 08-04-2013, 06:27 AM Last Post: fhub HP-42S with Electroluminescent screen and simple I/O port Jose Poyan 8 2,699 03-27-2013, 07:11 PM Last Post: Jose Poyan Simple sample programs for the HP-41CX? Tom Lewis 5 2,039 03-25-2013, 07:11 PM Last Post: Allen

Forum Jump: