WEIGHT, a Weighted MEAN and SDEV, by Joseph K. Horn Sean F Kellner writes: > I have come to a small problem with my HP48sx that I haven't heard > anyone else complain of yet. How do you get the statistics function > to do weighted means and standard deviations? I tried the matrix > editor and put the data in col 1 and the frequency in column two. > When I hit the mean button it gave me the average of each column. > Same for standard deviation. I needed this done real soon at the > time so I decided to enter each number in separately, all 200 of > them instead of about 11 discrete values. I ended up writing a > small "program" that simply made whatever I typed in a 1 element > array and typed the number in, hit that key, then return for the > rest of the frequency. I then did a 198 ->list and edited the { } > to be [ ] because -> wouldn't work with arrays. This can't be the > easiest way of doing this, anyone give me a hint? Although this did > work, I can only imagine what people thought when I was counting how > many times I tapped my calculator. I would RTFM but the they are > still in Columbus and I am now a freshman in Cincinnati. Two solutions come to mind: (1) If you can sometimes be happy with just the weighted MEAN, use: 'WTAV' ( WeighTed AVerage ) +----------------------------------+ | << OVER DOT SWAP CNRM / >> | +----------------------------------+ INSTRUCTIONS: Type the weight array, then the data array, and press WTAV; the weighted average is instantly computed. 2: [ weights ] 1: [ data ] --> WTAV --> 1: weighted mean EXAMPLE: You got a 75%, an 80%, and an 85% on three tests (each worth 20% of your class grade), and then you got a 90% on the final exam (worth 40% of your class grade). What is your grade? SOLUTION: 2: [ 20 20 20 40 ] 1: [ 75 80 85 90 ] --> WTAV --> 84 (You got an 84%) (2) If you really need SDEV (and the other STAT functions), then have the HP 48 press the ä+ (Sigma+) key for you: 'SSIG' ( Super-ä ) +-------------------------------------------------+ | << 1 SWAP START ä+ LASTARG NEXT DROP >> | +-------------------------------------------------+ (Note: "ä+" = [STAT] [A] ) INSTRUCTIONS: Use the normal CLä and ä+ function to input the very first datum (a single number or an array of any size). From then on, enter your data (brackets are optional) followed by the weight, and press SSIG. The HP 48 will press ä+ for you, that many times. When data entry is finished, use the STAT functions as usual. EXAMPLE: One of my students got 100%, four got 92%, twelve got 84%, eleven got 76%, six got 68%, and two got 60%. What is the mean and standard deviation of these grades? SOLUTION: [STAT] CLä 100 ä+ [VAR] 92 4 SSIG 84 12 SSIG 76 11 SSIG 68 6 SSIG 60 2 SSIG [blue-STAT] MEAN --> 78.89 SDEV --> 9.20 Of course, if you REALLY want to input your data as [ datum weight ] pairs, and THEN massage it into useable form, that would require a program too. But it'd be a little larger than the programs above.