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
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 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
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 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
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, 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 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, 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, 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
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 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 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
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: Homework 6
Due in class 6 March
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.
Always provide 1-2 sent
STAT 463: Homework 5
Due in class 26 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.
Always provide 1-2
1st Homework
2 The dataset was download as a csv and then loaded on R. The plot was
generated using ggplot2.
data<-read.table("data.csv",sep = "\t",header = T)
time<-as.POSIXct(data$Time,
format="%Y-%m-0 %H:%M")
traffic<-ts(data$Traffic)
plot(time,traffic
STAT 463: Homework 8
Due in class 25 March
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.
Always provide 1-2 sen
STAT463 Homework #11
1. The datasets gas82.dat and oil82.dat give gas price and oil price indices in the United
States for 82 consecutive months. Well treat gas as the explanatory variable xt and oil as
the response variable yt .
(a) Fit the simple linear
STAT 463: Homework 2 Solutions
Questions:
1. Let cfw_et be a zero mean white noise process. Suppose that the observed process is Yt = et + et1 .
(a) Find the autocorrelation function for cfw_Yt when = 4 and when = 1/4. Is cfw_Yt stationary?
Solution:
F
STAT 463: Homework 12 (The Last One)
Due in class 30 April
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.
Always
STAT 463: Homework 9
Due in class 8 April
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.
Always provide 1-2 sent
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
STAT 463: Homework 7
Due in class 18 March
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.
Always provide 1-2 sen
STAT 463: Homework 10
Due in class 15 April
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.
Always provide 1-2 se
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