PcGive: Batch Language

These reference sections have been taken from Volumes I-III and V.

Table of contents
1 Algebra and Batch for Single Equation Modelling
  1.1 General restrictions
  1.2 Non-linear models
  1.2.1 Non-linear least squares
  1.2.2 Maximum likelihood
  1.3 PcGive batch language
2 Algebra and Batch for Multiple Equation Modelling
  2.1 General restrictions
  2.1.1 Restrictions for testing
  2.1.2 Restrictions for estimation
  2.2 PcGive batch language
  8.5 Panel batch commands
  11.3 GARCH batch commands
  14.7 ARFIMA batch commands
15 Regime Switching batch commands
List of tables
  Table:1.1 Batch language syntax summary
  Table:2.1 Restrictions operator precedence
  Table:2.2 Batch language syntax summary

Chapter 1 Algebra and Batch for Single Equation Modelling

PcGive is mostly menu-driven for ease of use. To add flexibility, certain functions can be accessed through entering commands. The syntax of these commands, which can be seen as little computer languages, is described in this chapter.

Algebra is described in the OxMetrics manuals. Algebra commands are executed in OxMetrics, via the Calculator, the Algebra editor, or as part of a batch run.

1.1 General restrictions

Restrictions have to be entered when testing for parameter restrictions and for imposing parameter constraints for estimation. The syntax is similar to that of algebra, albeit more simple.

Restrictions code may consist of the following components:

  1. Comment

  2. Constants

  3. Arithmetic operators

These are all identical to algebra. In addition there are:

  1. [(4)] Parameter references

    Parameters are referenced by an ampersand followed by the parameter number. Counting starts at 0, so, for example, &2 is the third parameter of the model. What this parameter is depends on your model. Make sure that when you enter restrictions through the batch language, you use the right order for the coefficients. In case of IV estimation PcGive will reorder your model so that the endogenous variables come first.

Consider, for example, the following unconstrained model:

CONSt = β0CONS_1t + β1 INCt + β2 INC_1t + β3 INFLATt + β4 +ut.

Then &0 indicates the coefficient on CONS_1, etc.

Restrictions for testing are entered in the format: f(θ)=0;. The following restrictions test the significance of the long-run parameters in this unconstrained model:

(&1 + &2) / (1 - &0) = 0;
&3 / (1 - &0) = 0;

1.2 Non-linear models

1.2.1 Non-linear least squares

A non-linear model is formulated in Algebra code. The following extensions are used:

  1. parameter references

    Parameters are referenced by an ampersand followed by the parameter number. The numbering does not have to be consecutive, so your model can use for example &1, &3 and &4.

    Consider, for example, the following specification of the fitted part:

    fitted = &0*lag(CONS,1) + &1*INC + &3*INFLAT + &4;
    

  2. starting values

    Starting values are entered in the format: &parameter=value;. For example:

    &0 = 0;  &1 = 1;  &3 = -1;  &4 = 1;
    

The following two variables must be defined for NLS to work:

  1. actual

    Defines the actual values (the y variable).

  2. fitted

    Defines the fitted values (the ŷ variable).

Together, these formulate the whole non-linear model, as in the following example:

actual = CONS;
fitted = &0 + &1*lag(CONS,1) + &2*INC - &1*&2*lag(INC,1);

1.2.2 Maximum likelihood

Maximum likelihood models are defined using the three variables:

  1. actual

  2. fitted

  3. loglik

Both actual and fitted only define the variables being used in the graphic analysis and the residual based tests. The loglik variable defines the function to be maximized. Parameters and starting values are as for NLS.

1.3 PcGive batch language

Table:1.1 Batch language syntax summary

adftest("var", lag, deterministic=1, summary=1);
algebra { ...}
appenddata("filename", "group");
appresults("filename");
arorder(ar1, ar2);
autometrics(pvalue, "outlier"="none", prelag=1);
autometrics_set("option", value);
break;
chdir("path");
command("command_line");
createinterventions { ...}
database(year1, period1, year2, period2, frequency);
derived { ...}
dynamics;
encompassing;
estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0, forc=0, init=0);
exit;
forecast(nforc, hstep=0, setype=1, levels=0, robust=0, hegdehog=0, gap=0);
loadalgebra("filename");
loadbatch("filename");
loadcommand("filename");
loaddata("filename");
module("name");
nonlinear { ...}
print("text");
println("text");
option("option", argument);
output("option");
package("PcGive", "package");
progress;
savedata("filename");
saveresults("filename");
setdraw("option", i1=0, i2=0, i3=0, i4=0, i5=0);
store("name", "rename"="");
system { ...}
test("test", lag1=0, lag2=0);
testlinres { ...}
testgenres { ...}
testsummary;
usedata("databasename");

PcGive allows models to be formulated, estimated and evaluated through batch commands. Such commands are entered in OxMetrics. Certain commands are intercepted by OxMetrics, such as those for loading and saving data, as well as blocks of algebra code. The remaining commands are then passed on to the active module, which is PcGive in this case. This section gives an alphabetical list of the PcGive batch language statements. There are two types of batch commands: function calls (with or without arguments) terminated by a semicolon, and commands, which are followed by statements between curly brackets.

Anything between /* and */ is considered comment. Note that this comment cannot be nested. Everything following // up to the end of the line is also comment.

