# Fitted values from regression on first differences

I wish to predict variable $y$, and so I am tempted to estimate

$$y_t = \beta_0 + \beta_1 x_t+ u_t$$

Looking at a plot of $y$, the series does not seem stationary. Instead I regress like so:

$$y_t - y_{t-1} = \gamma ( x_t - x_{t-1} ) + u_t$$

Now the purpose of this time series transformation is to make the series stationary - lets assume that the series is stationary in the changes.

How do then back track, and calculate the actual level predictions?

Bonus points for R code.

1. a starting point $y_t$ at levels,
2. predictions of the increments $\Delta \hat y_{t+1},\dotsc,\Delta \hat y_{t+h}$,
then to obtain the prediction $\hat y_{t+h}$ you need to sum $y_t$ and all the predicted increments $\Delta \hat y_{t+i}$ for $i=1,\dotsc,h$:
$$\hat y_{t+h} = y_t + \Delta \hat y_{t+1} + \dotsc + \Delta \hat y_{t+h}$$
In R this can be done as follows: sum(c(y[t],dy_hat[1:h])) where y is the original data vector and dy_hat is a vector composed of the predicted increments $\Delta \hat y_{t+1},\dotsc,\Delta \hat y_{t+h}$.