+ All Categories
Home > Documents > Homework 5 - University of Massachusetts...

Homework 5 - University of Massachusetts...

Date post: 31-Aug-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
10
Homework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are going to build (mixed) SARIMA models using the steps outlined in class. Make sure to outline the steps used in analyzing the data. If there are two (or more) competing models, make sure you discuss each of these. Make a decision about which model you think is best and support this decision with plots and and other information. I suggest using the sarima() function and qqPlot() function to do these fits and do diagnostics. Here are short summaries about the data sets to analyze. 1. The first data set (ozone.dat) is the monthly ozone concentration in Los Angeles from January 1955 to December 1972. [Sol] This data should probably also have the log taken. An argument could be made for not taking the log, but it is probably best. At least seasonal differencing should be done, and possibly both regular and seasonal. 1
Transcript
Page 1: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

Homework 5

1 Data analysis problem-1

We will be analyzing two data sets. We are going to build (mixed) SARIMAmodels using the steps outlined in class. Make sure to outline the steps usedin analyzing the data. If there are two (or more) competing models, makesure you discuss each of these. Make a decision about which model you thinkis best and support this decision with plots and and other information. Isuggest using the sarima() function and qqPlot() function to do thesefits and do diagnostics. Here are short summaries about the data sets toanalyze.

1. The first data set (ozone.dat) is the monthly ozone concentration inLos Angeles from January 1955 to December 1972.

[Sol] This data should probably also have the log taken. Anargument could be made for not taking the log, but it isprobably best. At least seasonal differencing should be done,and possibly both regular and seasonal.

1

Page 2: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

0 10 20 30 40

-0.5

0.0

0.5

1.0

Series: diff(diff(lozone), 12)

LAG

ACF

0 10 20 30 40

-0.5

0.0

0.5

1.0

LAG

PACF

The patterns in ACF and PACF is quite clear. It seems to“Tails off” on both ACF and PACF for regular dependence,and “Cut off”” after the first seasonal lag” on ACF,“Tailsoff” on PACF for seasonal dependence. So the starting modelshould be ARIMA(1, 1, 1)× (0, 1, 1)12.

I found ARIMA(1, 1, 1) × (0, 1, 1)12 provides the best fit. Hereis the output:

Standardized Residuals

Time

0 50 100 150 200

-3-1

01

2

0 5 10 15 20

0.0

0.4

0.8

Lag

ACF

ACF of Residuals

0 5 10 15 20 25 30 35

0.0

0.4

0.8

p values for Ljung-Box statistic

lag

p va

lue

2

Page 3: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

-3 -2 -1 0 1 2 3

-0.6

-0.4

-0.2

0.0

0.2

0.4

0.6

norm quantiles

(fit1$fit)$resid

> sarima(log(ozone),1,1,1,0,1,1,12)

$fit

Call:

arima(x = data, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S))

Coefficients:

ar1 ma1 sma1

0.2569 -0.9302 -0.753

s.e. 0.0787 0.0361 0.058

sigma^2 estimated as 0.04508: log likelihood = 20.37, aic = -32.75

$AIC

[1] -2.071557

$AICc

[1] -2.06142

$BIC

[1] -3.024678

Based on the ACF and PACF plot. other reasonable modelsare ARIMA(0, 1, 2) × (0, 1, 1)12, ARIMA(3, 1, 0) × (1, 1, 1)12, thereare non-significant coefficients in these models, though. Givestudents full credit if they provide reasonable explanation.

3

Page 4: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

2. The second data set is airline.dat. This data consists of the monthlyinternational airline passenger traffic from 1949-1956. Do we have totake the log-transformation? Compare the two time series,diff(diff(airline),12) and diff(diff(log(airline)),12).

[Sol] When we draw the plot of airline against time. It seemsthat the log-transformation is needed but look at the follow-ing plot.

Time

diff(

diff(

air)

, 12)

0 20 40 60 80

-20

-10

010

2030

Time

diff(

diff(

log(

air)

), 12

)

0 20 40 60 80

-0.15

-0.10

-0.05

0.00

0.05

0.10

0.15

I think the left one(using original) seems to be more station-ary than the right one(using log data). So, I am going to usethe original data.

The data should be differenced both regularly and seasonally.

4

Page 5: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

0 10 20 30 40

-0.2

0.2

0.6

1.0

Series: diff(diff(airline), 12)

LAG

ACF

0 10 20 30 40

-0.2

0.2

0.6

1.0

LAG

PACF

We can see only few lags are significant and it is very hardto see any patterns. diff(diff(airline),12) can be a whitenoise. Anyway, we want to fit the data with SARIMA model.There are very few clues on ACF and PACF. Let try allpossible simple models like our example data“motel.dat” inTutorial 7.

ARIMA(1, 1, 0)× (1, 1, 0)12 to be the best fit.

Standardized Residuals

Time

0 20 40 60 80

-2-1

01

2

0 5 10 15

-0.2

0.2

0.6

1.0

Lag

ACF

ACF of Residuals

0 5 10 15 20 25 30 35

0.0

0.4

0.8

p values for Ljung-Box statistic

lag

p va

lue

5

Page 6: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

-2 -1 0 1 2

-10

010

20

norm quantiles

(fit1$fit)$resid

> sarima(air,1,1,0,1,1,0,12)

$fit

Call:

arima(x = data, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S))