OxMetrics allows you to save the current model as a batch file, and to rerun saved batch files. If a model has been created interactively, it can be saved as a batch file for further editing or easy recall in a later session. This is also the most convenient way to create a batch file.

If an error occurs during processing, the batch run will be aborted and control returned to OxMetrics. A warning or out of memory message will have to be accepted by the user (press Enter), upon which the batch run will resume.

In the following list, function arguments are indicated by words, whereas the areas where statement blocks are expected are indicated by .... Examples follow the list of descriptions. For terms in double quotes, the desired term must be substituted and provided together with the quotes. A command summary is given in Table Table:2.2. For completeness, the Table Table:2.2 also contains the commands which are handled by OxMetrics. Consult the OxMetrics book for more information on those commands.

 adftest("var", lag, deterministic=1, summary=1);

The var argument specifies the variable for the ADF test, lag is the lag length to be used. The det argument indicates the choice of deterministic variables:

0 no deterministic variables,
1 constant,
2 constant and trend,
3 constant and seasonals,
4 constant, trend and seasonals.
Finally, the summary argument indicates whether a summary table is printed (1) or full output (0).

 arorder(ar1, ar2);

Specifies the starting and ending order for RALS estimation. Note that the estimation sample must allow for the specified choice.

 autometrics(pvalue, "outlier"="none", prelag=1);

Indicates that Autometrics should be run at significance level pvalue. All options are set to their default values. The optional second argument specifies the outlier choice, and is one of

"none"
nothing added;
"large"
adds an impulse dummy for large outliers;
"IIS"
(or "dummy") adds an impulse dummy for every observation: impulse indicator saturation (IIS);
"SIS"
or adds a step dummy (or level shift: one up to the date used in the variable name) for every observation: step indicator saturation (SIS);
"IIS+SIS"
impulse and step saturation;
"DIIS"
adds a differenced impulse dummy for every observation (one, minus one, rest zero);
"DIIS+IIS"
differences and impulse saturation.

The third argument specifies whether pre-search lag reduction should be run or not (1 or 0).

 autometrics_set("option", value);

Changes an Autometrics option from its default value. The options are:

"pre-lag" 0, 1
"pre-var" 0, 1
"effort" 0, 1, 2, 3
"backtesting" "none", "GUM0" , "current GUM"
"tie-breaker" "Union","AIC","HQ","SC","Min","Cp","Max"
"print" 0,1,2,3
"pvalue_tests" p-value
"stderr" "hcse", "hacse"
"give_rf" 0,1
"block_fraction" fraction
"block_method" 0,1,2,3
"block_max" size of largest block
"test_default" 0,1
"test_ar" 0,1
"test_arch" 0,1
"test_chow" 0,1
"test_hetero" 0,1
"test_heterox" 0,1
"test_normality" 0,1
"test_reset" 0,1
"test_portmanteau" 0,1
"arg_default" 0,1
"arg_ar" lag length
"arg_arch" lag length
"arg_chow" fraction
"arg_portmanteau" lag length

 createinterventions { ...}

This PcGive batch function creates interventions in the current OxMetrics database. The argument inside the curly braces is a comma-separated list of names inside double quotes. The names uses the same format as Autometrics, e.g.

  createinterventions {"I:1980(3)","S1:2009(8)","DI:1990(3)"}

 derived { ...}

Specify Algebra code for derived variables to be used in forecasting.

 dynamics;

Does part of the dynamic analysis: the static long-run solution and the lag structure analysis.

 encompassing ;

Run encompassing test on current and previous model.

 estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0, forc=0, init=0);

Estimate a system. The presence of default arguments implies that the shortest version is just: estimate(), which estimates by OLS using the maximum possible sample, and no forecasts. Similarly, a call to estimate("OLS", 1950, 1) corresponds to estimate("OLS", 1950, 1, -1, 0, 0, 0).

The method argument is one of:

OLS-CS ordinary least squares (cross-section regression),
IVE-CS instrumental variables estimation (cross-section regression),
OLS ordinary least squares,
IVE instrumental variables estimation,
RALS autoregressive least squares (also see arorder),
NLS non-linear least squares (non-linear modelling),
ML maximum likelihood (non-linear modelling).

year1(period1) -- year2(period2) is the estimation sample. Setting year1 to -1 will result in the earliest possible year1(period1), setting year2 to -1 will result in the latest possible year2(period2).

forc is the number of observations to withhold from the estimation sample for forecasting.

init is the number of observations to use for initialization of recursive estimation (not if method is RALS); no recursive estimation is performed if init = 0.

 forecast(nforc, hstep=0, setype=1, levels=0, robust=0, hegdehog=0, gap=0);

Prints nforc dynamic forecasts (when hstep is zero) or hstep forecasts. The third argument is the standard error type: 0 to not compute; 1 for error variance only (the default); 2 to include parameter uncertainty. For example, forecast(8) produces eight dynamic forecasts with error-variance based standard errors; forecast(8,4) produces the 4-step forecasts (note that the first three will coincide with 1,2,3-step respectively). Use the store command next to store the forecasts if necessary.

Set the levels argument to one to also produce levels forecasts; and set the robust argument to one to include robust forecasts. The hegdehog argument can be used to produce hedgehog graphs (forecasting ahead from each point in the estimation sample). Finally gap waits the specified number of observations after the end of the estimation sample to start forecasting.

 module("PcGive");

