32.0 FORECAST Command
The FORECAST Command allows grid searching of various VAR
forecasting models. The FORECAST option is actually writing a set of
BTEST (see section 21) models. Users of this command either inspect
output OR look at SCA FSAVE file output to determine the approprioate
model. It is important to realize that the FORECAST command is actually
setting up multiple VAR models using the BTEST command. The BTEST
command itself contains a FORECAST sentence
Form of FORECAST command.
B34SEXEC FORECAST options parameters$
PGMCARDS$
BTEST cards here
B34SRETURN$
B34SRUN$
Inside the PGMCARDS$ / B34SRETURN$ delimiters the user must specify
the needed BTEST commands except for BTEST sentence and AR sentences.
The FORECAST command will supply the AR sentences for models over the
indicated range. Required cards include:
- SERIESN cards
Optional cards supplied inside PGMCARDS$ B34SRETURN$ delimiters include:
- FORECAST sentence.
- BISPEC sentence.
- TRISPEC sentence.
- POLYSPEC sentence.
- OUTPUT sentence.
- CONSTANT sentence.
- TITLE sentence.
FORECAST command (sentence) parameters.
IBEGIN=n1 Sets beginning observation. Defaults to 1.
IEND=n2 Sets ending observation. Defaults to NOOB.
MINVAR = n1 Sets minimum VAR model run. This is required.
MAXVAR = n2 Sets maximum VAR model run. This is required. The
maximum allowed parameter is 30.
MSUNIT = n3 Sets model input save unit. Default = 9.
If n3 NE 9, then the user can edit the model.
K = n4 Sets the number of series that will be entered
with the SERIESN sentence inside the PGMCARDS$
- B34SRETURN$ delimiters,
STARTP = r1 Sets initial quess for AR parameter. Default = .1.
DMOD= (n5,.) Sets the orders that are not to be run.
ISEAR=n4 If n4 set > 0 then iterative refinement will
occure where all coefficients having abs(t) < sig1
will be set to zero for each successive VAR model
order.
SIG1=r1 Default = 2.0. Sets the critical value for the
absolute value fo the t test to delete var
model coefficients.
Example 1. User wants to estimate the GAS model for VAR orders 1 - 6
and calculate 15 forecasts starting from origin 250 and
12 forecasts starting from origin 260. The forecast file
on unit 44 is moved to unit 50 so that the files will not
be over written. The final step is to browse the file.
/$
/$ We now turn off output to save paper using REWIND. This will
/$ not work if unit 6 is allocated to SYSOUT.
/$
b34sexec forecast k=2 minvar=1 maxvar=6$
pgmcards$
title('test run of various models for the gas data')$
seriesn var=gasin name=('b-j gas input data' )$
seriesn var=gasout name=('b-j gas output data')$
forecast scaunit se nt(250,260) nf(15,12)$
b34srun$
/$
/$ now we move the forecasts.
/$
b34sexec scainput $ fileadd scain=44 scaout=50$
b34srun$
b34sexec options rewind(6)$ b34srun$
b34sreturn$
b34srun$
b34sexec options rewind(6)$ b34srun$
/$
/$ we now look at the results
/$
b34sexec scainput $ getsca browse scaunit=50$
b34srun$
Note: The B34S parser will not parse the statements inside the
PGMCARDS$
B34SRETURN$
which are appended to the generated statements by the FORECAST
command. Note the use of B34SRUN$ inside the PGMCARDS section
to force execution. If this is not done, the SCAINPUT command
will try to execute on a file that does not yet exist.
It is highly recommended that initially you run with output
on to see if there are any problems.
Example 2. User wants to estimate the GAS model for VAR orders 4 - 12
but skip orders 6 and 8.
b34sexec forecast k=2 minvar=4 maxvar=12 dmod(6,8)$
pgmcards$
title('test run of various models for the gas data')$
seriesn var=gasin name=('b-j gas input data' )$
seriesn var=gasout name=('b-j gas output data' )$
b34srun$
b34sreturn$
b34srun$
Example 3. User wants to estimate the GAS model for VAR orders 4 - 12,
skip orders 6 and 7 and remove all coefficients whose abs(t)
if less than 2.5.
b34sexec forecast k=2 minvar=4 maxvar=12 dmod(6,7) isear=1 sig1=2.5 $
pgmcards$
title('test run of various models for the gas data')$
seriesn var=gasin name=('b-j gas input data' )$
seriesn var=gasout name=('b-j gas output data' )$
b34srun$
b34sreturn$
b34srun$
Example 4. User wants to do a grid search from orders 3 to 6, skipping
orders 4 and 5. The user will eliminate nonsignificant
VAR terms. The OPTIONS command to write forecasts into
an existing file on unit 44. After each model is
estimated, the files are copied to unit 50.
Since unit 44 and unit 50 are exisiting files, the REUSE
option is used to clean the files. The combined file on
unit 50 is inspected with the BROWSE option before and
after the files are renamed. The SCAINPUT command
GETSCA sentence is used to input the forecasted files
into B34S. In the first file the actual series values
are built. The data is first loaded using the include
sentence. Note that the B34SRUN$ sentence has been
used in place of the B34SEEND$ sentence to force B34S
to execute. If this is not done, the appropriate variable
names will not be found at the parse stage. The file is
annotated using /$ comments for all steps. Fiule format
for cms. For unix and PC thje open statements need tyo be
changed.
/$ step # 1 load the data.
/$
b34sexec options open('/b34srun maclib * (gasdata)') include(33)$
b34srun$
/$
/$ the following commands are commented out since files exist
/$ b34sexec options open('/test 50 a1') unit(50) disp=new$ b34seend$
/$ b34sexec options open('/test 44 a1') unit(44) disp=new$ b34seend$
/$
/$ step # 2 open the output files for saving the forecasts.
/$
b34sexec options open('/test 50 *') unit(50) disp=old$ b34seend$
b34sexec options open('/test 44 *') unit(44) disp=old$ b34seend$
/$
/$ step # 3 mark these files to be reused.
/$
b34sexec options reuse(44)$ b34seend$
b34sexec options reuse(50)$ b34seend$
/$
/$ step # 4 perform forecasting - then save after each model.
/$
b34sexec forecast k=2 minvar=3 maxvar=6 dmod(4,5) isear=2 $
pgmcards$
title('test run of a var search')$
seriesn var=gasin name('b-j gas input data')$
seriesn var=gasout name('b-j gas output data')$
bispec iauto iturno$
output lagrho=24$
forecast scaunit nt=250 nf=20 output=new se$
b34srun$
b34sexec scainput$ fileadd scain=44 scaout=50$ b34srun$
b34sreturn$
b34srun$
/$
/$ step # 5 browse the contents of the file on unit 50.
/$
b34sexec scainput$ getsca browse scaunit=50$
b34srun$
/$
/$ step # 6 rename the files to be new1,....,newk.
/$
b34sexec scainput $ fileadd scain=50 scaout=50 udsn(new)$
b34srun$
/$
/$ step # 7 browse the transformed file.
/$
b34sexec scainput$ getsca browse scaunit=50$
b34srun$
/$
/$ step # 8 load file new1 into b34s and list data
/$
b34sexec scainput$ getsca scaunit=50 dataset(new1)$ b34srun$
b34sexec list$ b34srun$
/$
/$ step # 9 generate the y variable as forecast + error
/$ and generate correlations. this verifies what is
/$ automatically written inside the file as a comment
/$ by b34s. note use the the set option which loads
/$ the currently active dataset into the b34s data
/$ step.
/$
b34sexec data set corr$ build s1 s2$ gen s1=add(for1,err1)$
gen s2=add(for2,err2)$ b34srun$ b34sexec list$ b34srun$
/$
/$ step # 10 load and list file new2.
/$
b34sexec scainput$ getsca scaunit=50 dataset(new2)$ b34srun$
b34sexec list$ b34srun$
/$
/$ step # 11 load and list file new3.
/$
b34sexec scainput$ getsca scaunit=50 dataset(new3)$ b34srun$
b34sexec list$ b34srun$
/$
/$ step # 12 load and list file new4.
/$
b34sexec scainput$ getsca scaunit=50 dataset(new4)$ b34srun$
b34sexec list$ b34srun$
Note: Because DMOD(4,5) was in effect there are only 4 models run.
These are the full VAR(3), the VAR(3) with all nonsignificant
variables removed, the full VAR(6) and the VAR(6) with all
nonsignificant variables removed.