晋网-山西生活门户     
三晋热线
adall01 adall02
当前位置: 晋网 > 财经

EC451 Ch4程序解析、讲解R编程设计程序

责任编辑:王廖    来源:晋网    时间:2020-02-13 11:06   热搜:设计   阅读量:6904   会员投稿

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.

EC451 Ch4作业代做、代做R编程设计作业、代写data留学生作业、代做R语言作业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.

如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

郑重声明:此文内容为本网站转载企业宣传资讯,目的在于传播更多信息,与本站立场无关。仅供读者参考,并请自行核实相关内容。

栏目:财经

相关文章

adl03
http://www.sxjin.cn