library(fpp3)
<- readRDS(url("https://bit.ly/aud_xr")) aud_xr
Activities: Week 8
AUD exchange rates
The data set contains Australian dollar exchange rates from the start of 2023 to 22 April 2025.
How has the tsibble been indexed? Why wouldn’t
Date
be used for the index?See what currencies are included:
|> aud_xr distinct(Currency, Description)
Choose a currency and plot its exchange rate using
gg_tsdisplay
like this. Does it look stationary?|> aud_xr filter(Currency == ???) |> autoplot(Rate)
Now plot the first difference of the exchange rate. Does it look stationary?
|> aud_xr filter(Currency == ???) |> autoplot(difference(Rate))
Repeat for another couple of exchange rates. Does differencing always result in a stationary series? Why?
If we used the
unitroot_ndiffs()
function, would it give the same answer?|> aud_xr features(Rate, unitroot_ndiffs)
Tasmanian accommodation takings
Let’s extract the Tasmanian data from aus_accommodation
. Check the help to see what this data set contains.
<- aus_accommodation |>
tas_takings filter(State == "Tasmania") |>
select(Takings)
We will try to find transformations that make this series stationary.
First, try to stabilise the variance using a Box-Cox transformation.
|> tas_takings autoplot( box_cox(Takings, lambda = ???) )
Then, try to stabilise the mean using seasonal differencing.
|> tas_takings autoplot( box_cox(Takings, lambda = ???) |> difference(lag = ???) )
If that doesn’t work, try a first difference as well.
|> tas_takings autoplot( box_cox(Takings, lambda = ???) |> difference(lag = ???) |> difference(lag = ???) )
The final transformed series should appear stationary.
Check its ACF.
|> tas_takings ACF( box_cox(Takings, lambda = ???) |> difference(lag = ???) |> difference(lag = ???) |> ) autoplot()
What do you conclude?
Now use the
unitroot_ndiffs
andunitroot_nsdiffs
functions to check what differences they would suggest:|> tas_takings features( box_cox(Takings, lambda = ???), unitroot_nsdiffs )
|> tas_takings features( box_cox(Takings, lambda = ???) |> difference(lag = ???), unitroot_nsdiffs )
Does it suggest the same number of differencing as you did? Why/why not?