Exercise

Using Regression to Test the Projections

After visually inspecting the data, you decide that you also want to use regression analysis to determine whether there is a statistically significant shift in the trend from the historical revenues to the projected revenues. Recall you have to create a trend (trend) and a shift (shift) variable.

For this exercise, the revenue data you created in the prior exercise is stored in the rev object. In that data, you will have two time series: historical revenues (hist_rev) and projected revenues (proj_rev). Historical revenues has positive values for the first 10 years of historical data and 0 for projection period. Projected revenues has 0 for the first 10 years and positive values during the projection period.

Instructions

100 XP
  • Create a single revenue series that adds both historical and projected data.
  • Add a trend variable to rev_all_df using seq().
  • Add a shift variable to rev_all_df using ifelse().
  • Regress rev_all on trend and shift.