hp calculators
HP 30S Statistics – Linear Regression
x 2 1 6 3 7 6 9
y 3 1 5 5 7 8 8.5
Find the linear regression line and the correlation coefficient for this data.
Solution:
First of all, we have to enter the given data, which is really easy on the HP 30S. Simply pressing
a
makes your calculator prompt you for the first value displaying “x
1
=” in the entry line. Let’s now enter the
data by pressing:
2?3?1?1?6?5?3?5?7?7?6?8?9?8.5
?
Data pairs are entered in order, the x values first. Notice that values are actually entered by pressing the
?
key, not the
y
key. This is because you may wish to calculate a value first (e.g. A
y
+ B % ANS
y
)
– keep in mind that the history stack (i.e. a log of past calculations) is not available in STAT mode, but the
ANS variable can be used, and the most recent calculation can be retrieved to be edited. Correcting data is
as easy as using the
&
and
?
keys to display the wrong value and change it. The new value replaces the
old one: you need not press
o
to clear the entry line.
Once all the values have been entered, results can be displayed by pressing
b
. This displays a menu
with seventeen variables. Select the desired result using the
<
and the
@
keys. Values appear in the
result line. Pressing
y
puts the selected variable (its name, not its value) into the entry line for further
calculations. This menu works much like the CONST menu.
Answer:
Expressed to two decimal digits, a = 1.22 and b = 0.85, therefore the regression line is:
. The correlation coefficient, is 0.91, which means that the correlation is positive and
that it is quite a good fit since r is close to 1. However, exactly how far away from this value the correlation
can be and the equation still be considered a good predictor is certainly a matter of debate.
x
.
.
y
85
0
22
1
+
=
Example 2: If the engineer adds 4 grams of the chemical, what will be the concentration in the final product?
Solution:
Predicted values can be easily calculated using the regression line, but the quickest way is to use the
STATVAR menu again. Press
b
, select and press
y
. The entry line now reads
with the
blinking cursor placed on the right parenthesis. returns a predicted y value given an x value, that is,
returns
(remember that these numbers are shown to two decimal digits in this document,
but not on your calculator). Enter the given x value:
4
and press
y
to calculate the predicted
concentration.
'
y
)
('
y
'
y
x
.
.
85
0
22
1
+
Answer:
4.63. In many textbooks is written as . It is important to understand that the actual
concentration may well be different.: the regression line is just a mathematical model of the reality.
=
)
('
y
4
'
y
yˆ
Example 3: In order to obtain a concentration of 10.5, how much chemical should she add?
Solution: Once
again
press
b
but select this time, and press
y
to put this function into the entry line.
'
x
returns
'
x
b
a
y
−
. Enter the given y value:
10.5
and press
y
to calculate the estimated
amount of chemical.
hp calculators
- 3 -
HP 30S Statistics – Linear Regression - Version 1.0