Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mean, median, mode

34 views
Skip to first unread message

Matt Bryant

unread,
Aug 25, 2001, 10:07:38 PM8/25/01
to
Is there a way to enter a set of data (ex: 6, 7, 9, 9, 9, 10) and have the
calculator find the mean, median, and mode for that set of data? Thanks in
advance.

--
--Matt Bryant

"If at first you don't succeed, try, try again. Then quit. No use being
a damn fool about it."
- W.C. Fields (1880 - 1946)

"Never try to teach a pig to sing. It wastes your time and annoys the pig."
- Proverb


Tim Wessman

unread,
Aug 25, 2001, 11:59:55 PM8/25/01
to
If you are going to be doing any serious statistics get StatPro49 at hpcalc.org.
It is the best statistics package for any calculator. It does all that and
more.

TW

>Is there a way to enter a set of data (ex: 6, 7, 9, 9, 9, 10) and have the
>calculator find the mean, median, and mode for that set of data? Thanks in
>advance.

~The enemy's gate is down.

Bernardo Aguilera

unread,
Aug 26, 2001, 3:09:49 AM8/26/01
to
Hi Matt

If you want to know "The mean"
put on the stack the data
[[x1]
[x2]
...
[xn]]

'SIGMADAT' (SIGMA is Sumatorium symbol)
STO
MEAN .

The others stat functions i think you'll have to make your programs or
go to www.hpcalc.org.

I hope this helps you , anyway if you want me to help you to make
them, just e-mail me or post another message.

Greetings
Bernardo Aguilera

Matt Bryant

unread,
Aug 26, 2001, 8:52:46 AM8/26/01
to
Thanks Tim
"Tim Wessman" <nos...@newsranger.com> wrote in message
news:%u_h7.15128$2u.1...@www.newsranger.com...

Tim Wessman

unread,
Aug 26, 2001, 3:42:53 PM8/26/01
to
No problem. That program should cover everything through high school stats and
the first two or three semesters of college stats. If you have any questions
about how to use it email me. I went through learning it already. . . ;-)

TW

Matt Bryant

unread,
Aug 26, 2001, 4:31:44 PM8/26/01
to
Well, I would email you, but looking at your email, I'm guessing that it's a
spamblock, so I kinda need it...if you could send your email to me, I would
be very appreciative. Just looking at the program I already can't figure it
out (lol)...so I do need some help

"Tim Wessman" <nos...@newsranger.com> wrote in message
news:1jci7.185$Je3...@www.newsranger.com...

John H Meyers

unread,
Aug 27, 2001, 6:03:35 PM8/27/01
to Matt Bryant
The question:

> Is there a way to enter a set of data (ex: 6, 7, 9, 9, 9, 10)

> and have the calculator find the mean, median, and mode?

%%HP: T(3)F(.); @ Header for Kermit transfer

@ Mean of a list of reals
\<< DUP 0. + \GSLIST SWAP SIZE / \>> 'MEANL' STO

@ Mean of every column of a real matrix:
\<< TRN AXL 1. 'MEANL' DOLIST AXL \>> 'MEANM' STO


@ Median of a list of reals:
\<< SORT DUP SIZE 1. + 2. / DUP2 FLOOR GET
UNROT CEIL GET OVER - 2. / + \>> 'MEDNL' STO

@ Median of every column of a real matrix:
\<< TRN AXL 1. 'MEDNL' DOLIST AXL \>> 'MEDNM' STO

@ End of Downloadable file

[r->] [OFF]


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

Matt Bryant

unread,
Aug 27, 2001, 7:04:01 PM8/27/01
to
where do I put the numbers to use those tools!?
"John H Meyers" <jhme...@miu.edu> wrote in message
news:3B8AC3B7...@miu.edu...

Virgil

unread,
Aug 27, 2001, 9:26:38 PM8/27/01
to
In article <3B8AC3B7...@miu.edu>,

