The gafa_stock time series represents historical stock prices from 2014-2018 for Google, Amazon, Facebook and Apple. All prices are in $USD.
The PBS time series represents monthly Medicare Australia prescription data. It comprises data for total number of scripts and the cost of the scripts in $AUD.
The vic_elec time series represents half-hourly electricity demand for Victoria, Australia. It comprises data for the total electricity demand in MW, the temperature in Melbourne and an indicator denoting if that day was a public holiday.
The pelt time series represents Hudson Bay Company trading records for the number Snowshoe Hare and Canadian Lynx furs traded from 1845 to 1935. This data contains trade records for all areas of the company.
## <interval[1]>
## [1] !
## [1] FALSE
## <interval[1]>
## [1] 1M
## [1] TRUE
## [1] 12
## <interval[1]>
## [1] 30m
## [1] TRUE
## [1] 48
## <interval[1]>
## [1] 1Y
## [1] TRUE
## [1] 1
The time interval for the gafa_stock time series is daily, but it is an irregular one, because the stock prices from a stock exchange are available for business days only i.e. not for weekends and public holidays.
The PBS time series is a monthly time series since it is the monthly Australian prescription data.
The vic_elec time series is of half-hourly intervals.
The pelt time series is an annual time series.
## # A tsibble: 1 x 3 [!]
## # Key: Symbol [1]
## Symbol Date Close
## <chr> <date> <dbl>
## 1 GOOG 2018-07-26 1268.
## # A tsibble: 1 x 3 [!]
## # Key: Symbol [1]
## Symbol Date Close
## <chr> <date> <dbl>
## 1 AAPL 2018-10-03 232.
## # A tsibble: 1 x 3 [!]
## # Key: Symbol [1]
## Symbol Date Close
## <chr> <date> <dbl>
## 1 FB 2018-07-25 218.
## # A tsibble: 1 x 3 [!]
## # Key: Symbol [1]
## Symbol Date Close
## <chr> <date> <dbl>
## 1 AMZN 2018-09-04 2040.
## # A tsibble: 4 x 8 [!]
## # Key: Symbol [4]
## # Groups: Symbol [4]
## Symbol Date Open High Low Close Adj_Close Volume
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AAPL 2018-10-03 230. 233. 230. 232. 230. 28654800
## 2 AMZN 2018-09-04 2026. 2050. 2013 2040. 2040. 5721100
## 3 FB 2018-07-25 216. 219. 214. 218. 218. 58954200
## 4 GOOG 2018-07-26 1251 1270. 1249. 1268. 1268. 2405600
## Quarter Sales AdBudget GDP
## 1 Mar 1981 1020.2 659.2 251.8
## 2 Jun 1981 889.2 589.0 290.9
## 3 Sep 1981 795.0 512.5 290.8
## 4 Dec 1981 1003.9 614.1 292.4
## 5 Mar 1982 1057.7 647.2 279.1
## 6 Jun 1982 944.4 602.0 254.0
Check what happens when you don’t include facet_grid()
When you don’t include the facet_grid() option, it draws the plot on a common scale (common y-axis). It is very likely that the GDP time-series is denominated in a different scale i.e. it should be an order to magnitude higher than the Sales of an individual company. Yet, when drawn on a common scale, it gives an incorrect picture - as if the GDP is lower than the sales and ad budget of the company.
Excluding facet_grade also makes it harder to see the patterns in the individual time-series.
## year state y
## 1 1997 Alabama 324158
## 2 1998 Alabama 329134
## 3 1999 Alabama 337270
## 4 2000 Alabama 353614
## 5 2001 Alabama 332693
## 6 2002 Alabama 379343
Check what this dataset contains.
## # A tibble: 6 x 5
## Quarter Region State Purpose Trips
## <chr> <chr> <chr> <chr> <dbl>
## 1 1998-01-01 Adelaide South Australia Business 135.
## 2 1998-04-01 Adelaide South Australia Business 110.
## 3 1998-07-01 Adelaide South Australia Business 166.
## 4 1998-10-01 Adelaide South Australia Business 127.
## 5 1999-01-01 Adelaide South Australia Business 137.
## 6 1999-04-01 Adelaide South Australia Business 200.
## [1] 24320 5
## # A tsibble: 6 x 5 [1Q]
## # Key: Region, State, Purpose [1]
## Quarter Region State Purpose Trips
## <qtr> <chr> <chr> <chr> <dbl>
## 1 1998 Q1 Adelaide South Australia Business 135.
## 2 1998 Q2 Adelaide South Australia Business 110.
## 3 1998 Q3 Adelaide South Australia Business 166.
## 4 1998 Q4 Adelaide South Australia Business 127.
## 5 1999 Q1 Adelaide South Australia Business 137.
## 6 1999 Q2 Adelaide South Australia Business 200.
## [1] "list"
## [[1]]
## Region
##
## [[2]]
## State
##
## [[3]]
## Purpose
## # A tsibble: 6 x 5 [1Q]
## # Key: Region, State, Purpose [1]
## Quarter Region State Purpose Trips
## <qtr> <chr> <chr> <chr> <dbl>
## 1 1998 Q1 Adelaide South Australia Business 135.
## 2 1998 Q2 Adelaide South Australia Business 110.
## 3 1998 Q3 Adelaide South Australia Business 166.
## 4 1998 Q4 Adelaide South Australia Business 127.
## 5 1999 Q1 Adelaide South Australia Business 137.
## 6 1999 Q2 Adelaide South Australia Business 200.
## # A tibble: 1 x 3
## Region Purpose MeanTrips
## <chr> <chr> <dbl>
## 1 Sydney Visiting 747.
We can see from the above that trips to sydney for general visitng has the maximum number of overnight trips on average.
## # A tsibble: 10 x 3 [1Q]
## # Key: State [1]
## State Quarter TotalTrips
## <chr> <qtr> <dbl>
## 1 ACT 1998 Q1 551.
## 2 ACT 1998 Q2 416.
## 3 ACT 1998 Q3 436.
## 4 ACT 1998 Q4 450.
## 5 ACT 1999 Q1 379.
## 6 ACT 1999 Q2 558.
## 7 ACT 1999 Q3 449.
## 8 ACT 1999 Q4 595.
## 9 ACT 2000 Q1 600.
## 10 ACT 2000 Q2 557.
## # A tsibble: 6 x 5 [1M]
## # Key: State, Industry [1]
## State Industry `Series ID` Month Turnover
## <chr> <chr> <chr> <mth> <dbl>
## 1 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 Apr 4.4
## 2 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 May 3.4
## 3 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 Jun 3.6
## 4 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 Jul 4
## 5 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 Aug 3.6
## 6 Australian Capital Territory Cafes, restaurants~ A3349849A 1982 Sep 4.2
help(aus_retail)
while the retail Turnover time-series shows an overall upward trend over the period shown, it seems to have undergone a significant increase in the slope of the trend post 1999 i.e. in the new century. There is a dip in the 2010-2013 period probably as a result of the impact of recession in the US and other parts of the world.
The seasonal plot above shows a sharp increase in the holiday months leading into Christmas and the new year, as would be expected from a retail business.
The sub-series plot that breaks out the data by month shows a similar increase in the retail turnover value as we travserse the decades from the 1990s to the 2010s, with a decline in the few years post 2010 co-inciding with the recession. The plot for December shows elevated values compared to other months, and the annual average for December (blue horizontal line) is higher than the corresponding averages of previous months, as can be expected.
The ACF plot for lags upto month 26, shows a spike in autocorrelation for lags 1, 12, 24 months, which indicates seasonality. Even while this is happening, there is an overall decreasing trend in autcorrelation, which indicates an upward trend in the underlying time series.