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:...→γxy →Σxi:... 
Label Start xi↑yi(Σ+) xk↑yk(Σ-) xi↑...(Σ+) xk↑...(Σ-)
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 (x̄) = 1/n Σ(i=1..n)xi

mean y (ȳ) = 1/n Σ(i=1..n)yi

standard deviation sx = sqrt(((Σxi2 - n(x̄)2)/(n-1))

or sx' = sqrt(((Σxi2 - n(x̄)2)/n)

standard deviation sy = sqrt(((Σyi2 - n(ȳ)2)/(n-1))

or sy' = sqrt(((Σyi2 - n(ȳ)2)/n)

covariance sxy = (1/(n-1))*(Σxiyi - (1/n)*Σxiyi)

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

correlation coefficient γxy = sxy/sxsy

Coefficients of variation Vx = 100*sx/x̄,   Vy = 100*sy/ȳ

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 Σfi
10 If you made a mistake in inputting xk, yk and fk then correct by → xk ENTER↑  
    yk ENTER↑  
    fk D Σfi-fk
11 Calculate means: x   f B
     mean y   R/S
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 γxy   f D γxy
16 Calculate sums:      
    Σxi   f E Σxi
     Σyi   R/S Σyi
     Σxiyi   R/S Σxiyi
17 Calculate sums of squares      
      Σxi2   f E Σxi2
     Σyi2   R/S Σyi2
  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 *** (x̄)
R/S                             68.71 *** (ȳ)

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 *** (γxy)
f E                            354.00 *** (Σxi)
R/S                            481.00 *** (Σyi)
R/S                          22200.00 *** (Σxiyi)
f E                          19956.00 *** (Σxi2)
R/S                          35451.00 *** (Σyi2)

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   Σ-
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   Σ+
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   R↓
039   STO B
040   R↓
041   STO A
042   R↑
043   F0?
044   GSB 0
045   R↑
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   Σ+
071   RTN
072  *LBL 4
073   Σ-
074   RTN
075  *LBL b
076   x̄         x̄, ȳ
077   GSB 9
078   R/S
079   x⇔y
080   GSB 9
081   GSB 8
082   RTN
083  *LBL b
084   x̄
085   STO 0
086   x⇔y
087   P⇔S
088   STO 0
089   P⇔S       vx, vy
090   s
091   EEX
092   2
093   ×
094   x⇔y
095   LST x
096   ×
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   √x
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   x̄
144   x⇔y
145   P⇔S
146   STO 0
147   RCL 8
148   RCL 4
149   RCL 0
150   ×
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   ×         γxy
176   1/x
177   GSB 9
178   GSB 8
179   RTN
180  *LBL e
181   RCL Σ+    RCLΣ
182   GSB 9     Σxi, Σyi
183   R/S
184   x⇔y       Σxiyi
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     Σxi2, Σyi2
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  x̄
R9  Σfi
A   xi
B   yi
C   fi

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