John H Meyers <jhme...@miu.edu> wrote:

> @ Median of a list of reals:
> \<< SORT DUP SIZE 1. + 2. / DUP2 FLOOR GET
> UNROT CEIL GET OVER - 2. / + \>> 'MEDNL' STO

@ I use the slightly shorter program

\<< SORT DUP SIZE 1. + 2. / DUP2 FLOOR GET

UNROT CEIL GET + 2. / \>> 'MEDLST' STO

John H Meyers

unread,
Aug 27, 2001, 6:53:52 PM8/27/01
to Matt Bryant
The question:

> where do I put the numbers to use those tools!?

The programs which I just posted
each operate on one object on the stack (level 1):

Mean of a list of reals: { list } ==> mean
Median of a list of reals: { list } ==> median

Mean of every column of a real matrix: [[matrix]] ==> [means]
Median of every column of a real matrix: [[matrix]] ==> [medians]


I deliberately avoided reference to the reserved-name
statistics matrix '\GSDAT', so that you needn't go through
the extra steps to first store data there, but you can recall
that matrix to the stack if you want to submit it to those programs.

A special command RCL\GS recalls '\GSDAT' and errors if there is no
\GSDAT in the *current* directory (i.e. ignores parent directories).

John H Meyers

unread,
Aug 27, 2001, 7:05:25 PM8/27/01
to Virgil
A 5 byte shorter "median" program was posted:

| \<< SORT DUP SIZE 1. + 2. / DUP2 FLOOR GET
| UNROT CEIL GET + 2. / \>> 'MEDLST' STO

Let's apply both programs to the list { 6.66666666667 }

The "long" program's median is: 6.66666666667

The "short" program's median is: 6.66666666665

"And that's the long and short of it" ;)

John H Meyers

unread,
Aug 27, 2001, 11:12:52 PM8/27/01
to Matt Bryant, Virgil
About accuracy (and the attention to detail it takes to achieve it):

Although we saw that a very simple bit of care in calculating
a median easily avoids some inaccuracy, especially since
only two (possibly equal) values are being averaged,
the exact same thing can happen when calculating means, e.g.

{ 6.66666666667 6.66666666667 } \GSLIST 2. / ==> 6.66666666665

If we had created a SigmaSTAT matrix, however,
containing those values in a column,
then the built-in MEAN command, using extended precision,
would calculate a precisely correct mean.

There is a more accurate method of computation, however,
even in userRPL, as explained by Bob Wheeler:
http://groups.google.com/groups?selm=328D1B...@echip.com

As used in WEIGHT3 for weighted means and standard deviations:
http://groups.google.com/groups?selm=5hipnp%24oq0%241%40news.iastate.edu

So, for a possibly more accurate mean of a list of reals
(most obviously in the above case),
use this considerably less obvious program:

\<< 0. SWAP 1. \<< OVER - NSUB / + \>> DOSUBS \>> 'MEANL' STO

Mycroft Holmes

unread,
Aug 28, 2001, 6:29:54 AM8/28/01
to
There's something strange about those formulas you quoted:

-------------------- (taken from the link) --------------------
Let X(i) be an array of i=1...N interval midpoints, and W(i) a
corresponding
array of weights (frequencies). Use arrays SW(i), SX(i), and M(i)
to hold the calculations. Set SW(0)=SX(0)=M(0)=0, and then repeat

SW(i+1)=SW(i)+W(i)
d=[X(i+1)-M(i)]W(i) <<<<<<<<<<<<<<<<
M(i+1)=M(i)+d/SW(i+1)
SX(i+1)=SX(i)+d[X(i+1)-M(i+1)]

SX(N) will contain N times the variance (SD squared),
and M(N) the mean. You don't actually have to use arrays for
SW,SX, and M: scalars will do if you update them.
-------------------- (end) --------------------

