HP Forums

Full Version: HP48GX Statistical Function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all.

I have a HP48GX that I use, but there are some statistical functions I need that I could not find on the calculator nor in the manual.

First of all, how might I calculate the median or quartiles on a set of data?

Also, how do I calculate the residuals after doing regression. Are the residuals stored in a special variable?

Any help is appreciated Smile
(09-21-2018 11:12 PM)thenewpotato Wrote: [ -> ]Hello all.

I have a HP48GX that I use, but there are some statistical functions I need that I could not find on the calculator nor in the manual.

First of all, how might I calculate the median or quartiles on a set of data?

Also, how do I calculate the residuals after doing regression. Are the residuals stored in a special variable?

Any help is appreciated Smile

Hi and welcome thenewpotato,

If I understand correctly your questions, the median you can find in the manual 21 page 8, although I'm using the Portuguese version, so I don't know if the pages are the same, but resuming digit TEACH on the display, press ENTER, then press the VAR key and the submenu will appear, now press EXAM, PRGS and finally MEDIA. The result is a vector which contains the medians for each variable ( column) .

For quartiles and residuals of regression I don't think that the a stock 48 can do that, I think you have to install librarys or programs for statistics. You can find many here :

https://www.hpcalc.org/hp48/math/statistic/

You have to install them, you will need a proper 48 cable with a serial and a USB adapter. There are many tutorials on the internet, but feel free to ask for help anyway.

It's late in the evening now, but tomorrow I will have a look to a better solution for us, ad I'm interested in statistics in the 48 too.

Good luck,

Cheers

JL
(09-21-2018 11:12 PM)thenewpotato Wrote: [ -> ]Hello all.

I have a HP48GX that I use, but there are some statistical functions I need that I could not find on the calculator nor in the manual.

Hello,

in this english manual on http://h10032.www1.hp.com/ctg/Manual/c00442267, see chapter 21, page 273.

Kind regard
Joerg
(09-21-2018 11:12 PM)thenewpotato Wrote: [ -> ]First of all, how might I calculate the median or quartiles on a set of data?

(09-22-2018 02:56 AM)Jlouis Wrote: [ -> ]but resuming digit TEACH on the display, press ENTER, then press the VAR key and the submenu will appear, now press EXAM, PRGS and finally MEDIA.

There's another program %TILE in the EXAMPLES that can be used with data in a list:
Code:
« SWAP SORT DUP SIZE 1 + ROT 100 / * → p
  « DUP p FLOOR GET SWAP p CEIL GET + 2 /
  »
»
  • Q1: « 25 %TILE »
  • Q2: « 50 %TILE »
  • Q3: « 75 %TILE »

Examples:

Taken from Quartile.

{ 6 7 15 36 39 40 41 42 43 47 49 }
  • Q1: 15
  • Q2: 40
  • Q3: 43

{ 7 15 36 39 40 41 }
  • Q1: 11
  • Q2: 37.5
  • Q3: 40.5

But this might not be exactly what you expect.

Kind regards
Thomas
(09-22-2018 09:57 AM)Thomas Klemm Wrote: [ -> ]
{ 7 15 36 39 40 41 }
  • Q1: 11
  • Q2: 37.5
  • Q3: 40.5
But this might not be exactly what you expect.

Yes, not what I expected (Q1, Q3 seems very extreme, to the edges)

My code do this differently, using percentiles.

let A be sorted data points, so A(0) be the smallest data point, A(n) largest
Interpolate for percentage of n: Q1 = 25%, Q2 = 50%, Q3 = 75%

Above example, n = 5:
Q1 = A(1.25) = 20.25
Q2 = A(2.50) = 37.50
Q3 = A(3.75) = 39.75

What is nice about this setup is 0% and 100% match A(0) and A(n) numbers.

Edit: It seems above percentile definition is same as MS Excel
https://exceljet.net/excel-functions/exc...e-function
(09-22-2018 12:57 PM)Albert Chan Wrote: [ -> ]What is nice about this setup is 0% and 100% match A(0) and A(n) numbers.

That's a validd point. However keep in mind that the index starts at 1 and not at 0.

Here's a modified %TILE program that also works for 0 and 100 percent:
Code:
« SWAP SORT DUP SIZE 1 - ROT % 1 + → p
  « DUP p FLOOR GET SWAP p CEIL GET + 2 /
  »
»

Examples:

Taken from Quartile.

{ 6 7 15 36 39 40 41 42 43 47 49 }
  • Q1: 25.5
  • Q2: 40
  • Q3: 42.5

{ 7 15 36 39 40 41 }
  • Q1: 25.5
  • Q2: 37.5
  • Q3: 39.5

Cheers
Thomas
Reference URL's