CommencerCommencer gratuitement

Box-Cox transformations for time series

Here, you will use a Box-Cox transformation to stabilize the variance of the pre-loaded a10 series, which contains monthly anti-diabetic drug sales in Australia from 1991-2008.

In this exercise, you will need to experiment to see the effect of the lambda (\(\lambda\)) argument on the transformation. Notice that small changes in \(\lambda\) make little difference to the resulting series. You want to find a value of \(\lambda\) that makes the seasonal fluctuations of roughly the same size across the series.

Recall from the video that the recommended range for lambda values is \(-1 ≤ \lambda ≤ 1\).

Cet exercice fait partie du cours

Forecasting in R

Afficher le cours

Instructions

  • Plot the a10 series and observe the increasing variance as the level of the series increases.
  • Try transforming the series using BoxCox() in the format of the sample code. Experiment with four values of lambda: 0.0, 0.1, 0.2, and 0.3. Can you determine which lambda value approximately stabilizes the variance?
  • Now compare your chosen value of lambda with the one returned by BoxCox.lambda().

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Plot the series
___

# Try four values of lambda in Box-Cox transformations
a10 %>% BoxCox(lambda = ___) %>% autoplot()
___
___
___

# Compare with BoxCox.lambda()
___
Modifier et exécuter le code