Selecting Stocks and Creating Hierarchical Time Series
Overview of Data
## Plot variable not specified, automatically selected `.vars = Value`

Aggregate Time Series for Plotting
## # A tsibble: 540 x 4 [1M]
## # Key: Stock, Sector [9]
## Date Stock Sector Value
## <mth> <chr*> <chr*> <dbl>
## 1 2018 Jan <aggregated> <aggregated> 151.
## 2 2018 Feb <aggregated> <aggregated> 152.
## 3 2018 Mar <aggregated> <aggregated> 148.
## 4 2018 Apr <aggregated> <aggregated> 153.
## 5 2018 May <aggregated> <aggregated> 157.
## 6 2018 Jun <aggregated> <aggregated> 159.
## 7 2018 Jul <aggregated> <aggregated> 167.
## 8 2018 Aug <aggregated> <aggregated> 184.
## 9 2018 Sep <aggregated> <aggregated> 189.
## 10 2018 Oct <aggregated> <aggregated> 186.
## # ℹ 530 more rows

Bottom Up Forecast

Middle Out Forecast

Top Down Forecast

Minimum Trace Reconciliation

## # A tibble: 10 × 10
## Stock .model sigma2 log_lik AIC AICc BIC MSE AMSE MAE
## <chr*> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AAPL ets 0.00842 -182. 375. 376. 384. 57.9 122. 0.0729
## 2 AAPL bu 0.00842 -182. 375. 376. 384. 57.9 122. 0.0729
## 3 CSCO ets 10.5 -148. 303. 303. 308. 10.0 16.9 2.49
## 4 CSCO bu 10.5 -148. 303. 303. 308. 10.0 16.9 2.49
## 5 MRK ets 0.00352 -156. 318. 319. 324. 14.9 20.9 0.0461
## 6 MRK bu 0.00352 -156. 318. 319. 324. 14.9 20.9 0.0461
## 7 PFE ets 0.00592 -136. 278. 278. 283. 6.73 12.1 0.0565
## 8 PFE bu 0.00592 -136. 278. 278. 283. 6.73 12.1 0.0565
## 9 <aggregated> ets 0.00285 -142. 294. 296. 304. 9.44 17.1 0.0419
## 10 <aggregated> bu 0.00285 -142. 294. 296. 304. 9.44 17.1 0.0419
## # A tibble: 14 × 11
## Sector Stock .model sigma2 log_lik AIC AICc BIC MSE AMSE
## <chr*> <chr*> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Healthcare MRK ets2 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 2 Healthcare MRK md 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 3 Healthcare PFE ets2 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 4 Healthcare PFE md 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 5 Healthcare <aggregate… ets2 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 6 Healthcare <aggregate… md 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 7 Tech AAPL ets2 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 8 Tech AAPL md 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 9 Tech CSCO ets2 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 10 Tech CSCO md 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 11 Tech <aggregate… ets2 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 12 Tech <aggregate… md 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 13 <aggregated> <aggregate… ets2 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## 14 <aggregated> <aggregate… md 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## # ℹ 1 more variable: MAE <dbl>
## # A tibble: 14 × 11
## Sector Stock .model sigma2 log_lik AIC AICc BIC MSE AMSE
## <chr*> <chr*> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Healthcare MRK ets3 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 2 Healthcare MRK td 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 3 Healthcare PFE ets3 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 4 Healthcare PFE td 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 5 Healthcare <aggregate… ets3 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 6 Healthcare <aggregate… td 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 7 Tech AAPL ets3 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 8 Tech AAPL td 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 9 Tech CSCO ets3 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 10 Tech CSCO td 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 11 Tech <aggregate… ets3 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 12 Tech <aggregate… td 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 13 <aggregated> <aggregate… ets3 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## 14 <aggregated> <aggregate… td 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## # ℹ 1 more variable: MAE <dbl>
## # A tibble: 14 × 11
## Sector Stock .model sigma2 log_lik AIC AICc BIC MSE AMSE
## <chr*> <chr*> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Healthcare MRK ets5 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 2 Healthcare MRK mint 3.52e-3 -156. 318. 319. 324. 14.9 20.9
## 3 Healthcare PFE ets5 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 4 Healthcare PFE mint 5.92e-3 -136. 278. 278. 283. 6.73 12.1
## 5 Healthcare <aggregate… ets5 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 6 Healthcare <aggregate… mint 2.74e-3 -137. 279. 280. 285. 6.34 10.6
## 7 Tech AAPL ets5 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 8 Tech AAPL mint 8.42e-3 -182. 375. 376. 384. 57.9 122.
## 9 Tech CSCO ets5 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 10 Tech CSCO mint 1.05e+1 -148. 303. 303. 308. 10.0 16.9
## 11 Tech <aggregate… ets5 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 12 Tech <aggregate… mint 5.31e-3 -161. 332. 333. 341. 20.7 40.0
## 13 <aggregated> <aggregate… ets5 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## 14 <aggregated> <aggregate… mint 2.85e-3 -142. 294. 296. 304. 9.44 17.1
## # ℹ 1 more variable: MAE <dbl>