library(fpp2)
## Loading required package: ggplot2
## Loading required package: forecast
## Loading required package: fma
## Loading required package: expsmooth
help(gold)
help(woolyrnq)
help(gas)
Gold - Daily morning gold prices in US dollars for the period from 1 January 1985 to 31 March 1989.
Woolyrnq - Quarterly production of woollen yarn in Australia (tonnes) for the period from Mar 1965 to Sep 1994.
Gas - Australian monthly gas production for the period from 1956 to 1995.
autoplot(gold) + ggtitle("Daily Morning Gold Prices In US Dollars (1 January 1985 – 31 March 1989)")
autoplot(woolyrnq) + ggtitle("Quarterly Production Of Woolen Yarn In Australia")
autoplot(gas) + ggtitle("Australian Monthly Gas Production: 1956 - 1995")
frequency(gold)
## [1] 1
frequency(woolyrnq)
## [1] 4
frequency(gas)
## [1] 12
The “frequency” is the number of observations before the seasonal pattern repeats.
The frequency of gold series is 1 (annual)
The frequency of woolyrnq is 4 (quaterly)
The frequency of gas is 12 (monthly)
which.max(gold)
## [1] 770
Observation number 770 has an outlier in Gold series.
retaildata <- readxl::read_excel("retail.xlsx", skip=1)
The second argument (skip=1) is required because the Excel sheet has two header rows.
# Turnover ; New South Wales ; Supermarket and grocery stores
myts <- ts(retaildata[,"A3349335T"],
frequency=12, start=c(1982,4))
Turnover of supermarket and grocery stores in New South Wales (column “A3349335T”“) was selected for further analysis.
autoplot(), ggseasonplot(), ggsubseriesplot(), gglagplot(), ggAcf()
Can you spot any seasonality, cyclicity and trend? What do you learn about the series?
autoplot(myts) + ggtitle("Turnover Of Supermarket And Grocery Stores In New South Wales")
ggseasonplot(myts) + ggtitle("Turnover Of Supermarket And Grocery Stores In New South Wales")
ggsubseriesplot(myts) + ggtitle("Turnover Of Supermarket And Grocery Stores In New South Wales")
gglagplot(myts) + ggtitle("Turnover Of Supermarket And Grocery Stores In New South Wales")
ggAcf(myts, lag = 48) + ggtitle("Turnover Of Supermarket And Grocery Stores In New South Wales")
Turnover of supermarket and grocery stores shows a strong increasing trend. There is no evidence of any cyclic behaviour here, though perhaps the data only demonstrates a portion of the cycling.
It is clear that there is a large jump in sales in December each year which is possibly due to Christmas and New Year holidays. February and June shows the lowest turnover during the year.
The data have a trend, so the autocorrelations for small lags tend to be large and positive because observations nearby in time are also nearby in size. So the ACF of trended time series has positive values that slowly decrease as the lags increase. There is no seasonality in the data.
Overall turnover increasing over the years.