GraPL > GraPL Desktop > Tutorials > Fuel > Summarising
 

Averages and Smooths

GraPL has two basic methods of smoothing out data series when you know that your input numbers are ‘noisy’:

  • the Exponential Smooth is a good approach when you are trying to make sense of data which jumps around at random – things like stock-market prices or fluctuating currency values. Essentially it says “my best guess at the true value is today’s figure + a bit of yesterday’s + a smaller bit of the day before’s ...” and so on. If you set the smoothing constant (traditionally known as Alpha) to 0.5 then you are simply taking Today + (0.5*yesterday) + (0.25*the day before) ... and so (then dividing by 2) as your best guess.
  • the Moving Average is ideal when there is some underlying pattern to the data, for example daily sales of bread, which could usefully be plotted with a 7-point average to show a long-term trend unobscured by the buying patterns during the week. Similarly you could use a 12-point average if you were looking for long-term trends in monthly sales data of a very seasonal product like ice cream.

In this example we know that the variation is not at all random, as a ‘good’ reading is probably just that I didn’t fill the tank as fully as last time, and it will be compensated for by a matching ‘bad’ reading next time. Let’s try adding a Moving Average column to the datasheet and using a calculation to populate it. The easy way to do this is to use the right-mouse menu on the column header in the existing datasheet and select ‘Append column’:

I have called the column ‘Mavg’ and set the units as MPG. Now we need to add a calculation element, so bring back the ‘Calculations’ tab and drag a Moving Average to the bottom of the sheet. Note that calculation sheets are run ‘top down’ so it is important to put this after the line that works out the MPG!

I have also modified the Chart here to take out the ‘Trend’ and plot ‘MPG,Mavg’ versus Odo. Again, you can play with the averaging period – obviously smaller numbers will make the curve more sensitive to the detail. Really, there is no hard-and-fast rule here – just keep changing the period up and down (say from 2 to about 15) and see which value best shows up the patterns in the data.

Modifying the Line Weights

As you learned in the ‘Mobiles’ tutorial, GraPL has a preset cycle of colours, line-styles, nib-weights and so on. These are used in sequence by each series you plot (try the effect of reversing the plotted data so it reads ‘Mavg,MPG’) and in this case it would be nice to emphasise the average by beefing up the line-weight a little. Select the ‘Settings’ tab and drag the ‘Nibs’ icon across, probably to the very top of the chart specification, and certainly above the Linechart block. By default, GraPL sets a single nib-weight of 0.3pt for all lines, so to make our average stand out a little, try changing this to ‘0.3,1.2’ and double-click the thumbnail to see the finished effect at full-screen size:

That concludes this tutorial – now you know how to calculate columns from other columns in your datasheet, and how to add simple smoothing algorithms to timeseries data. Exactly what is the underlying cause of the very obvious cyclic pattern remains a subject for investigation!


© Copyright Causeway Graphical Systems Ltd 2000-2007
Telephone: +44 (0)1439 788413