Starts the PcGive module (if PcGive is not already running).

 nonlinear {...}Formulates a non-linear model. The code between {}must conform to the syntax of §1.2.

 output("option");

Prints further output:

option
correlation print correlation matrix of variables,
covariance print covariance matrix of coefficients,
equation print the model equation format,
forecasts print the static forecasts,
HCSE Heteroscedasticity-consistent standard errors
infcrit report information criteria,
instability report instability tests,
latex print the model in latex format,
r2seasonals report R2 about seasonals,
reducedform print the reduced form,
sigpar significant digits for parameters (second argument),
sigse significant digits for standard errors (second argument).

 option("option", argument);

The first set relates to maximization:

option argumentvalue
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

The second set of options adds further output automatically:

option argumentvalue
equation add equation format 0 for off, 1 on,
infcrit report information criteria 0 for off, 1 on.
instability report instability tests0 for off, 1 on,
HCSE Heteroscedasticity-consistent SEs 0 for off, 1 on,
r2seasonals report R2 about seasonals0 for off, 1 on,

 package("PcGive", "package");

Use this command to select the correct component (package) from PcGive:

package
"Cross-section"
"Multiple-equation"
"Non-linear"
"Single-equation"
The package arguments can be shortened to 5 letters.

 progress;

Reports the modelling progress.

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of: residuals, fitted, res1step, stdinn, rss, eqse, innov, loglik.

The optional second argument replaces the default name. For example store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz.

 system {Y=...; Z=...; U=...; A=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

The following special variables are recognized: Constant, Trend, Seasonal and CSeason.

Note that when IVE/RIVE are used PcGive reorders the model as follows: the endogenous variables first and the additional instruments last. This reordering is relevant when specifying restrictions.

 test("test", lag1=0, lag2=0);

Performs a specific test using the specified lag lengths.

"ar" test for autocorrelated errors from lag1 to lag2;
"arch" ARCH test up to order lag1;
"comfac" test for common factor;
"encompassing" tests the two most recent models for encompassing;
"hetero" heteroscedasticity test (squares);
"heterox" heteroscedasticity test (squares and cross products);
"instability" instability tests;
"normal" normality test;
"rescor" residual correlogram up to lag lag1;
"reset" Reset test using powers up to lag1.

 testgenres {...}Used to test for general restrictions: specify the restrictions between {}, conforming to §2.1.

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

 testres {...}Test for exclusion restrictions. The content lists the variables to be tested for exclusion, separated by a comma (remember that variable names that are not proper tokens must be enclosed in double quotes).

 testsummary;

Do the test summary.

We finish with an annotated example using most commands. To run this file, we assume that OxMetrics is loaded with data.in7, and that PcGive has been started.

module("PcGive");
package("PcGive", "Single-equation");
usedata("data.in7");
system
{
    Y = CONS, INC;         // endogenous variables
    Z = CONS_1, INC_1,     // non-modelled variables
        Constant;
    A = OUTPUT, OUTPUT_1;  // additional instruments, optional
}
estimate("IVE", 0, 0, 0, 0, 8);
                      // Estimate by IV over maximum sample:
                      // 1953(2)-1992(3), use 8 forecasts
testsummary;          // Do the test summary.
dynamics;             // Do dynamic analysis.
store("residuals");   // store the residuals
testgenres            // Test for general restrictions.
{
    &1 - &2 = 0;      // coeff of CONS_1 - coeff of INC_1.
}
testlinres            // Test for linear restrictions.
{                     // same restriction
    1 5
    0 1 -1 0 0
}
testres               // Test an exclusion restriction
{
    CONS_1, INC_1
}

Chapter 2 Algebra and Batch for Multiple Equation Modelling

PcGive is mostly menu-driven for ease of use. To add flexibility, certain functions can be accessed through entering commands. The syntax of these commands is described in this chapter.

Algebra is described in the OxMetrics manuals. Algebra commands are executed in OxMetrics, via the Calculator, the Algebra editor, or as part of a batch run.

2.1 General restrictions

Restrictions have to be entered when testing for parameter restrictions and for imposing parameter constraints for estimation. The syntax is similar to that of algebra, albeit more simple.

Restrictions code may consist of the following components: (1) Comment, (2) Constants, (3) Arithmetic operators. These are all identical to algebra. In addition there are:

  1. [(4)] Parameter references

    Parameters are referenced by an ampersand followed by the parameter number. Counting starts at 0, so, for example, &2 is the third parameter of the model. What this parameter is depends on your model. Make sure that when you enter restrictions through the batch language, you use the right order for the coefficients. In case of system estimation, PcGive will reorder your model so that the endogenous variables come first.

    Consider, for example, the following unconstrained model:

    CONSt = β0CONS_1t + β1 INCt + β2 INC_1t + β3 INFLATt + β4 +ut.

    Then &0 indicates the coefficient on CONS_1, etc.

Table Table:2.1 lists the precedence of the operators available in restrictions code, with the highest precedence at the top of the table.

Table:2.1 Restrictions operator precedence

Symbol Description Associativity
& Parameter reference
- Unary minus Right to left
+ Unary plus
^4 Power Left to right
* Multiply Left to right
/ Divide
+ Add Left to right
- Subtract

2.1.1 Restrictions for testing

Restrictions for testing are entered in the format: f(θ)=0;. The following restrictions test the significance of the long-run parameters in the unconstrained model given above:

    (&1 + &2) / (1 - &0) = 0;
    &3 / (1 - &0) = 0;

2.1.2 Restrictions for estimation

PcGive allows estimation of two types of non-linear models: FIML with parameter constraints (CFIML), and restrictions on a cointegrated VAR. Examples were given in the tutorial chapters.

Parameter constraints for estimation are written in the format: θ*=g(θ);. First consider an example which restricts parameter 0 as a function of three other parameters, creating a model which is non-linear in the parameters:

    &0 = -(&1 - &2) * &3;
    &4 = 0;

Tests for general restrictions on the α and β matrices from the cointegration analysis can be expressed directly in the elements of α and β'. Consider a system with three variables and cointegrating rank of 2. Then the elements are labelled as follows:

α=(
&0 &1
&2 &3
&4 &5
) ,  β=(
&6 &7 &8
&9 &10 &11
) .

To test the necessary conditions for weak exogeneity, for example, set:

    &1 = 0;  &2 = 0; &4 = 0;

Starting values may be supplied as follows:

    &1 = 0;  &2 = 0; &4 = 0;
    start = 1 -1 1 -1 2 4 3 5 6;

A value is listed for each unrestricted parameter, so &0 starts with the value 1, &3 with -1, etc. here the starting values were picked randomly. Of course, it is only useful to specify starting values if these are better than the default values.

2.2 PcGive batch language

Table:2.2 Batch language syntax summary

adftest("var", lag, deterministic=1, summary=1);
algebra { ...}
appenddata("filename", "group");
appresults("filename");
arorder(ar1, ar2);
autometrics(pvalue, "outlier"="none", prelag=1);
autometrics_set("option", value);
break;
chdir("path");
command("command_line");
cointcommon { ...}
cointknown { ...}
constraints { ...}
createinterventions { ...}
database(year1, period1, year2, period2, frequency);
derived { ...}
dynamics;
estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0, forc=0, init=0);
exit;
forecast(nforc, hstep=0, setype=1, levels=0, robust=0, hegdehog=0, gap=0);
loadalgebra("filename");
loadbatch("filename");
loadcommand("filename");
loaddata("filename");
model {...}
module("name");
nonlinear { ...}
option("option", argument);
output("option");
package("PcGive", "package");
print("text");
println("text");
progress;
rank(rank);
savedata("filename");
saveresults("filename");
setdraw("option", i1=0, i2=0, i3=0, i4=0, i5=0);
store("name", "rename"="");
system { ...}
test("test", lag1=0, lag2=0);
testlinres { ...}
testgenres { ...}
testsummary;
usedata("databasename");

