0% found this document useful (0 votes)
57 views7 pages

3 - 1 Transformations and Adjustments

The document discusses different types of adjustments that can be made to time series data before forecasting, including calendar, population, inflation and mathematical transformations. These adjustments aim to simplify patterns in the data by removing known sources of variation, leading to more accurate forecasts. Calendar, population and inflation adjustments deal with external factors influencing the data, while mathematical transformations like logs and Box-Cox aim to stabilize variance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views7 pages

3 - 1 Transformations and Adjustments

The document discusses different types of adjustments that can be made to time series data before forecasting, including calendar, population, inflation and mathematical transformations. These adjustments aim to simplify patterns in the data by removing known sources of variation, leading to more accurate forecasts. Calendar, population and inflation adjustments deal with external factors influencing the data, while mathematical transformations like logs and Box-Cox aim to stabilize variance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

3.

1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

3 .1 Tra n s fo r m a t i o n s a n d a d j u s t m e n t s

Adjusting the historical data can often lead to a simpler time series. Here, we deal
with four kinds of adjustments: calendar adjustments, population adjustments,
inflation adjustments and mathematical transformations. The purpose of these
adjustments and transformations is to simplify the patterns in the historical data
by removing known sources of variation or by making the pattern more
consistent across the whole data set. Simpler patterns usually lead to more
accurate forecasts.

C a le n d a r a d j u s t m e n t s

Some of the variation seen in seasonal data may be due to simple calendar
effects. In such cases, it is usually much easier to remove the variation before
doing any further analysis.

For example, if you are studying the total monthly sales in a retail store, there
will be variation between the months simply because of the different numbers of
trading days in each month, in addition to the seasonal variation across the year.
It is easy to remove this variation by computing average sales per trading day in
each month, rather than total sales in the month. Then we effectively remove the
calendar variation. Simpler patterns are usually easier to model and lead to more
accurate forecasts.

Po p u l a t i o n a d j u s t m e n t s

Any data that are affected by population changes can be adjusted to give per-
capita data. That is, consider the data per person (or per thousand people, or per
million people) rather than the total. For example, if you are studying the

1 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

number of hospital beds in a particular region over time, the results are much
easier to interpret if you remove the effects of population changes by considering
the number of beds per thousand people. Then you can see whether there have
been real increases in the number of beds, or whether the increases are due
entirely to population increases. It is possible for the total number of beds to
increase, but the number of beds per thousand people to decrease. This occurs
when the population is increasing faster than the number of hospital beds. For
most data that are affected by population changes, it is best to use per-capita
data rather than the totals.

This can be seen in the  global_economy  dataset, where a common


transformation of GDP is GDP per-capita.

global_economy %>%

filter(Country == "Australia") %>%


autoplot(GDP / Population)

Figure 3.1: Australian GDP per-capita.

2 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

Inflation adjustments

Data which are affected by the value of money are best adjusted before
modelling. For example, the average cost of a new house will have increased over
the last few decades due to inflation. A $200,000 house this year is not the same
as a $200,000 house twenty years ago. For this reason, financial time series are
usually adjusted so that all values are stated in dollar values from a particular
year. For example, the house price data may be stated in year 2000 dollars.

To make these adjustments, a price index is used. If zt denotes the price index
and yt denotes the original house price in year t, then xt = yt /zt ∗ z2000 gives the
adjusted house price at year 2000 dollar values. Price indexes are often
constructed by government agencies. For consumer goods, a common price index
is the Consumer Price Index (or CPI).

This allows us to compare the growth or decline of industries relative to a


common price value. For example, looking at aggregate “newspaper and book”
retail turnover from  aus_retail , and adjusting the data for inflation using CPI
from  global_economy  allows us to understand the changes over time.

3 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

print_retail <- aus_retail %>%


filter(Industry == "Newspaper and book retailing") %>%

group_by(Industry) %>%
index_by(Year = year(Month)) %>%
summarise(Turnover = sum(Turnover))
aus_economy <- global_economy %>%
filter(Code == "AUS")

print_retail %>%
left_join(aus_economy, by = "Year") %>%
mutate(Adjusted_turnover = Turnover / CPI) %>%
gather("Type", "Turnover", Turnover, Adjusted_turnover, factor_key = TRUE) %>%

ggplot(aes(x = Year, y = Turnover)) +


geom_line() +

facet_grid(vars(Type), scales = "free_y") +


xlab("Years") + ylab(NULL) +
ggtitle("Turnover for the Australian print media industry")

By adjusting for inflation using the CPI, we can see that Australia’s newspaper
and book retailing industry has been in decline much longer than the original

4 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

data suggests.

M a t h e m a t i c a l t ra n s f o r m a t i o n s

If the data shows variation that increases or decreases with the level of the
series, then a transformation can be useful. For example, a logarithmic
transformation is often useful. If we denote the original observations as
y1 , … , yT and the transformed observations as w1 , … , wT , then wt = log(yt ).
Logarithms are useful because they are interpretable: changes in a log value are
relative (or percentage) changes on the original scale. So if log base 10 is used,
then an increase of 1 on the log scale corresponds to a multiplication of 10 on the
original scale. If any value of the original series is zero or negative, then
logarithms are not possible.

Sometimes other transformations are also used (although they are not so
interpretable). For example, square roots and cube roots can be used. These are
called p o w e r t r a n s f o r m a t i o n s because they can be written in the form wt = ytp .

A useful family of transformations, that includes both logarithms and power


transformations, is the family of B o x - C o x t r a n s f o r m a t i o n s , which depend on
the parameter λ and are defined as follows:

log(yt ) if λ = 0;
wt = {
(ytλ − 1)/λ otherwise.

The logarithm in a Box-Cox transformation is always a natural logarithm (i.e., to


base e). So if λ = 0, natural logarithms are used, but if λ ≠ 0, a power
transformation is used, followed by some simple scaling.

If λ= 1, then wt = yt − 1, so the transformed data is shifted downwards but


there is no change in the shape of the time series. But for all other values of λ,
the time series will change shape.

Use the slider below to see the effect of varying λ to transform Australian
quarterly gas production:

5 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

Australian Quarterly Gas Production


Transformation parameter: λ
-1 1 2

-1 -0.7 -0.4 -0.1 0.2 0.5 0.8 1.1 1.4 1.7 2

A good value of λ is one which makes the size of the seasonal variation about the
same across the whole series, as that makes the forecasting model simpler. In
this case, λ = 0.10 works quite well, although any value of λ between 0 and 0.2
would give similar results. If any values of the series are negative then a Box-Cox
transformation is not possible.

The  guerrero  feature (Guerrero, 1993) can be used to choose a value of lambda
for you. In this case it chooses λ = 0.12.

6 de 7 06/06/20 21:46
3.1 Transformations and adjustments | Forecasting: Principles and ... https://otexts.com/fpp3/transformations.html

lambda <- aus_production %>%


features(Gas, features = guerrero) %>%

pull(lambda_guerrero)
aus_production %>% autoplot(box_cox(Gas, lambda))

B i b l i o g ra p h y

Guerrero, V. M. (1993). Time-series analysis supported by power


transformations. Journal of Forecasting, 37–48.

7 de 7 06/06/20 21:46

You might also like