d uses X(i+1), and this implies i = 0...N-1, but this conflicts with d using
W(i), since W(0) is out of range.


a basic loop-formula is (same starting values, same vars)

i = 1...N
SW += W(i) // obvious
d = W(i)*X(i)
SX += d*X(i)
M += d

at any stage, mean = M/SW, variance = (SX/SW - (M/SW)^2 ), where variance is
(how do you call that in English?) "uncorrected" (?), that is divided by N
and not by N-1
(this allows to get 0 when N=1)

--
The set of solutions is never empty.
Two solutions together form a new problem.
-- Mycroft Holmes

John H Meyers

unread,
Aug 29, 2001, 3:22:12 AM8/29/01
to
"Mycroft Holmes" <hol...@technologist.REMOVEME.com> wrote:

> There's something strange about those formulas you quoted

They worked in the WEIGHT3 program;
perhaps the reference supplied earlier by Bob Wheeler
(who supplied these formulas)
might contain a better explanation.

>> SW(i+1)=SW(i)+W(i)

> d uses X(i+1), and this implies i = 0...N-1, but this conflicts
> with d using W(i), since W(0) is out of range.

Bob said: "Set SW(0)=SX(0)=M(0)=0" so assume W(0)=0 also.

> at any stage, mean = M/SW, variance = (SX/SW - (M/SW)^2 ),
> where variance is (how do you call that in English?)
> "uncorrected" (?), that is divided by N and not by N-1
> (this allows to get 0 when N=1)

HP seems to use the terminology "population" (of all the observations)
variance, which goes to zero, and "sample" (predicted from
observations) variance, which goes to infinity at N=1.

To make a confusing comedy routine out of this, we might say that
the "population" variance means "of the sample," while the "sample"
variance means "of the entire population" -- that's why I only
choose by which is larger and which is smaller,
and don't try to remember what it's called :)

But Mycroft is a very precise mathematician,
and won't settle for just getting the right answers,
the way engineers do ;)

-[]-

Mycroft Holmes

unread,
Aug 29, 2001, 9:36:22 AM8/29/01
to
> HP seems to use the terminology "population" (of all the observations)
> variance, which goes to zero, and "sample" (predicted from
> observations) variance, which goes to infinity at N=1.

uhm... talking about conflicts: they remark so much the difference between
dividing by N-1 and by N, when they also recommend to use a very large N,
otherwise the stats are meaningless...

> But Mycroft is a very precise mathematician,
> and won't settle for just getting the right answers,
> the way engineers do ;)
>

You got me ;)
However Bob's formulas should be slightly slower than the ones I had, since
they use 1 division per iteration, while I use 2 divisions at the end (but
don't ask me about numerical precision): and if N is greater than 2... ;)

Thomas Rast

unread,
Sep 4, 2001, 11:46:13 AM9/4/01
to
Tim Wessman wrote:
>
> If you are going to be doing any serious statistics get StatPro49 at hpcalc.org.
> It is the best statistics package for any calculator. It does all that and
> more.
>

I noticed StatPro49 uses some special (full screen) choose... well not a
box any more. How can I use that in my own program? Is there a
(stable/supported) flashpointer? Or did Scott Guth write it himself?

Thomas

--
Thomas Rast
t.r...@iname.com
ICQ# 103670088

Luis Morales Boisset

unread,
Sep 4, 2001, 5:54:46 PM9/4/01
to
Hello Thomas

It's the 48 style choose. It's there in the 49 really it's the one more
documented the new one it's only documented a bit by Carsten I think.

There is a document GXBrowser or something like this on hpcalc explaining
it.

It's the same than the 48 boxed one. It's only different
configuration/programing.

Luis.

--
---------------------------------------
Luis Morales Boisset
email: lboisset at arrakis.es
http://www.arrakis.es/~lboisset

"Thomas Rast" <t.r...@iname.com> escribió en el mensaje
news:3B94F745...@iname.com...

0 new messages