PcGive allows models to be formulated, estimated and evaluated through batch commands. Such commands are entered in OxMetrics. Certain commands are intercepted by OxMetrics, such as those for loading and saving data, as well as blocks of algebra code. The remaining commands are then passed on to the active module, which is PcGive in this case. This section gives an alphabetical list of the PcGive batch language statements. There are two types of batch commands: function calls (with or without arguments) terminated by a semicolon, and commands, which are followed by statements between curly brackets.

Anything between /* and */ is considered comment. Note that this comment cannot be nested. Everything following // up to the end of the line is also comment.

OxMetrics allows you to save the current model as a batch file, and to rerun saved batch files. If a model has been created interactively, it can be saved as a batch file for further editing or easy recall in a later session. This is also the most convenient way to create a batch file.

If an error occurs during processing, the batch run will be aborted and control returned to OxMetrics. A warning or out of memory message will have to be accepted by the user (press Enter), upon which the batch run will resume.

In the following list, function arguments are indicated by words, whereas the areas where statement blocks are expected are indicated by .... Examples follow the list of descriptions. For terms in double quotes, the desired term must be substituted and provided together with the quotes. A command summary is given in Table Table:2.2. For completeness, the Table Table:2.2 also contains the commands which are handled by OxMetrics. Consult the OxMetrics book for more information on those commands.

 adftest("var", lag, deterministic=1, summary=1);

The var argument specifies the variable for the ADF test, lag is the lag length to be used. The det argument indicates the choice of deterministic variables:

0 no deterministic variables,
1 constant,
2 constant and trend,
3 constant and seasonals,
4 constant, trend and seasonals.
Finally, the summary argument indicates whether a summary table is printed (1) or full output (0).

 arorder(ar1, ar2);

Specifies the starting and ending order for RALS estimation. Note that the estimation sample must allow for the specified choice.

 autometrics(pvalue, "outlier"="none", prelag=1);

Indicates that Autometrics should be run at significance level pvalue. All options are set to their default values. The optional second argument specifies the outlier choice, and is one of

"none"
nothing added;
"large"
adds an impulse dummy for large outliers;
"IIS"
(or "dummy") adds an impulse dummy for every observation: impulse indicator saturation (IIS);
"SIS"
or adds a step dummy (or level shift: one up to the date used in the variable name) for every observation: step indicator saturation (SIS);
"IIS+SIS"
impulse and step saturation;
"DIIS"
adds a differenced impulse dummy for every observation (one, minus one, rest zero);
"DIIS+IIS"
differences and impulse saturation.

The third argument specifies whether pre-search lag reduction should be run or not (1 or 0).

 autometrics_set("option", value);

See Volume I.

 cointcommon { ...}

