fit Equation Procs
Compute static forecasts or fitted values from an estimated equation.
When the regressor contains lagged dependent values or ARMA terms, fit uses the actual values of the dependent variable instead of the lagged fitted values. You may instruct fit to compare the forecasted data to actual data, and to compute forecast summary statistics.
Not available for equations estimated using ordered methods; use Equation::makemodel to create a model using the ordered equation results (see example below).
Syntax
eq_name.fit(options) yhat [y_se]
eq_name.fit(options) yhat [y_se y_var]
Following the fit keyword, you should type a name for the forecast series and, optionally, a name for the series containing the standard errors. For ARCH specifications, you may use the second form of the command, and optionally include a name for the conditional variance series.
Forecast standard errors are currently not available for binary, censored, and count models.
Options

 d In models with implicit dependent variables, forecast the entire expression rather than the normalized variable. u Substitute expressions for all auto-updating series in the equation. g Graph the fitted values together with the ±2 standard error bands. ga Graph the forecasts along with the actuals (if available). e Produce the forecast evaluation table. i Compute the fitted values of the index. Only for binary, censored and count models. s Ignore ARMA terms and use only the structural part of the equation to compute the fitted values. n Ignore coef uncertainty in standard error calculations that use them. f = arg (default= “actual”) Out-of-fit-sample fill behavior: “actual” (fill observations outside the fit sample with actual values for the fitted variable), “na” (fill observations outside the fit sample with missing values). prompt Force the dialog to appear from within a program. p Print view.
Examples
equation eq1.ls cons c cons(-1) inc inc(-1)
eq1.fit c_hat c_se
genr c_up=c_hat+2*c_se
genr c_low=c_hat-2*c_se
line cons c_up c_low
The first line estimates a linear regression of CONS on a constant, CONS lagged once, INC, and INC lagged once. The second line stores the static forecasts and their standard errors as C_HAT and C_SE. The third and fourth lines compute the +/- 2 standard error bounds. The fifth line plots the actual series together with the error bounds.
equation eq2.binary(d=l) y c wage edu
eq2.fit yf
eq2.fit(i) xbeta
genr yhat = 1-@clogit(-xbeta)
The first line estimates a logit specification for Y with a conditional mean that depends on a constant, WAGE, and EDU. The second line computes the fitted probabilities, and the third line computes the fitted values of the index. The fourth line computes the probabilities from the fitted index using the cumulative distribution function of the logistic distribution. Note that YF and YHAT should be identical.
Note that you cannot fit values from an ordered model. You must instead solve the values from a model. The following lines generate fitted probabilities from an ordered model:
equation eq3.ordered y c x z
eq3.makemodel(oprob1)
solve oprob1
The first line estimates an ordered probit of Y on a constant, X, and Z. The second line makes a model from the estimated equation with a name OPROB1. The third line solves the model and computes the fitted probabilities that each observation falls in each category.
Cross-references
To perform dynamic forecasting, use Equation::forecast. See Equation::makemodel and Model::solve for forecasting from systems of equations or ordered equations.