# Re: st: Predict dynamic model

 From [email protected] (Vince Wiggins, StataCorp) To [email protected] Subject Re: st: Predict dynamic model Date Mon, 27 Oct 2003 17:58:40 -0600

```Martin Rio, Martin <[email protected]> asks how to do a dynamic prediction after
estimating a regression model with a lagged endogenous variable,

> I am using reg to estimate a time series regression of the form
>
>         y(t) = a + by(t-1) + cx(t) +dz(t) + u(t),
>
> where y(t-1) was generated by lagging y one time period
>
> I want to be able to predict values of y for the later portion of my
> sample and compare these with the actual values. In models with no
> lagged independent variables I would use predict. In this model I
> want to forecast recursively, using the previous forecast to
> estimate the next, and not the predefined y(t-1) variable.  If I
> use:
>
>         predict yhat, bx
>
> stata uses the predefined y(t-1) variable rather than recursively
> estimating y and feeding it back into the model. What command in
> stata would do the recursive trick?

-predict- after -regress- does not truly "understand" the dynamic nature of
time-series data.  But all is not lost, -predict- after -arima- does
understand time, and -arima- is happy to estimate simple regression models
without ARMA components.

If Martin's regression command were

. regress y L.y x1 x2

. arima y L.y x1 x2

Let's further assume that Martin's data is monthly and he wants to begin
dynamic forecasts in April 1995.  He would get the predictions by typing,

. predict y_dynhat , dyn(1995m4)

Martin can find out more in in the discussion of the dyn() and t0() options in
[R] arima.

As a side-bar, Martin may want to specify the -hessian- option on the -arima-
command to produce negative inverse Hessian estimates of the covariance matrix
(VCE), and thus the standard errors.  These VCE estimates differ from the
small-sample estimates of -regress- by only a scale factor.  When -hessian- is
not specified, the default covariance estimate from -arima- is the outer
produce of gradients (OPG) which differs form the Hessian estimate in finite
samples.  Regardless, the parameter estimates are the same.

-- Vince
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```