1. 2.1. Use the help function to explore what the series gold, woolyrnq and gas represent.

Gold help function output:

R: Daily morning gold prices
goldR Documentation

Daily morning gold prices

Description

Daily morning gold prices in US dollars. 1 January 1985 – 31 March 1989.

Usage

gold

Format

Time series data

Examples

tsdisplay(gold)

Woolyrng help function output:

R: Quarterly production of woollen yarn in Australia
woolyrnqR Documentation

Quarterly production of woollen yarn in Australia

Description

Quarterly production of woollen yarn in Australia: tonnes. Mar 1965 – Sep 1994.

Usage

woolyrnq

Format

Time series data

Source

Time Series Data Library. https://pkg.yangzhuoranyang.com/tsdl/

Examples

tsdisplay(woolyrnq)

Gas help function output:

R: Australian monthly gas production
gasR Documentation

Australian monthly gas production

Description

Australian monthly gas production: 1956–1995.

Usage

gas

Format

Time series data

Source

Australian Bureau of Statistics.

Examples

plot(gas)
seasonplot(gas)
tsdisplay(gas)


a. Use autoplot() to plot each of these in separate plots.



b. What is the frequency of each series? Hint: apply the frequency() function.


The frequency of the gold series is 1, or annual.

The frequency of the wool series is 4, or quarterly.

The frequency of the gas series is 12, or monthly.


c. Use which.max() to spot the outlier in the gold series. Which observation was it?


Gold’s maximum value was 593.7 and this value occurred on data point 770 in the gold series.


  1. 2.2. Download the file tute1.csv from the book website, open it in Excel (or some other spreadsheet application), and review its contents. You should find four columns of information. Columns B through D each contain a quarterly series, labelled Sales, Ad Budget and GDP. Sales contains the quarterly sales for a small company over the period 1981-2005. AdBudget is the advertising budget and GDP is the gross domestic product. All series have been adjusted for inflation.


a. You can read the data into R with the following script:


b. Convert the data to time series


c. Construct time series plots of each of the three series. Check what happens when you don’t include facets=TRUE



Without Facets=TRUE

When facets is set to FALSE there is one plot with three series as compared to one plot with three different facets which I believe is similar to three individual plots stacked on one another.


  1. 2.3. Download some monthly Australian retail data from the book website. These represent retail sales in various categories for different Australian states, and are stored in a MS-Excel file.


a. You can read the data into R with the following script:


b. Select one of the time series as follows (but replace the column name with your own chosen column):


Can you spot any seasonality, cyclicity and trend? What do you learn about the series?


The Supermarket & Grocery store series show a strong positive trend.  There also appear to be a seasonal pattern that increases as the trend increases. The seasonal trend is is reflected by the repeating spikes in the data. The seasonal plot provide greater insight to the seasonality.  It appear sales increase (have high points) in March and December. This view is supported by the subseries plot. 

The lag chart indicates all the lags have a positive correlation, but the strongest correlation exists in lag 12 where months almost merge into one line. 

The Acf chart seems to support the strong trend (slowly moving downward), and  seasonality (with shallow scallops in the plot).


  1. 2.6. Use the following graphics functions: autoplot(), ggseasonplot(), ggsubseriesplot(), gglagplot(), ggAcf() and explore features from the following time series: hsales, usdeaths, bricksq, sunspotarea, gasoline.
    -Can you spot any seasonality, cyclicity and trend?
    -What do you learn about the series?

HSALES

R: Sales of one-family houses
hsalesR Documentation

Sales of one-family houses

Description

Monthly sales of new one-family houses sold in the USA since 1973.

Usage

hsales

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley & Sons: New York. Chapter 3.

References

US Census Bureau, Manufacturing and Construction Division

Examples

plot(hsales)
plot(stl(hsales,"periodic"),main="Sales of new one-family houses, USA")


Can We Spot any seasonality, cyclicity and trends. What do you learn about the series

The hsales sereis seems to demonstrate seasonality (Better house sales in the Spring) and cyclicity (several business cycles reflected in the serioes). Over the time period a clear trend is difficult to detect given the seasonality and cyclicity.

