Spring 2016 Statistics 153 (Time Series) : Lecture Twenty One
Aditya Guntuboyina
07 April 2016
1
DFT Recap
The DFT of x0 , . . . , xn1 is given by bj , j = 0, 1, . . . , n 1, where
bj =
n1
X
2ijt
xt exp
n
t=0
for j = 0, . . . , n 1.
(1)
P
xt . Also for 1
#R code for second lecture on 21 January, 2016
setwd("/Users/aditya/Dropbox/Berkeley Teaching/153 Spring 2016 Time Series")
#Are the following white noise?
samp.dat = arima.sim(n = 200, list(ar = 0.7), sd = 1)
plot(samp.dat, type = "l")
s1 = arima.sim(n
#There is an option to get the pacf in the R function ARMAacf.
#ACF of AR(1)
L = 15
corrs = ARMAacf(ar = c(0.7), lag.max = L)
plot(x = 0:L, y = corrs, type = "h", xlab = "Lag k", ylab = "Autocorrelation")
abline(h = 0)
par.corrs = ARMAacf(ar = c(0.7), lag
Spring 2016 Statistics 153 (Time Series) : Lecture Fourteen
Aditya Guntuboyina
03 March 2016
1
ARMA models with nonzero mean
cfw_Xt is said to be ARMA(p, q) with mean if cfw_Xt is ARMA(p, q) i.e., if
(Xt ) 1 (Xt1 ) p (Xtp ) = Zt + 1 Zt1 + + q Ztq .
2
F
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Six
Aditya Guntuboyina
26 April 2016
1
Nonparametric Estimation of the Spectral Density
Let cfw_Xt be a stationary process with
density that is given by
f( ) =
1
X
P1
h= 1

X (h)e
X (h)
2i h
h=
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Two
Aditya Guntuboyina
12 April 2016
1
DFT Recap
Given data x0 , . . . , xn
1,
their DFT is given by bj , j = 0, 1, . . . , n 1, where
n
X1
2ijt
bj =
xt exp
for j = 0, . . . , n 1.
n
t=0
P
Two imme
#Sample Autocorrelations of data from an MA(1) process:
L = 20
th = .8
n = 200
dt = arima.sim(n = 200, list(ma = th)
plot(1:n, dt, type = "o", xlab = "Time", ylab = "Time Series", main = "MA(1)")
#acf at lag one is given by
rho1 = th/(1+th^2)
acf(dt, plo
Spring 2016 Statistics 153 (Time Series) : Lecture Nineteen
Aditya Guntuboyina
31 March 2016
1
AIC
AIC stands for Akaikes Information Criterion. It is a model selection criterion that recommends choosing
a model for which:
AIC = 2 log(maximum likelihood)
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Seven
Aditya Guntuboyina
28 April 2016
1
Modifying the Periodogram for good estimates of the spectral
density
We have seen in the last class that when n is large, the random variables:
2I(j/n)
,
f
Spring 2016 Statistics 153 (Time Series) : Lecture Sixteen
Aditya Guntuboyina
15 March 2016
1
Asymptotic Distribution of the Estimates for AR parameters
The following holds for each of the YuleWalker, Conditional Least Squares and ML estimates:
For n l
Spring 2016 Statistics 153 (Time Series) : Lecture Twelve
Aditya Guntuboyina
25 February 2016
1
Data Analysis via ARMA Models
The ARMA models provide a reasonably versatile collection for modelling stationary time series data.
We shall now study how to ch
Spring 2016 Statistics 153 (Time Series) : Lecture Fifteen
Aditya Guntuboyina
10 March 2016
1
Recap: Fitting AR models to data
Assuming that the order p is known. Carried out by invoking the function ar () in R.
1. Yule Walker or Method of Moments: Finds
title: "lecture 13"
author: "Yihan Li"
date: "March 7, 2016"
output: pdf_document
`cfw_r
#There is an option to get the pacf in the R function ARMAacf.
#ACF of AR(1)
L = 15
corrs = ARMAacf(ar = c(0.7), lag.max = L)
plot(x = 0:L, y = corrs, type = "h", x
Spring 2016 Statistics 153 (Time Series) : Lecture Seventeen
Aditya Guntuboyina
17 March 2016
1
ARIMA Models
ARIMA is essentially differencing plus ARMA. We have seen previously that differencing is commonly
used on time series data to remove trends and s
ds = arima.sim(n = 100, list(ar = 0.7)
plot(ds, type = "o", main = "Simulated data set from an AR model", ylab =
"Data")
acf(ds, lag.max = 20, type = "correlation", plot = T, main = "Sample
Autocorrelation")
pacf(ds, lag.max = 20, plot = T, main = "Sample
Spring 2016 Statistics 153 (Time Series) : Lecture Two
Aditya Guntuboyina
21 January 2016
In the last class, we looked at some collection of real time series data sets. We also started our
discussion of time series models. The simplest time series models
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Three
Aditya Guntuboyina
14 April 2016
We started discussing process representation in the last class. We considered simple stationary models
of the form A cos(2 t) + B sin(2 t) and formed linear c
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty
Aditya Guntuboyina
05 April 2016
1
Frequency Domain Analysis of Time Series
1.1
The Sinusoid
The sinusoid can be represented in the following three equivalent ways:
1. R cos (2f t + ). The followin
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Five
Aditya Guntuboyina
21 April 2016
1
Spectral Density
Given a stationary process cfw_Xt with autocovariance function
f ( ) :=
1
X
X (h) exp (
2i h)
X (h),
for
h= 1
The spectral density is symme
Spring 2016 Statistics 153 (Time Series) : Lecture Eighteen
Aditya Guntuboyina
29 March 2016
1
Seasonal ARMA Models
The doubly infinite sequence cfw_Xt is said to be a seasonal ARMA(P , Q) process with period s if it is
stationary and if it satisfies the
#The Spectral Density of an MA(1) process:
var = 4 #This is the white noise variance
th = 0.8
fMA = function(lam)
cfw_
var*(1 + th^2 + 2*th*cos(2*pi*lam)
sig = sqrt(var)
lam = seq(0, 0.5, 0.01)
plot(lam, fMA(lam), type = "l")
#Approximating an MA(1) pro
Spring 2016 Statistics 153 (Time Series) : Lecture Thirteen
Aditya Guntuboyina
01 March 2016
1
Last Class: Best Linear Prediction
Let Y and W1 , . . . , Wm represent mean zero random variables which have finite variances. Let cov(Y, Wi ) =
i for i = 1, .
Spring 2016 Statistics 153 (Time Series) : Lecture Twenty Four
Aditya Guntuboyina
16 April 2016
1
Spectral Density (Recap)
For a stationary process cfw_Xt with autocovariance function X (h), its spectral density is defined as
f () :=
X
X (h) exp (2ih)
fo
library(TSA)
#Simulated AR(1) dataset:
sig = 1
ph = 0.8
n = 300
dt = arima.sim(list(ar = ph),n, sd = sig)
#True spectral density can be calculated using the function ARMAspec from the
package "TSA"
#This function is the analogue of the ARMAacf function fo
#Process Representation recap from last class.
#Approximating an MA(1) process by sines and cosines
#The Spectral Density of an MA(1) process:
var = 4 #This is the white noise variance
th = 0.8
fMA = function(lam)
cfw_
var*(1 + th^2 + 2*th*cos(2*pi*lam)
Chapter 3.1 Trends
A financial example
Correlation 0 does not imply independence
dashed lines at 2/n
Trends Text seems to say any deterministic (definition) function t
e.g. polynomial, trigonometric, categorical
useful for forecasting, testing H0: no tren
Monthly price of oil  Jan 86 to Jan 2006
Fit arima
Check via acf and spec of residuals
library(TSA)
data(oil.price)
par(mfrow=c(2,1)
plot(log(oil.price),main="log(monthly oil.prices)",type="l")
m1.oil<arima(log(oil.price),order=c(0,1,1)
plot(residuals(m
Chapter 12. Time Series Models of Heteroscedasticity.
[ The R package named tseries
is reqired for this chapter. We assume that the reader has downloaded and installed it.]
The models discussed so far concern the conditional mean structure of
time series