Stata 15 help for forecast

[TS] forecast -- Econometric model forecasting


forecast subcommand ... [, options]

subcommand Description ------------------------------------------------------------------------- create create a new model estimates add estimation result to current model identity specify an identity (nonstochastic equation) coefvector specify an equation via a coefficient vector exogenous declare exogenous variables solve obtain one-step-ahead or dynamic forecasts adjust adjust a variable by add factoring, replacing, etc. describe describe a model list list all forecast commands composing current model clear clear current model from memory drop drop forecast variables query check whether a forecast model has been started -------------------------------------------------------------------------


forecast is a suite of commands for obtaining forecasts by solving models, collections of equations that jointly determine the outcomes of one or more variables. Equations can be stochastic relationships fit using estimation commands such as regress, ivregress, var, or reg3; or they can be nonstochastic relationships, called identities, that express one variable as a deterministic function of other variables. Forecasting models may also include exogenous variables whose values are already known or determined by factors outside the purview of the system being examined. The forecast commands can also be used to obtain dynamic forecasts in single-equation models.

The forecast suite lets you incorporate outside information into your forecasts through the use of add factors and similar devices, and you can specify the future path for some model variables and obtain forecasts for other variables conditional on that path. Each set of forecast variables has its own name prefix or suffix, so you can compare forecasts based on alternative scenarios. Confidence intervals for forecasts can be obtained via stochastic simulation and can incorporate both parameter uncertainty and additive error terms.

forecast works with both time-series and panel datasets. Time-series datasets may not contain any gaps, and panel datasets must be strongly balanced.

This manual entry provides an overview of forecasting models and several examples showing how the forecast commands are used together. See the individual subcommands' manual entries for detailed discussions of the various options available and specific remarks about those subcommands.


--------------------------------------------------------------------------- Setup . webuse klein2 . reg3 (c p L.p w) (i p L.p L.k) (wp y L.y yr) if year < 1939, endog(w p y) exog(t wg g) . estimates store klein

Create a new forecast model . forecast create kleinmodel

Add the stochastic equations fit using reg3 to the kleinmodel . forecast estimates klein

Specify the four identities that determine the other four endogenous variables in our model . forecast identity y = c + i + g . forecast identity p = y - t - wp . forecast identity k = L.k + i . forecast identity w = wg + wp

Identify the four exogenous variables . forecast exogenous wg . forecast exogenous g . forecast exogenous t . forecast exogenous yr

Obtain dynamic forecasts . forecast solve, prefix(bl_) begin(1939)

--------------------------------------------------------------------------- Setup . clear all . webuse hardware . generate lndim = ln(dim) . generate lngdp = ln(gdp) . generate lnstarts = ln(starts) . regress D.lndim lnstarts D.lngdp unrate if qdate <= tq(2009q4) . estimates store dim . regress sheet dim D.lngdp unrate if qdate <= tq(2009q4) . estimates store sheet . regress misc dim D.lngdp unrate if qdate <= tq(2009q4) . estimates store misc

Create a new forecast model named salesfcast and add those two equations . forecast create salesfcast . forecast estimates sheet . forecast estimates misc

Use the names() option of forecast estimates to specify a valid name for the endogenous variable being added . forecast estimates dim, names(dlndim)

Specify an identity to reverse the first-differencing . forecast identity lndim = L.lndim + dlndim

Specify another identity to obtain dim from lndim . forecast identity dim = exp(lndim)

Solve the model, obtaining dynamic forecasts starting in the first quarter of 2010 and suppressing the iteration log with the use of log(off) . forecast solve, begin(tq(2010q1)) log(off)

--------------------------------------------------------------------------- Setup . clear all . webuse statehardware . generate lndim = ln(dim) . generate lnstarts = ln(starts) . xtreg D.lndim lnstarts rgspgrowth unrate if qdate <= tq(2009q4), fe . predict dlndim_u, u . estimates store dim . xtreg sheet dim rgspgrowth unrate if qdate <= tq(2009q4), fe . predict sheet_u, u . estimates store sheet . xtreg misc dim rgspgrowth unrate if qdate <= tq(2009q4), fe . predict misc_u, u . estimates store misc

Extend the estimates of the panel-level effects into the forecast horizon . by state: egen dlndim_u2 = mean(dlndim_u) . by state: egen sheet_u2 = mean(sheet_u) . by state: egen misc_u2 = mean(misc_u)

Define the forecast model, including the estimated panel-specific terms . forecast create statemodel . forecast estimates dim, name(dlndim) . forecast adjust dlndim = dlndim + dlndim_u2 . forecast identity lndim = L.lndim + dlndim . forecast identity dim = exp(lndim) . forecast estimates sheet . forecast adjust sheet = sheet + sheet_u2 . forecast estimates misc . forecast adjust misc = misc + misc_u2

Solve the model, obtaining dynamic forecasts beginning in the first quarter of 2010 . forecast solve, begin(tq(2010q1))


Video example

Tour of forecasting

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index