I came across a mention of Shumway and Stuffer when I realized that the sigma
calculated was a complete BS. One of the URLs showed a ton of issues relating to the sigma levels.

So, I downloaded this book, went to Bandra, took a print out of the book. All in the hope that my understanding of time series will be enhanced. With that hope , I begin the first chapter of the book, titled Characteristics of TimeSeries..

> setwd("C:/Cauldron/Books/Programming/R/BookCodes/Robert_Shumway_Stuffer/data")

Two ways of analyzing this data . One from timeseries regression based approach, the second one from a frequency domain approach. Time domain and Frequency domain are not completely different or water tight compartments.

There are tons of examples given to depict time series nature of data in different domains - Daily returns data - Earnings Growth of a firm - Speech Signals - Medical field - Arithmetic random walk and Geometric random walk - cumsum and cumprod - AR process - MA process - Weather data

> library(ggplot2)
> vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y)


Simulate MA

> y1 <- rnorm(550)
> y2 <- filter(y1, sides = 2, rep(1, 20)/20)
> z <- data.frame(y = y1, x = 1:550, y2 = y2)
> pushViewport(viewport(layout = grid.layout(1, 2)))
> p <- ggplot(data = z, aes(x = x, y = y1))
> q <- p + geom_line()
> print(q, vp = vplayout(1, 1))
> q <- p + geom_line(aes(y = y2))
> print(q, vp = vplayout(1, 2))

C1-003.jpg



Simulate AR

> y1 <- rnorm(100)
> y2 <- filter(y1, filter = c(1, -0.5), method = "recursive")
> z <- data.frame(y = y1, x = 1:100, y2 = y2)
> pushViewport(viewport(layout = grid.layout(1, 2)))
> p <- ggplot(data = z, aes(x = x, y = y1))
> q <- p + geom_line()
> print(q, vp = vplayout(1, 1))
> q <- p + geom_line(aes(y = y2))
> print(q, vp = vplayout(1, 2))

C1-004.jpg

> arima.sim(n = 20, list(ar = c(0.8, -0.6), ma = c(-0.5, 0.4)))
Time Series:
Start = 1
End = 20
Frequency = 1
 [1]  0.36299430  2.48203219  0.66601525  1.63701490  0.81494396  1.32189139
 [7]  1.10870474 -1.60212049 -0.64365437 -0.07740522  0.29983645 -1.86174225
[13] -0.19927502 -1.87775479 -1.02314834 -1.66475712 -1.04886145 -1.48675137
[19] -2.54916468 -3.19001442

C1-005.jpg

Autocovariance function , Autocorrelation function are the basic tools. One can define auto covariance function for - a univariate series, - a stationary series, - between two series

One can define auto correlation function for - a univariate series, - a stationary series, - between two series

The fact that most of the functions are depending on the lag and not on specific time points.

A mention of confidence intervals 1/ sqrt(n) is mentioned..

Basically a very simple and straightforward intro to ts.