Sets the constraints for cointegrated VAR -- use rank first to set the rank p. Two matrices are specified, first A then H. A is the matrix of restrictions on α, namely α=Aθ. H is the matrix of known β, to test β=[H:φ]. The A and H are specified in the same way as a matrix in a matrix file: first the dimensions are given, then the contents of the matrix. Note that 0 0 indicates a matrix of dimension 0×0, that is, absence of the matrix. This can be used to have either α or β unrestricted.

This command must appear before estimate.

 cointknown { ...}

Sets the constraints for cointegrated VAR -- use rank first to set the rank p. A and H are matrices of restrictions on α and β for cointegration tests: α=Aθ and/or β=Hφ. The matrices are specified as in cointcommon.

This command must appear before estimate.

 constraints { ...}

Sets the constraints for cointegrated VAR (use rank first to set the rank p) or for constrained simultaneous equations (CFIML) estimation. This command must appear before estimate.

 createinterventions { ...}

This PcGive batch function creates interventions in the current OxMetrics database. The argument inside the curly braces is a comma-separated list of names inside double quotes. The names uses the same format as Autometrics, e.g.

  createinterventions {"I:1980(3)","S1:2009(8)","DI:1990(3)"}

 derived { ...}

Specify Algebra code for derived variables to be used in forecasting.

 dynamics;

Does part of the dynamic analysis: the static long-run solution and the lag structure analysis.

 estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0, forc=0, init=0);

Estimate a system. The presence of default arguments implies that the shortest version is just: estimate(), which estimates by OLS using the maximum possible sample, and no forecasts. Similarly, a call to estimate("OLS", 1950, 1) corresponds to estimate("OLS", 1950, 1, -1, 0, 0, 0).

The method argument is one of:

OLS-CS ordinary least squares (cross-section regression),
IVE-CS instrumental variables estimation (cross-section regression),
OLS ordinary least squares,
IVE instrumental variables estimation,
RALS autoregressive least squares (also see arorder),
NLS non-linear least squares (non-linear modelling),
ML maximum likelihood (non-linear modelling),
COINT cointegrated VAR,
FIML full information ML (simultaneous equations modelling),
3SLS three-stage LS (simultaneous equations modelling),
2SLS two-stage LS (simultaneous equations modelling),
1SLS single equation OLS (simultaneous equations modelling),
CFIML constrained FIML (constrained simultaneous equations modelling).

year1(period1) -- year2(period2) is the estimation sample. Setting year1 to -1 will result in the earliest possible year1(period1), setting year2 to -1 will result in the latest possible year2(period2).

forc is the number of observations to withhold from the estimation sample for forecasting.

init is the number of observations to use for initialization of recursive estimation (not if method is RALS); no recursive estimation is performed if init = 0.

 forecast(nforc, hstep=0, setype=1, levels=0, robust=0, hegdehog=0, gap=0);

Prints nforc dynamic forecasts (when hstep is zero) or hstep forecasts. The third argument is the standard error type: 0 to not compute; 1 for error variance only (the default); 2 to include parameter uncertainty. For example, forecast(8) produces eight dynamic forecasts with error-variance based standard errors; forecast(8,4) produces the 4-step forecasts (note that the first three will coincide with 1,2,3-step respectively). Use the store command next to store the forecasts if necessary.

Set the levels argument to one to also produce levels forecasts; and set the robust argument to one to include robust forecasts. The hegdehog argument can be used to produce hedgehog graphs (forecasting ahead from each point in the estimation sample). Finally gap waits the specified number of observations after the end of the estimation sample to start forecasting.

 model {...}

Specify the model. There must be an equation for each endogenous and identity endogenous variable specified in the system statement. An example of an equation is: CONS=CONS_1,INC;. Note that PcGive reorders the equations of the model into the order they had in the system specification. Right-hand-side variables are not reordered.

 module("PcGive");

Starts the PcGive module. If PcGive is already running, this batch command is not required.

 nonlinear {...}Formulates a single-equation non-linear model.

 option("option", argument);

The first set relates to maximization:

option argumentvalue
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

The second set of options adds further output automatically:

option argumentvalue
equation add equation format 0 for off, 1 on,
infcrit report information criteria 0 for off, 1 on.
instability report instability tests0 for off, 1 on,
HCSE Heteroscedasticity-consistent SEs 0 for off, 1 on,
r2seasonals report R2 about seasonals0 for off, 1 on,

The final option is for recursive estimation of cointegrated VARs:

option argumentvalue
shortrun re-estimate shortrun 1: re-estimate, 0: fixed.

 output("option");

Prints further output:

option
correlation print correlation matrix of variables,
covariance print covariance matrix of coefficients,
equation print the model equation format,
forecasts print the static forecasts,
HCSE Heteroscedasticity-consistent standard errors
infcrit report information criteria,
instability report instability tests,
latex print the model in latex format,
r2seasonals report R2 about seasonals,
reducedform print the reduced form,
sigpar significant digits for parameters (second argument),
sigse significant digits for standard errors (second argument).

 package("PcGive", "package");

Use this command to select the correct component (package) from PcGive:

package
"Cross-section"
"Multiple-equation"
"Non-linear"
"Single-equation"
The package arguments can be shortened to 5 letters. All models in this book require package("PcGive", "Multiple-equation").

 progress;

Reports the modelling progress.

 rank(rank);

