I guess I am not understanding the distinction between PC-Give batch code and the Ox language. I'm assuming that the PC-Give batch code is just a main subset of the Ox language - sufficient to perform menu functions, etc..
I ran a regression in PC-Give, via the model toolbar using the graphical user interface. I select Alt-O to capture the batch code. This produces something to this affect:
---
#include <oxstd.oxh>
#include <oxdraw.oxh>
#import <maximize>
#import <packages/PcGive/pcgive_ects>
// This program requires a licenced version of PcGive Professional.
//--- Ox code for EQ( 2)
decl model = new PcGive();
model.Load("C:\\Users\\Jkinney\\Desktop\\New Data for PCGIVE.XLS");
model.Deterministic(-1);
model.DeSelect();
model.Select(Y_VAR, {"AAA_TOTALTRADES", 0, 0});
model.Select(X_VAR, {"Constant", 0, 0});
model.Select(Y_VAR, {"AAA_TOTALTRADES", 1, 1});
model.Select(X_VAR, {"ABS_CLAIMS_SS", 0, 1});
model.Select(X_VAR, {"ABS_CPI_SS", 0, 1});
model.Select(X_VAR, {"ABS_NONFARMS_SS", 0, 1});
model.Select(X_VAR, {"ABS_PPI_SS", 0, 1});
model.Select(X_VAR, {"CLAIMS_SS_INTRA", 0, 1});
model.Select(X_VAR, {"CPI_SS_INTRA", 0, 1});
model.Select(X_VAR, {"NONFARMS_SS_INTRA", 0, 1});
model.Select(X_VAR, {"PPI_SS_INTRA", 0, 1});
model.Select(X_VAR, {"CLAIMS_DUM_INTRA", -1, -1});
model.Select(X_VAR, {"CPI_DUM_INTRA", -1, -1});
model.Select(X_VAR, {"NONFARMS_DUM_INTRA", -1, -1});
model.Select(X_VAR, {"PPI_DUM_INTRA", -1, -1});
model.Select(X_VAR, {"OAS_AAA_CHANGE", 0, 0});
model.Select(X_VAR, {"MONTH_DEC", 0, 0});
model.Select(X_VAR, {"MONTH_JAN", 0, 0});
model.Select(X_VAR, {"MONDAY", 0, 0});
model.Select(X_VAR, {"TUESDAY", 0, 0});
model.Select(X_VAR, {"WEDNESDAY", 0, 0});
model.Select(X_VAR, {"FRIDAY", 0, 0});
model.Select(X_VAR, {"EARLY_CLOSE_NYSE", 1, 1});
model.Select(X_VAR, {"HOLIDAY_NYSE", 1, 1});
model.Select(X_VAR, {"EARLY_CLOSE_NYSE", 0, 0});
model.Select(X_VAR, {"EARLY_CLOSE_NYSE", -1, -1});
model.Select(X_VAR, {"HOLIDAY_NYSE", 0, 0});
model.Select(X_VAR, {"HOLIDAY_NYSE", -1, -1});
model.Autometrics(0.01, "IIS+SIS", 0);
model.AutometricsSet("effort", 3);
model.AutometricsSet("print", 1);
model.AutometricsSet("test_normality", 1);
model.AutometricsSet("test_hetero", 1);
model.AutometricsSet("test_heterox", 0);
model.AutometricsSet("test_chow", 1);
model.AutometricsSet("test_reset", 1);
model.AutometricsSet("test_ar", 1);
model.AutometricsSet("test_portmanteau", 0);
model.AutometricsSet("test_arch", 1);
model.AutometricsSet("test_default", 0);
*/
model.SetSelSample(5, 1, 545, 1);
model.SetMethod(M_OLS);
model.Estimate();
model.TestSummary();
delete model;
---
I first interpreted the "model." as an indicator that this requires the modelbase class? But I also see examples in the documentation on that class showing a structure I don't see in the above batch code:
Modelbase::Estimate()
{
decl vpstart, vpfree, estout;
if (!InitPar()) // calls InitData() if necessary
return FALSE;
vpstart = GetFreePar(); // map pars to estimation format
estout = DoEstimation(vpstart); // do the estimation
vpfree = isarray(estout) ? estout[0] : estout;
SetFreePar(vpfree);// map estimated pars to normal format
if (m_iResult >= MAX_CONV && m_iResult < MAX_MAXIT)
m_iModelStatus = MS_ESTIMATED;
else
m_iModelStatus = MS_EST_FAILED;
if (m_fPrint)
{ Output();
if (isarray(estout))
OutputMax(estout[1],m_iResult,vpstart,estout[2]);
}
return m_iModelStatus == MS_ESTIMATED;
}
---
Maybe it is doing something all together different. So I look back at the PC-GIVE batch code examples and they don't have the "model." prefixes. The code looks like the following:
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.
----
Not sure when I need "model." and not sure why I keep getting undeclared identifiers, even when I make a declaration such as : decl resids , residual, residuals , xyz;
---
Does anyone know how to add instructions for creating graphics from batch code with the "model." prefix??
I am probably missing something simple. Thanks in advance for your time and effort in reading my questions.
|