background image

 

hp calculators 

 

HP 30S Statistics – Linear Regression

 

 
Linear regression 
 
A regression of y on x is a way of predicting values of y when values of x are given. If the regression is based on a 
straight line graph, it is called a linear regression, and the straight line is called the regression line.  
 
The regression line (sometimes referred to as the line of best fit) of y on x is then the line that gives the best prediction of 
values of y from those of x, and is: 

where    

n

x

b

y

a

i

i

=

   and   

n

)

x

(

x

n

y

x

y

x

b

i

i

i

i

i

i

2

2

=

 

bx

a

y

+

=

 

n being the number of data pairs. (Note that the regression line of x on y, which is usually different from the regression 
line of y on x, can be found by interchanging x and y in the above expressions). a and b are known as the linear 
regression coefficientsThe independent variable is the regressor, and the dependent variables is called regressand
The coefficients are found by minimizing the sum of the squares of the vertical distances of the points from the line (i.e. 
the sum of the squares of the residuals). This method is known as least squares. 
 
The correlation coefficient is a measure of the amount of agreement between the x and y variables, and is given by: 
 





=

n

)

y

(

y

n

)

x

(

x

n

y

x

y

x

r

i

i

i

i

i

i

i

i

2

2

2

2

 

 
When r is positive, the correlation is positive, which means that high values of one variable correspond to high values of 
the other. Conversely, if r is negative then the correlation is negative:  low values of one variable correspond to high 
values of the other. An important property of r is that 

1

1

r

. The 

±

1 values correspond to a perfect correlation: 

real values and estimates are exactly the same. If r = 0 then there’s no correlation: x and y are uncorrelated. 
 
On the HP 30S, linear regressions are calculated in 2-VAR STAT operating mode. First of all, let’s clear any previous 
data. To do so, press 

–1

to display the STAT menu, and then select CLR-DATA using the 

<

 and 

@

keys, finally 

press 

y

to confirm. Next, press 

–1

again, select 2-VAR, and press 

y

. You’re now ready to carry out 

regression calculations on your calculator, which are illustrated by the following examples. 
 
Practice solving linear regression problems 
 
Example 1:  A quality control engineer notes a relationship between the amount of chemical added to a batch, and the 

final concentration of the chemical in the final product. The following table shows the weight in grams 
added (x) and the weight in the final product (y): 

 
 

hp calculators 

- 2 - 

HP 30S Statistics – Linear Regression - Version 1.0 

Summary of Contents for HP 30S

Page 1: ...hp calculators HP 30S Statistics Linear Regression Linear Regression Practice Solving Linear Regression Problems ...

Page 2: ...greement between the x and y variables and is given by n y y n x x n y x y x r i i i i i i i i 2 2 2 2 When r is positive the correlation is positive which means that high values of one variable correspond to high values of the other Conversely if r is negative then the correlation is negative low values of one variable correspond to high values of the other An important property of r is that 1 1 ...

Page 3: ...ressed 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 ...

Page 4: ... 5 9 To find press y 5 10 b to select y10 5y y Answer According to the new regression the predicted value is 9 88 grams The regression line is now where x is still the amount of chemical added and y is the concentration which y x 98 0 38 0 is not the same as before y x 18 1 44 1 Example 5 By polling fifty people a survey taker obtained the following data and 3333 i x 9 459 yi 231933 2 i x 57 4308 ...

Page 5: ...s that point 610 15 6 is anomalous and is consequently removed from the data set To do so press Figure 1 a seven times and e NB not o The new correlation coefficient is displayed as above i e by pressing b and then the left arrow key six times Answer r 0 9997 so there s strong evidence that the relation is linear The regression line is x y 01 0 03 8 Example 7 Find the power curve that best fits th...

Reviews: