vignettes/filterMA.Rmd
filterMA.Rmd
Time series filtering (or smoothing) helps to reveal longer-term trends by smoothing noise and short-term fluctuations. The function in CornerstoneR implements four types of the moving average filter, namely:
Therefore, the user should choose a type of moving average and the window size of the smoothing. In the next steps, we will show an example of the Moving Average Filter in CornerstoneR.
In this example, we will use the 'Trash'
data set
provided in Cornerstone as build-in Test Data. This data set contains 13
columns and 768 observations with details about the waste incineration
in three different cities.
We select the menu 'Analyses'
\(\rightarrow\) 'CornerstoneR'
\(\rightarrow\)
'Moving Average Filter'
.
In the appearing dialog, select the variable 'Time'
as
predictors, the variables 'Line Speed'
and
'Feed Rate'
as responses. We will select the variable
'City'
for grouping in this example. If your data has no
grouping, this field should be left blank. In case you want to include
extra columns to your output dataset, you can put these to
auxiliaries.
'OK'
confirms your selection. The next step is to select
the type of moving average and the window size. To do this, we open the
menu 'R Script'
\(\rightarrow\)
'Script Variables'
. The screenshot shows the default
options.
For this example we will use the default options. Close this dialog
with 'OK'
and click the execute button (green arrow) or
choose the menu 'R Script'
\(\rightarrow\) 'Execute'
and
all calculations are done via 'R'
. Calculations are done if
the text at the lower left status bar contains
'Last execute error state: OK'
. Our results are available
via the menus 'Summaries'
and 'Graphs'
.
The menu 'Data Filter'
displays the original data, the
smoothed responses and the remainder (true value minus the smoothed
value).
In the menu 'Graphs'
, we can see one graph per group.
Each graph contains all the responses variables that we selected in the
beginning of the analysis ('Line Speed'
and
'Feed Rate'
). The graph
'Line Plot Data Filter for Group Des Moines'
shows the
original and smoothed values of the time series for the city Des
Moines.