Moving Averages Objectives: D Grade B Grade Interpret a Time Series Graph Construct a Time Series Graph and Plot the Moving Averages Moving Averages A line graph is a series of points joined with straight lines e.g. a patient’s temperature was recorded every 2 hours after receiving medication: Note the features: Temperature oC Temperature over time Title Axis Labels What does this line represent? The points are plotted as coordinates Normal body temperature 42 41 40 39 38 37 The points are joined with straight lines 36 35 0 2 4 6 8 Time after medication (hrs) 10 12 A second set (or more) of data may be added to the graph. Moving Averages Because the line graph of temperature was plotted against time it can also be called a ‘Time Series Graph’ Time Series Graphs are often used by people to identify trends over a period of time where they may be natural fluctuations. For example, after installing loft and cavity wall insulation a householder wants to review his gas bills to see if he is saving money. Moving Averages A graph of gas bills plotted against time. Cost of Gas Bill 300 Cost (£) 250 200 150 100 50 0 1st 3rd 2nd 4th 1st 2006 Year / Quarter 3rd 2nd 4th 2007 rd, 4th? Why is there so much fluctuation in the a pattern? the x axis labelled with years andgraph 1st, 2–ndis , 3there The 1st quarter is winterwater, whenetc.,) you would to use a lot of gas for heating, Utility (gas, electric, bills areexpect sent out every 3 months (quarter of a year) rd the 3 quarter is the summer when you don’t use the heating. Moving Averages A different number of points for a moving average can be selected depending upon the data being analysed. Different types of data suit different moving averages Which type of moving average which suit which data set? Electricity Bill Three-point moving average Gas Bill Four-point moving average Half-term test results Five-point moving average Phone Bill Six-point moving average Daily Superstore Sales Seven-point moving average Termly test results Moving Averages Time Series Graph Year 2006 2007 2nd 3rd 4th 1st 2nd 3rd 2008 Quarter 1st 4th 1st 2nd 3rd Ice Cream Sales (£) 340 525 965 470 355 510 1100 375 410 555 1150 485 Ice Cream Sales (£) Plot the data as a time series graph: This is essentially a line graph. The time is always plotted on the x-axis 1200 x x 1000 x 800 600 400 x x x x x x x x x 200 2006 2007 2008 4th Representing Data Moving Averages Moving Averages are a way of looking at a trend over a period of time. For a four-point the mean is calculated from the first four pieces of data, then the next point is calculated by moving the selection one place across to calculate the mean of 4 points again Year Quarter 2006 2nd 3rd 2007 2nd 3rd 2008 2nd 3rd Calculate the mean of the first 4 points i.e.i.e. second 4 points 1 Ice Cream Sales (£) 340 525 965 470 355 510 1100 375 410 555 1150 485 525+965+470 340+525+965+470 = 575 +355= 579 Moving Average 575 4 Ice Cream Sales (£) 2 1st 4th 1st 4th 1st 4th Ice Cream Sales (£) 340 525 965 470 355 510 1100 375 410 555 1150 485 Moving Average 575 579 575 609 585 599 610 623 1200 1000 x x x The moving average point is plotted in the middle of the 4 points the average is taken from 800 600 400 x x x x x x x x xx x x x x x x x For a 3 point moving average take the mean over 3 points, for a 5 point moving average take the mean over 5 points, etc. 200 2006 2007 You can see there is a general increase in sales over time 2008 Moving Averages P20 Q 5 Year 2006 2006 2006 2006 Quarter 1st 2nd 3rd 4th Cost £230 £120 £50 £80 Four-point moving £120 £116 average 2007 1st £215 2007 2nd £120 2007 3rd £25 2007 4th £55 P21 Q 6 Day Mon Mon Tue Tue Wed Session a.m. p.m. a.m. p.m. a.m. Number 220 210 243 215 254 Two point 215 226.5 229 234.5 moving average Wed p.m. 218 Thu a.m. 251 Thu p.m. 201 Fri a.m. 185 Fri p.m. 152 Moving Averages P21 Q 7 Year 2005 2006 2006 2006 2007 2007 2007 Session Autumn Spring Summer Autumn Spring Summer Autumn Exam Result (%) 86 93 70 83 93 67 77 P21 Q 8 Jul-04 Oct-04 Jan-05 Apr-05 Jul-05 Oct-05 Jan-05 Apr-06 120 x 100 x Sales (£ thousands) Quarter Shop Sales x x 80 60 x 40 x 20 x 0 x Moving Averages P20 Q 5 Year 2006 2006 2006 2006 2007 2007 2007 Quarter 1st 2nd 3rd 4th 1st 2nd 3rd Cost £230 £120 £50 £80 £215 £120 £25 Four-point moving £120 £116 £116.25 £110 £103.75 average 2007 4th £55 250 x x 200 Cost (£) 150 100 x x x x x x x 50 x x x 0 1st 2nd 3rd 4th 1st 2nd 3rd 2006 2007 Time (year, quarter) 4th The trend is moving downwards which means that the electricity costs are falling Moving Averages P21 Q 6 Day Mon Mon Tue Tue Wed Wed Thu Thu Fri Fri Session a.m. p.m. a.m. p.m. a.m. p.m. a.m. p.m. a.m. p.m. Number 220 210 243 215 254 218 251 201 185 152 Two point 215 226.5 229 234.5 236 234.5 226 193 168.5 moving average 270 x Number Present 250 x 230 210 190 170 150 x x x x x x x x x x x x x x x x x The trend is downwards – starting low on Monday, then rising to Wednesday, but Falling sharply towards Friday. Moving Averages P21 Q 7 100 Year 2005 2006 2006 2006 2007 2007 2007 Session Autumn Spring Summer Autumn Spring Summer Autumn 90 x Exam Result (%) 86 93 70 83 93 67 77 80 83 82 82 81 79 x x x x x x x x 70 x x 60 P21 Q 8 Quarter Shop Sales Jul-04 100 Oct-04 Jan-05 Apr-05 40 10 80 57.5 60 62.5 Jul-05 110 Oct-05 Jan-05 Apr-06 50 12 86 63 64.5 120 x c. The trend is slightly upwards 67= 50+12+86 +x 4 67 × 4 = 50 + 10 + 86 + x Sales (£ thousands) d. The next point would probably lie at 67 100 x 60 40 268 = 146 + x x = 122 So the next quarter sales would be about £122 000 x x 80 x x x x x x x x 20 x 0 x