Chapter_6_-_Exercise_Solutions

# Chapter_6_-_Exercise_Solutions - STAT 373 Ch6 Sol 1 Chapter...

This preview shows pages 1–4. Sign up to view the full content.

STAT 373 – Ch6 - Sol - 1 Chapter 6 – Forecasting Exercise Solutions 1. The daily closing value of the S&P 500 index for January 3 to October 7, 2005 is found in the file ch4exercise1.txt with variate names day and SP500. a) Construct a time series plot of the data b) Consider a linear, quadratic and cubic regression model to fit the series. Use explanatory variates day, day2 <-day*day and day3 <- day*day2 For each model b, b2, b3 plot the smoothed series on your time series plot [Use the R command points (fitted(model object), type=’l’) ] c) Which model would you recommend for predicting future values of the SP 500? a) b) see above c) The cubic model fits the data the best. However none of the models are very useful. 2. The Toronto temperature data are in the file torontotemp.txt . One way to account for the seasonal variation is to include terms sin sin(2 * /12) xm o n t h π <− and cos cos(2 * o n t h < − to replace the monthly indicators used in the notes. a) Fit a model to the average monthly temperatures mtempc linear in year, xsin and xcos. b) Are the periodic components significant? c) Plot the fitted values versus month. Is there any indication of a lack of fit of the model? d) Find a 95% prediction interval for the mean temperature in January 1994. How does this interval compare to the one based on the model using indicators? a) lm(formula = mtempc ~ xsin + xcos + year) Residuals: Min 1Q Median 3Q Max Adapted from Stat 372 Course Notes © R.J. MacKay and S.H. Steiner, University of Waterloo, 2006 -8.9018 -1.1737 0.0749 1.3140 5.3554

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
STAT 373 – Ch6 - Sol - 2 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 30.709312 13.223486 2.322 0.0206 * xsin -8.231443 0.117681 -69.947 <2e-16 *** xcos -10.621815 0.117681 -90.260 <2e-16 *** year -0.011834 0.006705 -1.765 0.0782 . --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 1.89 on 512 degrees of freedom Multiple R-Squared: 0.9622, Adjusted R-squared: 0.962 F-statistic: 4347 on 3 and 512 DF, p-value: < 2.2e-16 b) The periodic components are highly significant since their p-values are less than 2e-16. c) From the above plot it is hard to tell if the model fits well. The observed pattern looks similar to the original series. However, residuals plots are better suited to checking the model fit. The residual plots below suggests a reasonable model. Adapted from Stat 372 Course Notes © R.J. MacKay and S.H. Steiner, University of Waterloo, 2006
STAT 373 – Ch6 - Sol - 3 d) Using the R commands new<-data.frame(xsin=0.5,xcos=sqrt(3)/2,year=1994) p<-predict(b,interval='p',newdata=new,level=0.95) p gives fit lwr upr [1,] –6.202745 –9.938354 –2.467136 This interval is very similar to the one given in the notes derived using a model based on indicator variables.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/03/2011 for the course ECON 202 taught by Professor Na during the Spring '11 term at University of Toronto.

### Page1 / 9

Chapter_6_-_Exercise_Solutions - STAT 373 Ch6 Sol 1 Chapter...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online