Sets the rank p of the long-run matrix for cointegrated VAR analysis. This command must appear before constraints and estimate.

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of:

residuals residuals
fitted fitted values
structres structural residuals (model only)
res1step 1-step residual (after recursive estimation)
rss RSS (after recursive estimation)
stdinn stand. innovations (after single eqn recursive estimation)
eqse equation standard errors (recursive estimation)
loglik log-likelihood (after recursive estimation)
coieval eigenvalues (after recursive cointegration analysis)
The optional second argument replaces the default name. For example a single equation model, store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz. For a multiple equation models, say INC and CONS, the names are VINC, VCONS in the firstcase, and xyz1, xyz2 in the second.

 system {Y=...; Z=...; U=...; A=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

The following special variables are recognized: Constant, Trend, Seasonal and CSeasonal.

Note that when IVE/RIVE are used PcGive reorders the model as follows: the endogenous variables first and the additional instruments last. This reordering is relevant when specifying restrictions.

Note that PcGive reorders a multiple-equation system as follows: first the endogenous variables and their lags: endogenous variables, identity endogenous variables, first lag of these (variables in the same order), second lag, etc. then each exogenous variable with its lags. For example, with y, c endogenous, i identity and w, z exogenous:

yt ct it yt-1 ct-1 it-1 yt-2 ct-2 wt wt-1 zt zt-1

This reordering is relevant when specifying restrictions.

 test("test", lag1=0, lag2=0);

Performs a specific test using the specified lag lengths.

"ar" test for autocorrelated errors from lag1 to lag2;
"arch" ARCH test up to order lag1;
"comfac" test for common factor;
"encompassing" tests the two most recent models for encompassing;
"hetero" heteroscedasticity test (squares);
"heterox" heteroscedasticity test (squares and cross products);
"I1" I(1) cointegration test for VAR estimated in levels;
"I2" I(2) cointegration test for VAR estimated in levels;
"instability" instability tests;
"normal" normality test;
"rescor" residual correlogram up to lag lag1;
"reset" Reset test using powers up to lag1.

 testgenres {...}Used to test for general restrictions: specify the restrictions between {}, conforming to §2.1.

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

 testres {...}Test for exclusion restrictions. The content lists the variables to be tested for exclusion, separated by a comma (remember that variable names that are not proper tokens must be enclosed in double quotes).

 testsummary;

Do the test summary.

We finish with an annotated example using most commands.

chdir("#home");            // change to OxMetrics directory
loaddata("data.in7");      // Load the tutorial data set.
chdir("#batch");           // change to back to batch file dir.
module("PcGive");          // activate PcGive
package("PcGive", "Multi");// activate the PcGive package
usedata("data.in7");       // use data.in7 for modelling
algebra
{                          // Create SAVINGSL in database.
    SAVINGSL = lag(INC,1) - lag(CONS, 1);
}
system
{
    Y = CONS, INC, INFLAT; // Three endogenous variables;
    I = SAVINGSL;          // one identity endogenous variable;
    Z = CONS_1, CONS_2,    // the non-endogenous variables; the
        INC_1,INC_2,       // lagged variables need not (better:
        INFLAT_1, INFLAT_2;// should not) exist in the database.
    U = Constant;          // the constant enters unrestricted.
}
estimate("OLS", 1953, 3, 1992, 3, 8);
                     // Estimate the system by OLS over 1953(2)-
                     // 1992(3), withhold 8 forecasts, 
rank(2);             // Rank of cointegrating space.
constraints          // Cointegration restrictions, expressed in
{                    // terms of loadings (a 3 x 2 matrix) and
                     // eigenvectors (in rows, a 2 x 3 matrix).
                     // Elements 0-5 are the loadings.
    &6 = -&7;
    &9 = -&10;
}
estimate("COINT", 1953, 3, 1992, 3, 8);
rank(2);             // Rank of cointegrating space.
constraints
{
    &0 = 0;
    &1 = 0;
    &6 = 1;          // Restrictions on ECMs;
    &7 = -1;         // elements 6-8 are coefficients of 1st ECM
    &8 = 6;          // elements 9-11 of second ECM.
}
estimate("COINT", 1953, 3, 1992, 3, 8);
estimate("OLS");
testsummary;         // Do the test summary.
testgenres           // Test for parameter restrictions.
{                    // Restrictions are on the INFLAT equation:
    &12 = 0;         // coefficient of CONS_1
    &13 = 0;         // coefficient of CONS_2
    &14 - &15 = 0;   // coefficient of INC_1 - coeff. of INC_2.
}
model                // Specify the equations in the model,
{                    // including the identity.
    CONS = INC, SAVINGSL, INFLAT_1;
    INC = INC_1, INC_2, CONS;
    INFLAT = INFLAT_1, INFLAT_2;
    SAVINGSL = INC_1, CONS_1;
}
estimate("FIML");    // Estimate the model by FIML using default sample
dynamics;            // Do dynamic analysis.
constraints          // Impose constraints for constrained 
{                    // estimation.
    &4 = 0;          // Delete INC_2 from INC equation.
}
estimate("CFIML");   // Estimate the constrained model by CFIML;
                     // no observations required for
                     // initialization.
progress;            // Report the modelling progress.

8.5 Panel batch commands

 estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0);

Estimate a system. Note that for panel data all sample arguments are ignored: only the estimation method is used.

The method argument is one of:

