{smcl}
{* 05feb2010}{...}
{hline}
help for {hi:staticfc}
{hline}

{title:Compute static forecasts for a recursive rolling regression}

{p 8 14}{cmd:staticfc}{it: varlist} [{cmd:if} {it:exp}] [{cmd:in} {it:range}], 
{cmdab:gen:erate(}{it:stub}) [
{cmd:step(}{it:integer}) {cmd:init(}{it:integer}) {cmdab:gr:aph(}{it:string}) {cmd:replace} {cmdab:ti:tle(}{it:string}) ]

{p}{cmd:staticfc} is for use with time-series data.  You must {cmd:tsset} your
data before using {cmd:staticfc}; see help {help tsset}.

{p} {it:varlist} may contain time-series operators; see help {help varlist}.

{title:Description}

{p}{cmd:staticfc} runs a specified linear regression on a recursive rolling
sample: that is, on a sequence of estimation periods successively including each
additional period. It then generates an out-of-sample, or ex ante, forecast and standard
error of forecast for each estimation period. These variables (along with the
number of degrees of freedom used for each period) are returned. The actual series and its 
recursive ex ante forecast may optionally be graphed, along with its 95% confidence interval.


{title:Options}

{p 0 4}{cmdab:gen:erate}({it:stub}) is a required option. It provides the name
of the forecast series to be generated by {cmd:staticfc}. That name is also used
to create two new series, {it:stub}_s and {it:stub}_n, which respectively contain
the standard error of forecast ({it:stdf}; see {cmd:predict}) and the number
of residual degrees of freedom used in each estimation period. Those three variable
names must not be in use.

{p 0 4}{cmd:step}({it:integer}) specifies the number of steps ahead for the
ex ante forecast. The default is one period.

{p 0 4}{cmd:init}({it:integer}) specifies the number of initial periods that are to be
used in the first estimation sample. The default is 20 periods.

{p 0 4}{cmdab:gr:aph(}{it:string}) specifies that a graph is to be produced and 
saved as {it:string}.gph. If that file alreads exists, the {cmd:replace} option
should be used. The {cmd:title}({it:string}) option may be used to add a title
to the graph.


{title:Saved results}

{p}{cmd:staticfc} does not save any results at this time. Its primary purpose is
to calculate the forecast series.



{title:Examples}

{p 8 12}{inp:.} {stata "webuse manufac ":webuse manufac}

{p 8 12}{inp:.} {stata "tsset":tsset}

{p 0 4}Purely static model:

{p 8 12}{inp:.} {stata "staticfc hours caputil lncaputil if tin(1985m1,2008m12), gen(cfc1) graph(fig1) replace":staticfc hours caputil lncaputil if tin(1985m1,2008m12), gen(cfc1) graph(fig1) replace}

{p 0 4}Model with distributed lag of regressor:

{p 8 12}{inp:.} {stata "staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), gen(cfc2) graph(fig2) replace":staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), gen(cfc2) graph(fig2) replace}

{p 0 4}Vary the number of initial periods to 40:

{p 8 12}{inp:.} {stata "staticfc hours L(1/2).caputil lncaputil if tin(1980m1,2008m12), init(40) gen(cfc3) graph(fig3)  replace":staticfc hours L(1/2).caputil lncaputil if tin(1980m1,2008m12), init(40) gen(cfc3) graph(fig3) replace}

{p 0 4}Vary number of steps ahead to 4:

{p 8 12}{inp:.} {stata "staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), step(4) gen(cfc4) graph(fig4) replace":staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), step(4) gen(cfc4) graph(fig4) replace}

{p 0 4}Vary number of steps ahead to 12: 

{p 8 12}{inp:.} {stata "staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), step(12) gen(cfc5) graph(fig5) replace":staticfc hours L(1/2).caputil lncaputil if tin(1985m1,2008m12), step(12) gen(cfc5) graph(fig5) replace}

 
{title:Acknowledgements}

Development of this routine was stimulated by a conversation with Jim Stock about the capabilities
of {cmd:rolling}. Thanks to Sergiy Radyakin for identifying a bug. 

{title:Author}

{p 0 4}Christopher F Baum, Boston College, USA{p_end}
{p 0 4}baum@bc.edu{p_end}