# EC451 Ch4作业代做、代做R编程设计作业、代写data留学生作业、代做R语言作业代写Python程序|代做R语言编程

EC451 Ch4 Homework Assignment
(due date: February 13th, 2020)
Submit your R script on Blackboard.
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.
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
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.