"1-step" 1-step estimation,
"2-step" 1 and 2-step estimation,
"OLS" OLS,
"LSDV" Least-squares dummy variables,
"Within" within-groups estimation,
"Between" between-groups estimation,
"GLS(w/b)" GLS (using within/between),
"GLS" GLS (OLS based),
"ML" Maximum likelihood.

 Gmm("variable", lag1, lag2);

Specifies a GMM type instrument.

 GmmLevel("variable", lag, isdiff);

Specifies a level GMM type instrument for combined estimation. If the isdiff argument is 1 it is added in differences, if 0 in levels.

 module("PcGive");

Starts the PcGive module. If PcGive is already running, this batch command is not required.

 option("option", argument);

option argumentvalue
robust Use robust standard errors 0 for off, 1 on,
concentrate Concentrate dummies 0 for off, 1 on,
(not exact with instruments)
transformdummy Transform dummies 0 for off, 1 on,
(differences/deviations)
printgmm Print contents of GMM instruments 0 for off, 1 on,
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

 package("Panel", "package");

Use this command to select the correct Panel component (package) from PcGive:

package
"Static"
"Dynamic"

 setdummy("constant", ...);

Lists the dummy variables to be added. The arguments are separated by a comma and can be: "constant", "time", "group", "timegroup", "individual".

 settest(ispec, iar);

Sets the test options. The first argument is 0 or 1, and determines whether specification tests are printed. The second argument sets the order for the AR test; the default is 2.

 settransform("transform");

Lists the desired transformation. The argument can be: "differences", "deviations", "within", "between".

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of:

