The Museum of HP Calculators


Basic Statistics For Two Variables for the HP-67

This program is Copyright © 1976 by Hewlett-Packard and is used here by permission. This program was originally published in the HP-67 Stat Pac 1.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Card Labels

Basic Statistics For Two Variables

Shift

P?

->mx:my->Vx:Vy

->sx:sy... 

->sxy:...->gammaxy

->sumxi:... 

Label

Start

xi^yi(sum+)

xk^yk(sum-)

xi^...(sum+)

xk^...(sum-)

Key

A

B

C

D

E

Overview

This program calculates means, standard deviations, covariance, correlation coefficient, coefficients of variation, sums of data points, sum of multiplication of data points, and sums of squares of data points derived from a set of ungrouped data points {(xi, yi), i = 1, 2, ..., n}, or grouped data points {(xi, yi, fi), i = 1, 2, .. ., n }. fi, denotes the frequency of repetition of (xi, yi)

mean x = 1/n sum(i=1..n)xi              mean y = 1/n sum(i=1..n)yi

standard deviation sx = sqrt(((sumxi2 - n(mean x)2)/(n-1))

or sx' = sqrt(((sumxi2 - n(mean x)2)/n)

standard deviation sy = sqrt(((sumyi2 - n(mean y)2)/(n-1))

or sy' = sqrt(((sumyi2 - n(mean y)2)/n)

covariance sxy = (1/(n-1))*(sumxiyi - (1/n)*sumxiyi)

or covariance sxy' = (1/(n))*(sumxiyi - (1/n)*sumxiyi)

correlation coefficient gammaxy = sxy/sxsy

Coefficients of variation Vx = 100*sx/mean x,   Vy = 100*sy/mean y

Note: n is a positive integer and n > 1.

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Load side 1 and side 2.

     

2

Initialize

 

A

0.00

3

To set print mode*

 

 f A

1.00

 4

For grouped data points, go to 8

 

 

 

5

For ungrouped data points, do 6~7 for i = 1,2,..., n

 

 

  

6

Input xi

xi

ENTER

 

      yi

yi

B

i

7

If you made a mistake in inputting xk and yk, then correct by --->

xk

ENTER

 

   

yk

C

i-1

8

For grouped data points do 9~10 for i = 1,2,..., n

 

 

 

9

Input xi

xi

ENTER

 

 

   yi

yi

ENTER

 

 

   fi

fi

D

sumfi

10

If you made a mistake in inputting xk, yk and fk then correct by -->

xk

ENTER

 

   

yk

ENTER

 

   

fk

D

sumfi-fk

11

Calculate means: x

 

f B

mean x

 

   mean y

 

R/S

mean y

12

Calculate coefficients of variation: Vx  

f B

Vx

 

   Vy

 

R/S

Vy

13

Calculate Standard Deviations

 

 

 

       sx

 

f C

sx

 

    sy

 

R/S

sy

 

    sx'

 

f C

sx'

 

    sy'

 

R/S

sy'

14

Calculate covariance

 

 

 

 

    sxy

 

f D

sxy

 

    sxy'

 

R/S

sxy'

15

Calculate correlation coefficient gammaxy

 

f D

gammaxy

16

Calculate sums:

 

 

 

 

  sumxi  

f E

sumxi

     sumyi  

R/S

sumyi

     sumxiyi  

R/S

sumxiyi

17

Calculate sums of squares      
      sumxi2  

f E

sumxi2

     sumyi2  

R/S

sumyi2

  For a new case go to step 2      

  

*Note: To clear the print mode press -->

 

CLF 0

 

Example

For the following set of data, find the means, standard deviations, covariance, correlation coefficient, coefficients of variation, and the sums.

      xi  26  30  44  50  62  68  74
      yi  92  85  78  81  54  51  40

Keystrokes                     Outputs
A                                0.00
f A                              1.00
26 ENTER 92 B                   26.00 *** (x1)
                                92.00 *** (y1)
                                 1.00 ***

100 ENTER 100 B                100.00 *** (x2)
                               100.00 *** (y2) (error)
                                 2.00 ***

100 ENTER 100 C                100.00 *** (x2)
                               100.00 *** (y2) (correction)
                                 1.00 ***

30 ENTER 85 B                   30.00 *** (x2)
                                85.00 *** (y2)
                                 2.00 ***

44 ENTER 78 B                   44.00 *** (x3)
                                78.00 *** (y3)
                                 3.00 ***

50 ENTER 81 B                   50.00 *** (x4)
                                81.00 *** (y4)
                                 4.00 ***

62 ENTER 54 B                   62.00 *** (x5)
                                54.00 *** (y5)
                                 5.00 ***

68 ENTER 51 B                   68.00 *** (x6)
                                51.00 *** (y6)
                                 6.00 ***
74 ENTER 40 B                   74.00 *** (x7)
                                40.00 *** (y7)
                                 7.00 ***

f B                             50.57 *** (mean x)
R/S                             68.71 *** (mean y)

f B                             36.58 *** (Vx)
R/S                             29.10 *** (Vy)

f C                             18.50 *** (Sx)
R/S                             20.00 *** (Sy)

f C                             17.13 *** (Sx')
R/S                             18.51 *** (Sy')

f D                           -354.14 *** (Sxy)
R/S                           -303.55 *** (Sxy')

f D                             -0.96 *** (gammaxy)
f E                            354.00 *** (sumxi)
R/S                            481.00 *** (sumyi)
R/S                          22200.00 *** (sumxiyi)
f E                          19956.00 *** (sumxi^2)
R/S                          35451.00 *** (sumyi^2)

The Program

LINE  KEYS
001  *LBL A
002   CL REG
003   CF 0      Initialize
004   CF 1
005   CF 2
006   P<>S
007   CL REG
008   P<>S
009   0
010   RTN
011  *LBL a     Set flag 0 for print.
012   SF 0
013   1
014   RTN
015  *LBL C     Correction for xk, yk.
016   F0?
017   GSB 0
018   SF 1
019   X<>Y
020   sum-
021   GSB 9
022   GSB 8
023   CF 1
024   RTN
025  *LBL B
026   F0?       Input xi, yi.
027   GSB 0
028   X<>Y
029   sum+
030   GSB 9
031   GSB 8
032   RTN
033  *LBL D     Input xi, yi, fi.
034   STO C
035   F1?
036   CHS
037   STO + 9
038   roll dn
039   STO B
040   roll dn
041   STO A
042   roll up
043   F0?
044   GSB 0
045   roll up
046   ABS
047   GSB 9
048   STO I
049  *LBL 2
050   RCL B
051   RCL A
052   GSB 3
053   DSZ I 
054   GTO 2
055   RCL 9
056   P<>S
057   STO 9
058   P<>S
059   GSB 9
060   GSB 8
061   RTN
062  *LBL E     Correction for xk, yk, fk.
063   SF 1
064   GSB D
065   CF 1
066   RTN
067  *LBL 3
068   F1?
069   GTO 4
070   sum+
071   RTN
072  *LBL 4
073   sum-
074   RTN
075  *LBL b
076   mean      mean x, mean y
077   GSB 9
078   R/S
079   X<>Y
080   GSB 9
081   GSB 8
082   RTN
083  *LBL b
084   mean
085   STO 0
086   X<>Y
087   P<>S
088   STO 0
089   P<>S      vx, vy
090   S 
091   EEX
092   2
093   x
094   X<>Y
095   LST X
096   x
097   X<>Y
098   RCL 0
099   ÷
100   GSB 9
101   R/S
102   X<>Y
103   P<>S
104   RCL 0
105   P<>S
106   ÷
107   GSB 9
108   GSB 8
109   RTN
110  *LBL c
111   S 
112   GSB 9
113   R/S
114   X<>Y      sx, sy
115   GSB 9
116   GSB 8
117   RTN
118  *LBL c
119   S 
120  *LBL 1
121   P<>S      sx', sy'
122   RCL 9
123   P<>S
124   ENTER
125   X<>Y
126   1
127   -
128   ÷
129   sqrt
130   ÷
131   GSB 9
132   F2?
133   GSB 8
134   CF 2
135   R/S
136   LST X
137   S 
138   X<>Y
139   SF 2
140   GTO 1
141   RTN
142  *LBL d
143   mean
144   X<>Y
145   P<>S
146   STO 0
147   RCL 8
148   RCL 4
149   RCL 0
150   x
151   -         sxy, sxy'
152   RCL 9
153   1
154   -
155   ÷
156   P<>S
157   STO E
158   GSB 9
159   R/S
160   P<>S
161   RCL 9
162   P<>S
163   ENTER
164   X<>Y
165   1
166   -
167   ÷
168   ÷
169   GSB 9
170   RTN
171  *LBL d
172   S 
173   RCL E
174   ÷
175   x         gammaxy
176   1/X
177   GSB 9
178   GSB 8
179   RTN
180  *LBL e
181   RCL sum
182   GSB 9     sumxi, sumyi
183   R/S
184   X<>Y      sumxiyi
185   GSB 9
186   R/S
187   P<>S
188   RCL 8
189   P<>S
190   GSB 9
191   GSB 8
192   RTN
193  *LBL e
194   P<>S
195   RCL 7
196   RCL 5     sumxi2, sumyi2
197   P<>S
198   GSB 9
199   R/S
200   X<>Y
201   GSB 9
202   GSB 8
203   RTN
204  *LBL 0
205   X<>Y
206   PRTX      Print xi, yi
207   X<>Y
208   PRTX
209   RTN
210  *LBL 9
211   F0?       Subroutine to print.
212   PRTX
213   RTN
214  *LBL 8
215   F0?       Subroutine for space
216   PRT SPC  
217   RTN

Register Use

R0  mean x
R9  sumfi
A   xi
B   yi
C   fi

Go back to the software library
Go back to the main exhibit hall