This series tells me that hsales is likely a good barometer of the overall economy and related business cycle and that sales are seasonal, with the spring being the best time for housing sales. December appears to be the worse time for housing sales.   The lag chart also showed farily strong positive correlation at lag-1, but the correlation decrease as the lag increased. 








USDEATHS


R: Accidental deaths in USA
usdeathsR Documentation

Accidental deaths in USA

Description

Monthly accidental deaths in USA.

Usage

usdeaths

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley & Sons: New York. Exercises 2.3 and 2.4.

Examples

plot(usdeaths)
seasonplot(usdeaths)
tsdisplay(usdeaths)


Can We Spot any seasonality, cyclicity and trends. What do you learn about the series

Accidental deaths are seasonal.  The tend to rise from Feb throught the spring and then peak in July, they then fall to approximately 8000 in September and spike a bit in October and then again in December.  This is fairly consistent.  The lag charts show the strong correlation at lag 12 which is consistent with the seasonality described above. 

Also, other than the early 70s, when accidental deaths seem to hit a high point, the number of accidental death seem fairly consistent (slight increase in late 70s).







BRICKSQ

R: Quarterly clay brick production
bricksqR Documentation

Quarterly clay brick production

Description

Australian quarterly clay brick production: 1956–1994.

Usage

bricksq

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley & Sons: New York. Chapter 1 and Exercise 2.3.

Examples

plot(bricksq)
seasonplot(bricksq)
tsdisplay(bricksq)


Can We Spot any seasonality, cyclicity and trends. What do you learn about the series

The quarerly brick series deconstrates seasonality, ccyclicty and trending.  From seasonal perspective the Q1 is the lowest quarter, q2 is higher than q1, q3 appears to be the peak quarter and the q4 falls to a level slightly below q2.  There's also evidence of cyclicity in the early to mid 60s, mid 70s, early 80s and early 90s.  The trend of the data is strongly positive from the 60s to the 80s, but then seems to plateau in the 80s and decline in the 90s.

The sharp downward spikes in series in the mid 70s and early to mid 80s are noteworthy.  These declines line up with declines in the Australian GDP in 1971 (-3.71%) and 1983 (-5.55%).  There was also a fairly large decline in GDP in 1991 of almost 4% that shows up in the data.







SUNSPOTAREA

R: Annual average sunspot area (1875-2015)
sunspotareaR Documentation

Annual average sunspot area (1875-2015)

Description

Annual averages of the daily sunspot areas (in units of millionths of a hemisphere) for the full sun. Sunspots are magnetic regions that appear as dark spots on the surface of the sun. The Royal Greenwich Observatory compiled daily sunspot observations from May 1874 to 1976. Later data are from the US Air Force and the US National Oceanic and Atmospheric Administration. The data have been calibrated to be consistent across the whole history of observations.

Format

Annual time series of class ts.

Source

NASA

Examples


autoplot(sunspotarea)


Can We Spot any seasonality, cyclicity and trends. What do you learn about the series

The sunspot series is a bit harder (for me) to interpret.  The ACF chart demonstrates what looks like seasonality on the order of 10 years. This is contradictory to the seasonal plot which were not able to produce plots and produced message that no seasonality existed. This may reflect the fact that the seasonal plots assume seasonality with in a year, but for sunspots the seasonality is within a decade. 

We also see peak sunspot activity in the mid 1950s after a slowing increasing trend up from the 1900s. Post the mid 1950s sunspot activity has trended back down to levels more consistent with the 1900s.





GASOLINE


R: US finished motor gasoline product supplied.
gasolineR Documentation

US finished motor gasoline product supplied.

Description

Weekly data beginning 2 February 1991, ending 20 January 2017. Units are "million barrels per day".

Format

Time series object of class ts.

Source

US Energy Information Administration.

Examples


autoplot(gasoline, xlab="Year")


Can We Spot any seasonality, cyclicity and trends. What do you learn about the series


The trend of gasoline was strongly positive from the 90s through 2005/2006. At that point is seem to start a short-lived downward trend through 2013 and then resumed an upward trend.  The downward trend and recovery appears to matchup with the Great Recession and subsequent recovery. 


The lag plots seem to show slightly positive trend in lags 1, 2, 3 and less so for 8 and 9.