residuals residuals
resdiff differenced residuals (after combined estimation)
reslevels levels residuals (after combined estimation)
The optional second argument replaces the default name. For example store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz.

 system {Y=...; X=...; I=...; L=...; R=...; N=...; G=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

Note that IV formulation is different here from the econometric modelling package:

Econometric modelling Panel data models
dependent variable: Y (first Y) Y (just one)
endogenous regressors: Y (remaining Y's) X
regressors: Z X,L or X,I
additional instruments:A L or I

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

11.3 GARCH batch commands

  [T][A]GARCH[M][_t](p, q);
  EGARCH[M][_GED](p, q);

Specifies the model to estimate, with the terms in [ ] optional. Some examples are: GARCH(1,1), TAGARCH(1,1), GARCHM(1,1), EGARCH_GED(1,1). For in mean, a third argument can be "sqrt", or "log", the default being ht when no third argument is present.

 forecast(ctforc);

prints ctforc forecasts.

 estimate("ML", year1=-1, period1=0, year2=-1, period2=0, 0, init= 0);

Estimate a system. The presence of default arguments implies that the shortest version is just: estimate(), which estimates by OLS using the maximum possible sample, and no forecasts. Similarly, a call to estimate("ML", 1950, 1) corresponds to estimate("ML", 1950, 1, -1, 0, 0, 0).

year1(period1) -- year2(period2) is the estimation sample. Setting year1 to -1 will result in the earliest possible year1(period1), setting year2 to -1 will result in the latest possible year2(period2).

init is the number of observations to use for initialization of recursive estimation; no recursive estimation is performed if init = 0.

If the database is dated, specify the start date in the year1 argument and end date in year2, with both periods set to zero. An example is estimate("ML", 1984-01-04, 0, 1992-01-02, 0).

 module("PcGive");

Starts the PcGive module. If PcGive is already running, this batch command is not required.

 option("option", argument);

option argumentvalue
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

 package("GARCH");

Use this command to select the GARCH package.

 progress;

Reports the modelling progress.

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of:

residuals unscaled residuals
scaledres scaled residuals
condvar conditional variance
forecasts forecasted values (after using forecast command)
forcse forecast standard errors
The optional second argument replaces the default name. For example store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz.

 system {Y=...; X=...; H=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

The following special variables are recognized: Constant, Trend, Seasonal and CSeasonal.

 test("test", lag1=0, lag2=0);

Performs a specific test using the specified lag lengths.

"ar" test for autocorrelated errors from lag1 to lag2;
"arch" ARCH test up to order lag1;
"normal" normality test;
"rescor" residual correlogram up to lag lag1;
"rescorsqr"residual correlogram of squares up to lag lag1;

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

 testsummary;

Do the test summary.

14.7 ARFIMA batch commands

 ARFIMA(p, d, q);
 ARFIMA(p, d, q);
 ARMA(p, q);

Specifies the model to estimate, for example ARFIMA(1,d,1) to estimate d with AR(1) and MA(1) components; ARFIMA(1,0.3,1) to fix d=0.3, or ARMA(1,1) to fix d=0.

 fixAR(fix1, fix2, ...);
 fixMA(fix1, fix2, ...);

Fixes the specified AR or MA parameters.

 fixmean(fixat);

Fixes the mean at the specified value.

 samplemean;

Estimates in deviation from sample mean.

 forecast(ctforc);

prints ctforc forecasts.

 estimate("method"=OLS, year1=-1, period1=0, year2=-1, period2=0);

Estimate a system. The presence of default arguments implies that the shortest version is just: estimate(), which estimates by OLS using the maximum possible sample, and no forecasts. Similarly, a call to estimate("EML", 1950, 1) corresponds to estimate("EML", 1950, 1, -1, 0).

The method argument is one of:

EML exact maximum likelihood,
NLS non-linear least squares,
MPL modified profile likelihood,
Init Initialization (starting values) only,
NLS-STAT non-linear least squares with stationarity imposed.

year1(period1) -- year2(period2) is the estimation sample. Setting year1 to -1 will result in the earliest possible year1(period1), setting year2 to -1 will result in the latest possible year2(period2).

If the database is dated, specify the start date in the year1 argument and end date in year2, with both periods set to zero. An example is estimate("EML", 1984-01-04, 0, 1992-01-02, 0).

 option("option", argument);

option argumentvalue
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

 module("PcGive");

Starts the PcGive module. If PcGive is already running, this batch command is not required.

 package("ARFIMA");

Use this command to select the ARFIMA package.

 progress;

Reports the modelling progress.

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of:

residuals residuals
forecasts forecasted values (after using forecast command)
forcse forecast standard errors
forclevel level forecasts
forclevelselevel forecasts standard errors
The optional second argument replaces the default name. For example store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz.

 system {Y=...; X=...; Z=...; W=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

The following special variables are recognized: Constant, Trend, Seasonal and CSeasonal.

 test("test", lag1=0, lag2=0);

Performs a specific test using the specified lag lengths.

"ar" test for autocorrelated errors from lag1 to lag2;
"arch" ARCH test up to order lag1;
"normal" normality test;
"rescor" residual correlogram up to lag lag1;

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

 testsummary;

Do the test summary.

Chapter 15 Regime Switching batch commands

 classification;

prints the regime classification.

 forecast(ctforc);

prints ctforc forecasts.

  MS(S);
  MS_ARMA(S, p, q);
  MS_ARMA(S, p, q, 1);

Specifies the model to estimate, either a Markov-switching dynamic regression, or a Markov-switching ARMA(p, q) model. S denotes the number of regimes. The optional fourth argument to MS_ARMA indicates whether the ARMA parameters are swirching or not.

  MS_Component(S, SVOL);

Specifies a Markov-switching mean-variance component model. S denotes the number of regimes, SVOL the number of variance regimes.

  MS_GARCH(S);
  MS_GARCH_EQ(S);

Specifies a Markov-switching GARCH model; MS_GARCH_EQ has shared GARCH structure. S denotes the number of regimes.

  MS_MV(S, SVOL);

Specifies a Markov-switching multifractal-variance model. S denotes the number of regimes, SVOL the number of variance regimes. The optional dFixB argument either specifies a fixed value for b; any value less than 1 results in b freely estimated.

 estimate("ML", year1=-1, period1=0, year2=-1, period2=0, 0, init= 0);

Estimate a system. The presence of default arguments implies that the shortest version is just: estimate(), which estimates by OLS using the maximum possible sample, and no forecasts. Similarly, a call to estimate("ML", 1950, 1) corresponds to estimate("ML", 1950, 1, -1, 0, 0, 0).

year1(period1) -- year2(period2) is the estimation sample. Setting year1 to -1 will result in the earliest possible year1(period1), setting year2 to -1 will result in the latest possible year2(period2).

init is the number of observations to use for initialization of recursive estimation; no recursive estimation is performed if init = 0.

If the database is dated, specify the start date in the year1 argument and end date in year2, with both periods set to zero. An example is estimate("ML", 1984-01-04, 0, 1992-01-02, 0).

 module("PcGive");

Starts the PcGive module. If PcGive is already running, this batch command is not required.

 option("option", argument);

option argumentvalue
maxit maximum number of iterations default: 1000,
print print every #iteration 0: do not print,
compact compact or extended output 0 for off, 1 on,
strong strong convergence tolerance default: 0.005,
weak set weak convergence tolerance default: 0.0001,

 package("Switching");

Use this command to select the Regime Switching package.

 progress;

Reports the modelling progress.

 store("name", "rename"="");

Use this command to store residuals, etc. into the database, the default name is used. Note that if the variable already exists, it is overwritten without warning. The name must be one of:

fitted fitted values
forcse forecast standard errors
forecasts forecasted values (after using forecast command)
prederr prediction errors (1-step residuals)
probfil filtered probabilities
probpred predicted probabilities (1-step regime probabilities)
probsmo smoothed probabilities
residuals unscaled residuals
scaledres scaled residuals
The optional second argument replaces the default name. For example store("residuals") stores the residuals under the name Residual; store("residuals", "xyz") stores them under the name xyz.

 switchingscale;

Makes the scale part of the variance regime dependent (multivariate models).

 switchingvar;

Makes the variance regime dependent.

 system {Y=...; X=...; R=...; }Specify the system, consisting of the following components:

The variables listed are separated by commas, their base names (that is, name excluding lag length) must be in the database. If the variable names are not a valid token, the name must be enclosed in double quotes.

The following special variables are recognized: Constant, Trend, Seasonal and CSeasonal.

 test("test", lag1=0, lag2=0);

Performs a specific test using the specified lag lengths.

"arch" ARCH test up to order lag1;
"normal" normality test;
"rescor" residual correlogram up to lag lag1;
"rescorsqr"residual correlogram of squares up to lag lag1;

 testgenres {...}Test for general restrictions. The content are the restrictions as formulated in the equivalent dialog.

 testlinres {...}Test for linear restrictions. The content is the matrix dimensions followed by the (R:r) matrix.

 testsummary;

Do the test summary.