Coefficients:

ar1 sar1

-0.2250 -0.2274

s.e. 0.1076 0.1081

sigma^2 estimated as 90.27: log likelihood = -304.98, aic = 615.97

$AIC

[1] 5.544472

$AICc

[1] 5.568022

$BIC

[1] 4.597896

If we use the log transformed data , try all possible simplemodels like our example data“motel.dat” in Tutorial 7. ThenI found the model ARIMA(0, 1, 1)× (0, 1, 1)12 provides the bestfit. Here is the output:

6

Page 7: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

> sarima(log(airline),0,1,1,0,1,1,12)

$fit

Call:

arima(x = data, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S))

Coefficients:

ma1 sma1

-0.3941 -0.6129

s.e. 0.1173 0.1076

sigma^2 estimated as 0.001515: log likelihood = 148.76, aic = -291.53

$AIC

[1] -5.45094

$AICc

[1] -5.42739

$BIC

[1] -6.397516

2 Data analysis problem-2

We will be analyzing two data sets for forecasting. We are going to build(mixed) SARIMA models using the sarima() function and do forecastingusing the sarima.for() function.

1. For the yearly data from bicoal.dat, the annual bituminous coalproduction in the US from 1920-1968, predict the 10 years followingthe data. Given that you only have 49 observations of the original data,what do you think about these forecasts and the confidence intervals?Do the confidence intervals capture all of the variability in the forecast?

[Sol] I use ARIMA(0,1,2) model to fit. There may be somevariability in the fit the student has chosen–that’s alright.Give them full credits if they report the results properlybased on different models. The plot is given below.

7

Page 8: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

Time

coal

0 10 20 30 40 50 60

300

400

500

600

700

800

●●●●●●●●●●

The forecast is fairly flat, and the confidence interval is in-creasing as is expected.

Ironically, it is hard to do long range forecasts with simplemodels such as pure AR, pure MA even ARMA model in timeseries analysis. These models are stationary and so the meanof stationary process is constant. In fact, there is nothingto forecast if there is no pattern (linear and periodic) in theseries and the AR effect and MA effect disappear very fast. Infact, the long range forecasts are useless with simple models.

However, the short term prediction interval is very impor-tant. Simply speaking, you just ignore the forecasted valueand imagine the value can be any where between the confi-dence band.

Here is one more thing worth to mention. The sample size isnot that critical to do prediction in time series since the mar-gin of error does not depend on the number of observation.The following is the α prediction interval of mean µ

X̄ ± tn,1−α/2σ√

1 +1√n.

the width of which shrink as n increase. The prediction in-terval for xn+m is

x̃n+m ± 1.96σw

√√√√1 +m−1∑j=0

ψ2j

8

Page 9: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

the width of which does not shrink as n increase. With largesample we can find a model to fit the data and estimate φjaccurately. So large sample is always preferred in statistics.

2. Using the data in ozone.dat, forecast one year into the future. Recallthat the data is the monthly ozone concentration in LA from Jan1955 to Dec 1972. Do you think that the confidence intervals for theforecasts accurately reflect the variability in those forecasts?

[Sol] I chose the model sarima(log(ozone),1,1,1,0,1,1,12) .I will, therefore, forecast the log of the data. The plot isseen below. It is pretty looks good since there is a periodicpattern.

Time

lozone

120 140 160 180 200 220

0.0

0.5

1.0

1.5

3 Theoretical problems

1. Suppose that you have data from an AR(1) model of the followingform

xt = 0.4xt−1 + wt

where σ2 = 1.3. If x100 = 0.78, give the forecast for x101, x102, andx103.

[Sol] To find the forecasts, we iterate using the model

x̃101 = 0.4x100 = 0.4(0.78) = 0.312

9

Page 10: Homework 5 - University of Massachusetts Amherstpeople.math.umass.edu/~daeyoung/Stat697TS/hw5_sol.pdfHomework 5 1 Data analysis problem-1 We will be analyzing two data sets. We are

Then,x̃102 = 0.4x̃101 = 0.4(0.312) = 0.1248

andx̃103 = 0.4x̃102 = 0.4(0.1248) = 0.04992.

2. Suppose that {xt} is an AR(1) process with mean zero and wt ∼wn(0, 1) (i.e., xt = φxt−1 +wt with | φ |< 1) and we have observed x1and x3. We would like to estimate the missing value x2 using the bestlinear predictor of x2 given x1 and x2.

1) Compute the autocovariance of xt, γ(h).

[Sol] γ(h) = φh/(1− φ2) for h = 0, 1, 2, ....

2) The best linear predictor of x2 given x1 and x3 has the form y =ax1 + bx3 that satisfies E[x1(x2− y)] = 0 and E[x3(x2− y)] = 0. Findthe complete form of the best linear predictor of x2 by computing aand b in terms of φ.

[Sol] E[x1(x2− y)] = E[x1(x2−ax1− bx3)] = φ1−φ2 −

a1−φ2 −

bφ2

1−φ2 = 0

and E[x3(x2− y)] = E[x3(x2−ax1− bx3)] = φ1−φ2 −

aφ2

1−φ2 −b

1−φ2 = 0.If we solve the two equations simultaneously with respect toa and b, a = b = φ/(1 + φ2). Thus, the best linear predictor ofx2 given x1 and x2 is φ

1+φ2(x1 + x3).

10


Recommended