联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Algorithm 算法作业Algorithm 算法作业

日期:2020-02-12 09:03

EC451 Ch4 Homework Assignment

(due date: February 13th, 2020)

Submit your R script on Blackboard.

Download the data file TotalNonfarm.csv from blackboard and save it to your data folder under

EC451 folder. The series PAYEMS in data1 is a measure of the number of U.S. workers, excluding

farm employees, self-employed, etc.

1. Open data file TotalNonfarm.csv as data1.

2. Print firt six rows of data1.

3. Rename PAYEMS in data1 as y.

4. Set y as a monthly ts series starting January 1939.

5. Plot y with main title = ’Total nonfarm employees in U.S.’

6. Define the time variable. (Sbtract 1939.)

7. Estimate a linear trend model for y and save the results as out1.

8. Print the summary of out1.

9. Define trend1 as the fitted values of out1.

10. Plot actual y and trend1 together using a common y-axis. Use different colors for each line

of graph.

11. Plot residuals of out1.

12. Define time2 variable as squared time.

13. Estimate a quadratic trend model and save the results as out2.

14. Print the summary of out2

15. Define trend2 as the fitted values of out2.

16. Plot actual y and trend2 together using different colors.

17. Plot residuals of out2.

18. Define time3 variable as cubed time.

19. Estimate a cubic trend model and save the results as out3.

20. Print the summary of out3.

21. Are all coefficients significant in out3? Type your answer as comments (starting with #).

22. Define trend3 as the fitted values of out3.

23. Plot actual y and trend3 together using different colors.

Continue on page 2.

24. Plot actual y and fitted values of linear, quadratic and cubic models together using different

colors. Include a legend.

25. Compare the three trend models with AIC values.

26. Compare thre three models with BIC values.

27. Which is the best of the three models in terms of information criteris? Type your answer as

comments.

28. With cubic trend model, forecast for 60 months starting in January 2020 with the following

steps:

(a) Assign the values from 1 to 60 to a variable yf.

(b) Set yf as a monthly ts series starting in January 2020.

(c) Define time.f as the time variable for the forecast period. (Subtract 1939.)

(d) Define new.data for the forecast period as a data.frame. It should include time.f, time.f?2

and time.f?3. You should use the same variable names as in out3, excluding the intercept.

(e) Make the forecasts and save it as y.f3.

(f) Set the forecasts as monthly ts series starting January 2020.

(g) Print the forecast values

(h) Plot y, trend3 and y.f3 together using different colors. Include a legend.

The end.

2


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp