HP 50g Graphing Calculator User Manual

Page 571

Advertising
background image

Page 18-4

Examples of calculation of these measures, using lists, are available in Chapter
8.

The median is the value that splits the data set in the middle when the elements
are placed in increasing order. If you have an odd number, n, of ordered
elements, the median of this sample is the value located in position (n+1)/2. If
you have an even number, n, of elements, the median is the average of the
elements located in positions n/2 and (n+1)/2. Although the pre-programmed
statistical features of the calculator do not include the calculation of the median,
it is very easily to write a program to calculate such quantity by working with
lists. For example, if you want to use the data in

ΣDAT to find the median, type

the following program in RPN mode (see Chapter 21 for more information on
programming in User RPL language).:

«

nC « RCL

Σ DUP SIZE 2 GET IF 1 > THEN nC COL− SWAP DROP OBJ

1 + ARRY END OBJ OBJ DROP DROP DUP n « LIST SORT IF ‘n
MOD 2 == 0’ THEN DUP ‘n/2’ EVAL GET SWAP ‘(n+1)/2’ EVAL GET + 2 /
ELSE ‘(n+1)/2’ EVAL GET END “Median” TAG » » »

Store this program under the name MED. An example of application of this
program is shown next.

Example 2 – To run the program, first you need to prepare your

ΣDAT matrix.

Then, enter the number of the column in

ΣDAT whose median you want to find,

and press

@@MED@@. For the data currently in

ΣDAT (entered in an earlier example),

use program MED to show that

Median: 2.15

.

The mode of a sample is better determined from histograms, therefore, we leave
its definition for a later section.

Measures of spread

The variance (Var) of the sample is defined as

.

The standard deviation (St Dev) of the sample is just the square root of the
variance, i.e., s

x

.

=

=

n

i

i

x

x

x

n

s

1

2

2

)

(

1

1

Advertising