STAT 463: Homework 3
Due in class on Thursday 5 February
Notes:
Show your work to the extent possible, and label the answers to all questions. If plots and
computer code are included in your document without clear labeling, you will lose points.
A rando
HW 1 Solutions
1
Data analysis problems
1. Read sections 1, 2, 3, 6, 7, and 8 of An Introduction of R (do this in
front of your computer), and answer the following questions.
(a) Whats the dierence in output between the commands 2*1:5
and (2*1):5? Why is
Midterm Exam 1: STAT 463, Fall 2015
Penn State
NAME
Instructions:
1. This is a closed book exam. You are only allowed one 8.5 inch11 inch sheet of notes
and a calculator.
2. Box your final answer to each question (draw a box around it).
3. Turn off all el
STAT 463 HW3
1.
(a) Plot Berkeley vs time, stbarb vs time, and Berkeley vs stbarb
plot.ts(berkeley)
plot (stbarb, berkeley)
plot.ts(stbarb)
(b) Perform a regression of Berkeley on time
> timefit=lm(berkeley~time)
> abline(lm(berkeley~time)
> timeres=resid
2. Load the monthly temperature data for England
(a) Plot the data and create an ACF
> engtemp=scan("tpmon.dat", skip=1)
> engtemp2=engtemp[1:300]
> plot.ts(engtemp2)
> acf(engtemp2)
(b) Fit the following model using lm()
> time=1:300
> u=cos(2*pi/12*time
STAT 463 HW8
1. MA(2) model
(a) the autocovariance function
(b) Compute the spectral density
(c) Plot the spectral density
1) theta1, theta2 >0
3) theta1 >0, theta2 <0
(d) on the peaks of the plots
2) theta1 < 0, theta2 >0
4) theta 1 < 0, theta 2 < 0
2. A
Time Series, Lecture 6
Exploratory Data Analysis II
Were going to continue to introduce exploratory data tools. Weve already seen how we can use differencing and certain types of detrending (Well
come back to some more a little later.) to obtain stationar
Time Series, Lecture 7, Smoothing
The basis for the set of techniques known as smoothing is that they
attempt to fit models of the form
xt = ft + yt
where ft is a smooth function and yt is stationary. Weve already discussed
when ft is of the form
0 + 1 t
Time Series, Lecture 13, ARMA Estimation.
This corresponds roughly to section 3.6 in SS.
Lets talk about parameter estimation for ARMA. Lets assume that
weve started with the ARMA model (which is of course causal and invertible)
(B)Xt = (B)wt ,
2,
where t
Time Series, Lecture 11, ARMA Autocorrelation
and Partial Autocorrelation Functions.
This corresponds roughly to 3.4 in SS. In this lecture we will study
autocorrelation and partial autocorrelation function for ARMA models.
Lets start from MA(q) model
q
X
Time Series, Lecture 8, ARMAAR(1)
This corresponds roughly to 3.1 and 3.2 in SS. In this chapter we will
discuss classical time series models; namely ARMA models which is a time
series where the current observation depends on a linear combination of
past
Time Series, Lecture 12, ARMA Forecasting and
Diagnostics.
Lets talk about forecasting an ARMA. We need this to talk about the
standardized residuals. Lets assume that weve started with the ARMA
model (which is of course causal and invertible)
(B)Xt = (B)
Time Series, Lab 5
1
In Class
1. Load the mortality data (cmort.txt). Recall that this data is not
stationary. We may remove the trend using smoothing. Then, we
should have a stationary time series. Now, generate the ACF and
PACF plots. This can be done u
Time Series, Lab 4
1
In Class
In this lab, we will learn how to use several R commands to smooth a time
series and remove trends.
1. Start by creating a new folder lab4 and download the le gas.dat.
This data le contains monthly heating oil prices from Jul
Time Series, Lab 3
In this section, we will go over how to use R to produce the output
and graphs for the Yule data set. First, download the files yule1.dat and
yule2.dat from canvas.
1. We need to read the data into R.
mortality=scan("yule1.dat", skip=12
Time Series, Lab 5
1
In Class
1. Load the mortality data (cmort.txt). Recall that this data is not
stationary. We may remove the trend using smoothing. Then, we
should have a stationary time series. Now, generate the ACF and
PACF plots. This can be done u
Lab 1
1
In Class
In this tutorial, we will learn some of the basics of the statistical software R.
We will learn how to read data in from a text file, how to handle variables,
how to plot data, and how to save these plots.
1. Directories. Create a directo
Time Series, Lab 4
1
Smoothing
In this lab, we will learn how to use several R commands to smooth a time
series and remove trends.
1. Download the file gas.dat. This data file contains monthly heating
oil prices from July 1973 to December 1987. Load the d
Time Series, Lab 2
1
Using Scripts.
In this tutorial, we are going to learn to use scripts and to write functions
in R.
1. Make a new folder called lab2 and save the file globtemp.dat from
canvas. Go to the file menu and select New script. We are going to
Time Series, Lecture 1, Introduction
Time SeriesWhat are we studying?
Time Series are data collected in a sequence. They are usually evenly
spaced and because of the sequential nature are statistically dependent observations.
How does this differ from oth
Time Series, Lecture 3, Stationarity
This corresponds roughly to 1.5 and 1.6 in SS. In time series analysis, we
frequently would prefer to analyze a stationary sequence. This allows us to
better estimate autocorrelation and other quantities of interest. O
Time Series, Lecture 2, Basic Time Series Models
This roughly covers 1.3 and 1.4 of Shumway and Stoffer. Some of these
things may seem a little removed from the data, but we need to be clear
about the models we are fitting and the quantities that we are e
Time Series, Lab 8
1
In Class
In Lecture 18, we have calculated the spectral density for following models:
MA(1): xt = wt + 1 wt1 . Spectral density is given by
2
f () = 2 2 1 cos(2) + 2 (1 + 1 ),
where 2 is the variance of wt . Assume that 2 = 1. Then f
Stat 463, Lab 9
1
In Class
Lets look at the Australian labour data which was seen in previous labs.
We would like to estimate the spectral density of the data. We may generate
the raw periodogram using the following code:
labour<-scan("labour.dat")
labour
Time Series, Lab 6
1
In Class
1. In this lab, we will learn how to do maximum likelihood estimation
for time series using R. We will start with a data set that we have
used frequently, the Berkeley average yearly temperature data set.
Download and input t
Lecture 10, ARMAFull
Now, we are ready to talk about the full ARMA model.
ARMA A time series cfw_xt : t = ., 2, 1, 0, 1, 2, . is ARMA(p,q) if it is
stationary and
xt = 1 xt1 + . + p xtp + wt + 1 wt1 + . + q wtq
If xt has a nonzero mean , then
xt = + 1 xt1