






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







This chapter concerns itself with relationships between continuous variables, such as height and weight, market value and number of transactions, or temperature and sales of ice cream. How would you expect the three pairs of variables listed here to relate to one another? You have already seen (in semester 1) how to present paired data through a scatter diagram; this descriptive analysis is now supplemented with more formal techniques. The data consist of n pairs of observations on two variables X and Y :
(x 1 , y 1 ), (x 2 , y 2 ),... , (xn, yn).
These data could have arisen from a random sample of n individuals from a population, or from an experiment in which one variable, usually the X variable, is held fixed or con- trolled at certain chosen levels and independent measurements of the response variable, conventionally Y , are taken at each of these levels. The first step is always to plot the data on a scatter diagram.
Example: ice cream sales Consider the following data (shown overleaf) for ice cream sales at Luigi Minchella’s ice cream parlour. Is there any relationship between average temperature and ice cream sales? How would you describe this relationship?
Figure 6.1 shows a scatter plot of these data, drawn in Minitab. Looking at this di- agram, we can immediately see that the two variables are related; in fact, it appears that, as the average temperature increases, sales also increase. We say such a relationship is a positive relationship. If there was a “downwards” or “downhill” slope to the scatter diagram, we would say the relationship was negative. It looks like we could also draw a straight line through the middle of the data without the points straying too much from this line. Thus, we can also say that the two variables have a linear relationship. The more the points stray from this line, the weaker the (linear) relationship between the two variables. So average temperatures and ice cream sales have a strong, positive, linear relationship.
Figure 7.1: Scatter plot showing the relationship between average temperature and ice
- January - February - March - April - May - June - July - August We have a sample size of 12 (not 24!), and so n = 12. Thus, using the sums of the first two columns we can find the sample means of temperature (X) and ice cream sales (Y ):
x¯ =
= 10 and
¯y =
Similarly,
xy
− nx¯¯y = 13362 − 12 × 10 × 100 = 13362 − 12000 = 1362 ,
x^2
− nx¯^2 = 1450 − 12 × 10 × 10 = 1450 − 1200 = 250 and
y^2
− ny¯^2 = 127674 − 12 × 100 × 100 = 127674 − 120000 = 7674.
Thus,
r =
= 0 .983 (to 3 decimal places).
We have a correlation coefficient of 0.983. Remember, this implies that there is a strong, positive (linear) relationship between average temperature and ice cream sales since the correlation coefficient is very close to +1. This is what we might expect, given the pattern shown in figure 6.1.
Remember, if your calculated correlation coefficient does not lie between −1 and + then you’ve done something wrong! You should also check to see if your calculated co- efficient agrees with what you can see in the scatter diagram – an “uphill” slope ties in with a positive correlation coefficient, and a “downhill” slope with a negative correlation coefficient. If there appears to be just a random scatter of points, you might expect to get a correlation coefficient which is close to zero. The closer to a straight line the points will lie, then the closer to either +1 or −1 the correlation coefficient should be.
Data sets which show non–linear association can be analysed by the technique described above after transforming the data to linearity, or by using rank correlation methods which are outside the scope of this course.
A correlation analysis may establish a linear relationship but does not allow us to use it to say, predict the value of one variable given the value of another. Regression analysis allows us to do this and more. It is also applicable when one of the variables (X) is controlled.
We will assume that the scatter plot of Y versus X shows roughly a straight line and, in addition, that the spread in the Y –direction is roughly constant with X.
Look at the scatter plot of ice cream sales against average temperatures. A “line of best fit” can be drawn through the data, and from this line we can make predictions of ice cream sales based on temperature for temperatures which we have no data for. The problem is, everyone’s line of best fit is bound to be slightly different! And so everyone’s predictions will be slightly different! The aim of regression analysis is to find the very best line which goes through the data in a less subjective way. We do this through the regression equation. Before you can understand a regression equation, you need to know what a straight line equation actually is.
We assume a simple linear regression model for the data (and for the population from which the data have been drawn) in which
Y = α + βx + ǫ
where Y is the response variable, X is the explanatory variable, and ǫ (“epsilon”) is a random error with zero mean and constant variance. The unknown parameters α (“alpha”) and β (“beta”) represent the intercept and slope of the population regression line α + βx. Obviously, we need to find α and β; the best values will minimise the gaps between the regression line and the data. These “gaps” are known as the residuals. The values of α and β which give rise to the “best” regression line, i.e. the line which minimises the residuals, are
βˆ = SXY SXX
and
αˆ = y¯ − βˆ x,¯
where SXY and SXX are as before. The “hats” on α and β are there to remind ourselves that we have estimated α and β using our sample data; these estimates will change from sample to sample. Since the error term (ǫ) is assumed to have zero mean, in practice we don’t estimate this and just ignore it in any further analysis.
Example: ice cream sales We now use simple linear regression to fit a regression line through the ice cream sales data. The equation of the regression line is
y = αˆ + βx,ˆ
where we can find ˆα and βˆ using
βˆ = SXY SXX
and
αˆ = y¯ − βˆ x.¯
Notice that βˆ must be found first, since we need βˆ in order to calculate ˆα. Thus,
βˆ = 1362 250
= 5. 448 and
αˆ = 100 − 5. 448 × 10 = 100 − 54. 48 = 45. 52.
Figure 7.2: Scatter plot showing the relationship between average temperature and ice cream sales, with superimposed regression line
Thus, the regression equation is
y = 45 .52 + 5. 448 x
The scatter plot in figure 6.2 has this regression line superimposed. We can use this regression equation to predict ice cream sales for a given temperature. For example, if we were interested in knowing what the sales would be if the monthly average temperature was 10oC, we can either
(1) take a reading from the graph, or
(2) substitute 10 into our regression equation and solve for y.
The second approach is probably better, since the accuracy of a reading from your graph depends on how accurately you have drawn your graph in the first place. Thus, using our regression equation, the number of sales we can expect if the average temperature is 10oC is
y = 45 .52 + 5. 448 × 10 = 45 .52 + 54. 48 = 100 ,
i.e. £ 100 , 000.
(a) Produce a scatter plot for these data, and comment on the relationship between advertising and sales. (b) Calculate the sample correlation coefficient. Does this agree with what you can see in your plot in part (a)? (c) Perform a linear regression analysis on these data, and obtain the linear re- gression equation. (d) Plot the regression line on your scatter diagram in part (a). (e) If the company were to spend £ 112 , 000 on advertising in a month, what could we expect their sales to be?
Month Advertising (£ 000 ′s) Sales (£ Millions) January 100 11. February 90 12. March 110 13. April 120 15. May 115 14. June 95 10. July 105 12. August 130 16. September 118 14. October 100 10. November 115 11. December 128 15.
2*. (a) In this chapter we have looked at the Pearson Product Moment Correla- tion Coefficient; however, this is just one of many correlation coefficients we could use to quantify the strength of linear dependence between two variables. Write down the name of one other correlation coefficient, give its formula, and explain how it differs to the Pearson Product Moment Correlation Coefficient. (b) What regression models could be used for data which do not display a linear association?