[ PcGive home | Index ]

modelbase.oxh

Modelbase : Database : Sample class reference

Modelbase function members (public by default)
virtual Batch(const sBatch, ...)
 Runs batch code (OxModel only).
virtual BatchMethod(const sMethod)
 Used to set the method from batch (OxModel only).
virtual Buffering(const bBufferOn)
 Switches output buffering on and off (when using OxPack).
virtual ClearEstimation()
 Clears estimation status.
virtual ClearModel()
 Clears the estimated model and calls `Modelbase::ClearEstimation`.
virtual Covar()
 Computes the covariance matrix.
 DbDrawTMatrix(const iArea, const mYt, const asY, const iT1, ...)
 Like DrawTMatrix, but using the underlying database sample information.
 DeSelect()
 Remove the current variable and sample selection.
 DeSelectByIndex(const iSel)
 Removes variable(s) from the selection.
 DeSelectByName(const sVar, const theGroup, const iLag)
 Removes variable(s) from the selection.
virtual DoEstimateDlg(const iFirstMethod, const cMethods, const sMethods, const bForcAllowed, const bRecAllowed, const bMaxDlgAllowed)
 Create and execute an OxPack dialog for model Estimation.
virtual DoEstimation( vParFree)
 Do the model estimation, called from `Modelbase::Estimate`.
virtual DoFormulateDlg(const iLagMode, ...)
 Call the OxPack model Formulation dialog using
virtual DoOption(const sOpt, const val)
 Implement an option as requested by `Modelbase::DoOptionsDlg`.
virtual DoOptionsDlg(const aMoreOptions)
 Create and execute an OxPack dialog for model options;
virtual DoSettingsDlg()
 Call the OxPack model Settings dialog.
virtual Estimate()
 Prepare and estimate the model.
virtual FindGroup(const theGroup)
 Finds the group identifier.
virtual FindMethod(const theMethod)
 Finds the method identifier.
 FixPar(const iP, const dFix)
 Fixes parameters.
 ForceYlag(const iYgroup)
 Reclassifies lagged iYgroup (usually Y_VAR) variables
 FreePar(const iP)
 Frees parameters.
virtual GetBatchCode()
 Gets the Batch code for the entire model.
virtual GetBatchDatabase()
 Creates the database text for batch (OxModel only).
 GetBatchEquation(const sY, const asX)
 Creates the equation formulation text for batch (OxModel only).
virtual GetBatchEstimate()
 Creates the model estimation text for batch (OxModel only).
virtual GetBatchModel()
 Creates the model formulation text for batch (OxModel only).
virtual GetBatchModelSettings()
 Creates the model settings text for batch (OxModel only).
virtual GetBatchModule(const sModule, const sPackage)
 Creates the module text for batch (OxModel only).
 GetCovar()
 Returns covariance matrix.
 GetCovarRobust()
 Returns robust covariance matrix.
 GetForecastData(const iGroup, const mnLag, const mxLag, const cTforc, ...)
 Gets data from the specified model for forecasting.
 GetFreePar()
 Get the vector of free parameters.
 GetFreeParCount()
 Gets number of free parameters p.
 GetFreeParNames()
 Get the names of free parameters.
virtual GetGroupLabels()
 Defines the Y_VAR,X_VAR,... constants as array of strings.
 GetInEstimationSample(const iT1=-1, const iT2=-1)
 Gets the subsample text relative to the estimation sample.
 GetInForecastSample(const iT1, const iT2=-1)
 Gets the subsample text relative to the estimation sample.
 GetLogLik()
 Gets the loglikelihood value.
virtual GetLongRunInfo()
 Get the info of longrun parameters.
virtual GetLongRunNames()
 Get the names of longrun parameters.
 GetMethod()
 Gets the estimation method.
virtual GetMethodLabel()
 Gets the text label of the estimation method.
virtual GetMethodLabels()
 Defines the M_NONE,M_OLS,... constants as array of strings.
virtual GetModelLabel()
 Gets the label of the model.
virtual GetModelSettings()
 Called by OxPack to get the model estimation settings (by default
 GetModelStatus()
 Gets the model status.
virtual GetOxCode()
 Gets the Ox code for the entire model.
virtual GetOxDatabase(const sObj, const sClass)
 Gets the Ox code to load the database.
virtual GetOxDecl(const sObj, const sClass)
 Gets the Ox code to declare the modelling object.
virtual GetOxEstimate(const sObj, const sClass)
 Gets the Ox code for the model estimation.
virtual GetOxModel(const sObj, const sClass)
 Gets the Ox code for the model specification.
virtual GetOxModelSettings(const sObj, const sClass)
 Gets the Ox code for the model settings.
virtual GetPackageName()
 Returns package name.
virtual GetPackageVersion()
 Returns package version.
 GetPar()
 Get the vector of all parameters.
 GetParCount()
 Gets get number of parameters q (including fixed).
virtual GetParNames()
 Get the names of all parameters.
 GetParStatus()
 Returns full parameter info.
virtual GetParTypes()
 Returns array of type letters for each model variable.
 GetPrint()
 Gets the current print status.
virtual GetResVar()
 Returns residual variance.
virtual GetResiduals()
 Gets the residuals.
 GetResult()
 Gets the result of estimation.
 GetStdErr()
 Returns the standard errors of all parameters (0 for fixed).
 GetStdErrRobust()
 Returns the robust std.errors of all parameters (0 for fixed).
 GetX()
 Returns the X matrix.
 GetY()
 Returns the Y matrix.
virtual GetcDfLoss()
 Returns degrees of freedom lost (number of free parameters).
virtual GetcT()
 Returns actual no of observations used in the estimation.
 GetcX()
 Returns number of X variables.
 GetcY()
 Returns number of Y (dependent) variables.
 GetcYlag()
 Returns number of columns in m_mX that are lagged Y variables.
 Grow(const cTadd)
 Grows the database sample size.
 Init()
 Resets everything.
virtual InitData()
 Get the data (first stage prior to estimation).
virtual InitPar()
 Initializes the parameter values (second stage prior to estimation).
virtual IsUnivariate()
 Returns TRUE if the model is univariate.
virtual LoadOptions()
 Used by OxPack to loads the options from persistent storage.
 MapParToFree(const vPar)
 Return the free parameters from the specified full parameter vector.
 Modelbase()
 Constructor.
virtual Output()
 Prints estimation output.
 OutputHeader(const sTitle)
 Prints the header.
 OutputLogLik()
 Prints the loglikelihood and related statistics.
 OutputMax(const sMethod, const iResult, const vPstart, const bNumerical)
 Prints the maximization settings used.
 OutputPar()
 Prints estimated parameters.
static PrintTestVal(const dTest, const cR, const cTdf, const sLabel)
 Prints a test statistic and its significance.
virtual ReceiveData()
 Called by OxPack to let the object receive the data; the object
virtual ReceiveMenuChoice(const sDialog)
 Called by OxPack to let the object receive the menu choice; the object
virtual ReceiveModel()
 Called by OxPack to let the object receive the model specification; the object
 ResetFixedPar()
 Reset the values of the fixed parameters.
virtual SaveOptions()
 Used by OxPack to store the options in persistent storage.
 Select(const theGroup, const aSel)
 Select variables by name into a group.
 SelectByIndex(const theGroup, const iVar, const iLag0, const iLag1)
 Select variables by name into a group.
virtual SendFunctions()
 Sends functions to dialog (used by DPD, e.g.).
virtual SendMenu(const sMenu)
 Sends a menu specification to OxPack.
virtual SendSpecials()
 Sends the names of special variables to OxPack for batch code.
virtual SendVarStatus()
 Sends the specification of variable status types to OxPack for batch code.
virtual SetForecasts(const cForc, const bIsLessForecasts)
 Set the number of forecasts.
 SetFreePar(const vParFree)
 Set the free parameters.
virtual SetMethod(const iMethod)
 Sets the estimation method.
virtual SetModelSettings(const aValues)
 Called by OxPack to update the estimation settings in the object.
 SetModelStatus(const iModelStatus)
 Sets the model status.
 SetPar(const vPar)
 Sets the parameter values (free and fixed) .
 SetParCount(const cPar, ...)
 Set the number of parameters q (including fixed parameters).
 SetPrint( fPrint)
 Switches printing on or off.
virtual SetRecursive(const bSet, const cInit)
 Set the number of recursive steps to initiate recursive estimation.
 SetResult(const iResult)
 Sets the result of estimation.
 SetSelDates(const iYear1, const iMonth1, const iDay1, const iYear2, const iMonth2, const iDay2)
 Select a sample by year, month, day.
 SetSelSample(const iYear1, const iPeriod1, const iYear2, const iPeriod2)
 Select a sample (fixed frequency).
 SetSelSampleByDates(const dDate1, const dDate2)
 Select a sample by date values.
virtual SetStartPar(const vParFree)
 Set the starting values.
 SetVarEx(const mNew, const asNew, const iToffset=0, const viTindex=<>, const iPrint=0)
 Sets variable(s) in the database, used to store estimation results or forecasts.
static ShowBanner(const bSet)
 Switch off/on printing of startup banner.
virtual StoreEstimates(const mX, const asX, const iPrint=0)
 Stores estimation results, taking the estimation sample into account.
virtual StoreForecasts(const mX, const asX, const iPrint=0)
 Stores forecasts, taking the estimation sample into account.
virtual TestRestrictions( mR, ...)
 Tests a linear restriction.

Modelbase data members (protected by default)
static sm_bBanner
 
 m_mCovar
 
 m_mCovarRobust
 
 m_iDeterministic
 
 m_vFixedPar
 
 m_dForcCrit
 
 m_vIdxFreePar
 
 m_vIsFreePar
 
 m_dLogLik
 
 m_fMaxManual
 
 m_iMethod
 
 m_iModelStatus
 
static sm_iOxCode
 
 m_cPar
 
 m_vPar
 
 m_cParFree
 
 m_fPrint
 
 m_bRecursive
 
 m_iResult
 
 m_cT
 
 m_iT1est
 
 m_iT2est
 
 m_cTforc
 
 m_viTindex
 
 m_cTinit
 
 m_mX
 
 m_cX
 
 m_mY
 
 m_cY
 
 m_cYlag
 

Modelbase enum members (protected by default)
 {STATUS_ENDOGENOUS, STATUS_SPECIAL, STATUS_MULTIVARIATE, STATUS_TRANSFORM, STATUS_GROUP, STATUS_ONEONLY, STATUS_GROUP2, STATUS_MULTIPLE, STATUS_DEFAULT, STATUS_GROUP3, STATUS_GROUP4, STATUS_GROUP5}
 OxPack model formulation variable types.
 {SPECIAL_CONSTANT, SPECIAL_TREND, SPECIAL_SEASONAL, SPECIAL_CSEASON}
 OxPack model formulation special variables.
public:{Y_VAR, X_VAR}
 Types of variables in the model.
public:{MS_NONE, MS_DATA, MS_PARAMS, MS_ESTIMATED, MS_EST_FAILED}
 Model estimation status.

exported functions

exported functions
 EvalTestRestrictions(const sResTestCode, const cP, const asMsg, const avResMap, const amResJac)
 

exported enumerations

exported enumerations
 {CTL_LABEL, CTL_GROUP, CTL_SUBGROUP, CTL_CHECK, CTL_INT, CTL_INTRANGE, CTL_RADIO, CTL_RADIOBOX, CTL_SELECT, CTL_DOUBLE, CTL_DATE, CTL_STRING, CTL_EDITOR, CTL_FILE, CTL_FILESAVE, CTL_FOLDER, CTL_MATRIX, CTL_STRMAT, CTL_CHECKLIST, CTL_SAMPLEINDEX, CTL_SAMPLERANGE, CTL_DATEINDEX, CTL_DATERANGE, CTL_ENABLER, CTL_DISABLER, CTL_VARIABLE, CTL_LISTBOX}
 dialog control types.

virtual Modelbase::Batch(const sBatch, ...)
Runs batch code (OxModel only).
Parameters
sBatch string, batch function
optional arguments for the batch function
Returns
0 for error

virtual Modelbase::BatchMethod(const sMethod)
Used to set the method from batch (OxModel only).
Parameters
sMethod string
Returns
the current method

virtual Modelbase::Buffering(const bBufferOn)
Switches output buffering on and off (when using OxPack).
Parameters
bBufferOn TRUE or FALSE

virtual Modelbase::ClearEstimation()
Clears estimation status.
Comments
Sets m_mCovar and m_mCovarRobust to -1, m_dLogLik to .NaN and m_iResult to MAX_NOCONV.

virtual Modelbase::ClearModel()
Clears the estimated model and calls ClearEstimation
Comments
Sets the model status to and calls ClearEstimation

virtual Modelbase::Covar()
Computes the covariance matrix.
Comments
This function should set m_mCovar, and optionally m_mCovarRobust. It is called when GetCovar GetStdErr (or their robust versions) are called and m_mCovar equals -1 (the default after ClearEstimation). This procedure ensures that the covariance is only computed once when required, and not at all when not required (in some Monte Carlo experiments, for example).

Modelbase::DbDrawTMatrix(const iArea, const mYt, const asY, const iT1, ...)
Like DrawTMatrix, but using the underlying database sample information.
Parameters
or a string (when only one variable to graph) (optional argument, default is 0) Or vector with value for each row of data. (optional, default is 2) Each subsequent row will have the next index. Or vector with value for each row of data.
iArea int, area index
mYt m x T matrix with m y variables
asY array of strings (holds variable names), or 0 (no names),
mnYear int, year of first observation (optional argument, default is 1)
iSymbol int, 0: draw line, 1: draw symbols, 2: draw both
iIndex int, line index for first row,

Modelbase::DeSelect()
Remove the current variable and sample selection.
Comments
Also calls ClearModel

Modelbase::DeSelectByIndex(const iSel)
Removes variable(s) from the selection.
Parameters
iSel int, selection indices of variable to remove
Comments
Also calls ClearModel

Modelbase::DeSelectByName(const sVar, const theGroup, const iLag)
Removes variable(s) from the selection.
Parameters
sVar string, name of variable to remove
theGroup int or string, group identifier
iLag int, lag length
Comments
Also calls ClearModel

virtual Modelbase::DoEstimateDlg(const iFirstMethod, const cMethods, const sMethods, const bForcAllowed, const bRecAllowed, const bMaxDlgAllowed)
Create and execute an OxPack dialog for model Estimation.
Parameters
iFirstMethod int, first possible method index
cMethods int, number of available methods
cMethods string with methods, separated by | (number must match cMethods)
bForcAllowed TRUE: add field for m_cTforc
bRecAllowed TRUE: add fields for m_bRecursive and m_cTinit
bMaxDlgAllowed TRUE: add field for m_fMaxManual
Returns
1 if dialog accepted by user, 0 for cancel or error, -1 to return to formulation

virtual Modelbase::DoEstimation( vParFree)
Do the model estimation, called from Estimate
Parameters
vParFree px1 vector with free parameter values
Returns
px1 vector with parameter values (both fixed and free) or array[3] with extended information: { px1 parameters, string with procedure name, TRUE or FALSE for numerical derivatives }
Comments
This function must be overridden with the actual estimation code if Estimate is used.

virtual Modelbase::DoFormulateDlg(const iLagMode, ...)
Call the OxPack model Formulation dialog using OxPackSpecialDialog"("OP_FORMULATE", ...).
Parameters
iLagMode -1: no lags; >= 0: default for first lag
iLagDefault (optional) int, value for lag value box.

virtual Modelbase::DoOption(const sOpt, const val)
Implement an option as requested by DoOptionsDlg
Parameters
sOpt string, option label
val option value

virtual Modelbase::DoOptionsDlg(const aMoreOptions)
Create and execute an OxPack dialog for model options; by default this controls iterative maximization settings.
Parameters
aMoreOptions array[][] with extension of the dialog specification
Returns
TRUE if dialog accepted by user

virtual Modelbase::DoSettingsDlg()
Call the OxPack model Settings dialog.
Returns
1 if dialog accepted by user, 0 for cancel or error, -1 to return to settings,

virtual Modelbase::Estimate()
Prepare and estimate the model.
Returns
TRUE if successful
Comments
Calls InitData and InitPar if not yet called. Then uses InitData to get the free parameters, calls DoEstimation SetFreePar and Output (unless switched off).

virtual Modelbase::FindGroup(const theGroup)
Finds the group identifier.
Parameters
GetGroupLabels).
theGroup int (returned as is), or string (translated in index in
Returns
int, group identifier (0 if not found).

virtual Modelbase::FindMethod(const theMethod)
Finds the method identifier.
Parameters
GetGroupLabels).
theMethod int (returned as is), or string (translated in index in
Returns
int, method identifier (0 if not found).

Modelbase::FixPar(const iP, const dFix)
Fixes parameters.
Parameters
iP int or vector, index of parameter to fix
dFix double or vector, value to fix parameter at
Comments
This is used to fix a parameter at the specified value. Subsequently, this parameter is omitted from the vector returned by GetFreePar

Modelbase::ForceYlag(const iYgroup)
Reclassifies lagged iYgroup (usually Y_VAR) variables to iYgroup.
Parameters
iYgroup to iYgroup; array[2]: reclassify lagged iYgroup[0] variables to iYgroup[0] but only if they have type iYgroup[1]; array[3]: iYgroup[2]=-1: returns indices of lagged variables that need changing.
iYgroup scalar: reclassify the lags of all variables that are

Modelbase::FreePar(const iP)
Frees parameters.
Parameters
iP int, index of parameter(s) to free, use -1 to free all

virtual Modelbase::GetBatchCode()
Gets the Batch code for the entire model.
Returns
string

virtual Modelbase::GetBatchDatabase()
Creates the database text for batch (OxModel only).
Returns
string

Modelbase::GetBatchEquation(const sY, const asX)
Creates the equation formulation text for batch (OxModel only).
Parameters
sY string, variable type
asX array of strings with specification for this type
Returns
string

virtual Modelbase::GetBatchEstimate()
Creates the model estimation text for batch (OxModel only).
Returns
string

virtual Modelbase::GetBatchModel()
Creates the model formulation text for batch (OxModel only).
Returns
string

virtual Modelbase::GetBatchModelSettings()
Creates the model settings text for batch (OxModel only).
Returns
string

virtual Modelbase::GetBatchModule(const sModule, const sPackage)
Creates the module text for batch (OxModel only).
Returns
string

Modelbase::GetCovar()
Returns covariance matrix.
Returns
pxp covariance matrix (as set by Covar) or <>
Comments
Calls Covar if m_mCovar equals -1 (so not when it is empty).

Modelbase::GetCovarRobust()
Returns robust covariance matrix.
Returns
pxp covariance matrix (as set by Covar) or <> if not set
Comments
Calls Covar if m_mCovar equals -1 (so not when it is empty).

Modelbase::GetForecastData(const iGroup, const mnLag, const mxLag, const cTforc, ...)
Gets data from the specified model for forecasting.
Parameters
theGroup int or string, group indicator (e.g. "Y" or PcGive::Y_VAR)
mnLag int, start lag
mxLag int, end lag
cTforc int, number of forecasts (-1: return all)
iT1forc int, first forecasts observation (optional, default is m_iT2est+1)
Returns
Matrix with the available forecasts data (or an empty matrix if no there is no data).
Comments
When m_viTindex is set, returns the entire series except for observations selected by m_viTindex (cross-section mode).

Modelbase::GetFreePar()
Get the vector of free parameters.
Returns
px1 matrix with free parameters

Modelbase::GetFreeParCount()
Gets number of free parameters p.
Returns
number of free parameters.

Modelbase::GetFreeParNames()
Get the names of free parameters.
Returns
array[p] with the names of free parameters

virtual Modelbase::GetGroupLabels()
Defines the Y_VAR,X_VAR,... constants as array of strings.
Returns
array of strings.
Comments
By default this returns {"Y", "X"} for Y_VAR, X_VAR, but the derived class should extend this. This function is used to find the group when it is specified as a string instead of an integer, or printed as a string in GetOxModel

Modelbase::GetInEstimationSample(const iT1=-1, const iT2=-1)
Gets the subsample text relative to the estimation sample.
Parameters
of a sample range)
iT1 int, first observation index (or -1 for full estimation sample)
iT2 int, last observation index (or -1 for just a sample point, instead
Returns
string

Modelbase::GetInForecastSample(const iT1, const iT2=-1)
Gets the subsample text relative to the estimation sample.
Parameters
of a sample range)
iT1 int, first observation index
iT2 int, last observation index (or -1 for just a sample point, instead
Returns
string

Modelbase::GetLogLik()
Gets the loglikelihood value.
Returns
double, the loglikelihood value.

virtual Modelbase::GetLongRunInfo()
Get the info of longrun parameters.
Returns
empty array

virtual Modelbase::GetLongRunNames()
Get the names of longrun parameters.
Returns
empty array

Modelbase::GetMethod()
Gets the estimation method.
Returns
the estimation method.

virtual Modelbase::GetMethodLabel()
Gets the text label of the estimation method.
Returns
string, the text label of the method

virtual Modelbase::GetMethodLabels()
Defines the M_NONE,M_OLS,... constants as array of strings.
Returns
array of strings.
Comments
By default this returns {"None", "OLS"} for M_NONE, M_OLS, but the derived class should extend this. This function is used to find the group when it is specified as a string instead of an integer, or printed as a string in GetOxModel

virtual Modelbase::GetModelLabel()
Gets the label of the model.
Returns
string the label of the model.

virtual Modelbase::GetModelSettings()
Called by OxPack to get the model estimation settings (by default sample period and method information).
Returns
array[] with {value, label} pairs.

Modelbase::GetModelStatus()
Gets the model status.
Returns
one of: MS_NONE, MS_DATA, MS_PARAMS, MS_ESTIMATED, MS_EST_FAILED

virtual Modelbase::GetOxCode()
Gets the Ox code for the entire model.
Returns
string with Ox code

virtual Modelbase::GetOxDatabase(const sObj, const sClass)
Gets the Ox code to load the database.
Parameters
sObj string, object name
sClass string, class name
Returns
string with Ox code

virtual Modelbase::GetOxDecl(const sObj, const sClass)
Gets the Ox code to declare the modelling object.
Parameters
sObj string, object name
sClass string, class name (GetOxCode uses classname(this) by default)
Returns
string with Ox code

virtual Modelbase::GetOxEstimate(const sObj, const sClass)
Gets the Ox code for the model estimation.
Parameters
sObj string, object name
sClass string, class name
Returns
string with Ox code

virtual Modelbase::GetOxModel(const sObj, const sClass)
Gets the Ox code for the model specification.
Parameters
sObj string, object name
sClass string, class name
Returns
string with Ox code

virtual Modelbase::GetOxModelSettings(const sObj, const sClass)
Gets the Ox code for the model settings.
Parameters
sObj string, object name
sClass string, class name
Returns
string with Ox code

virtual Modelbase::GetPackageName()
Returns package name.
Returns
string, package name

virtual Modelbase::GetPackageVersion()
Returns package version.
Returns
string, package version

Modelbase::GetPar()
Get the vector of all parameters.
Returns
qx1 vector of all parameters

Modelbase::GetParCount()
Gets get number of parameters q (including fixed).
Returns
the total number of parameters (free and fixed).

virtual Modelbase::GetParNames()
Get the names of all parameters.
Returns
array[q] with names of all parameters.

Modelbase::GetParStatus()
Returns full parameter info.
Returns
array[3] { total number of parameters q, q x 1 matrix with 1 in position of free parameters, and 0 for fixed, q x 1 matrix with fixed value in position of fixed parameters (free positions are unused), }

virtual Modelbase::GetParTypes()
Returns array of type letters for each model variable.
Returns
empty array.

Modelbase::GetPrint()
Gets the current print status.
Returns

virtual Modelbase::GetResVar()
Returns residual variance.
Returns
the nxn matrix with the residual variance (<> in Modelbase) (n equals 1 for univariate models).

virtual Modelbase::GetResiduals()
Gets the residuals.
Returns
TxK matrix with residuals (<> in Modelbase).

Modelbase::GetResult()
Gets the result of estimation.
Returns
The estimation result.

Modelbase::GetStdErr()
Returns the standard errors of all parameters (0 for fixed).
Returns
qx1 vector with standard errors of all parameters (fixed parameters set to 0) or <>.
Comments
Calls Covar if m_mCovar equals -1 (so not when it is empty).

Modelbase::GetStdErrRobust()
Returns the robust std.errors of all parameters (0 for fixed).
Returns
qx1 vector with standard errors of all parameters (fixed parameters set to 0); returns <> if the robust covariance matrix is not available.
Comments
Calls Covar if m_mCovar equals -1 (so not when it is empty).

Modelbase::GetX()
Returns the X matrix.
Returns
the TxcX matrix X, m_mX.

Modelbase::GetY()
Returns the Y matrix.
Returns
the Txn matrix Y, m_mY.

virtual Modelbase::GetcDfLoss()
Returns degrees of freedom lost (number of free parameters).
Returns
degrees of freedom lost (for tailt, tailchi etc.)

virtual Modelbase::GetcT()
Returns actual no of observations used in the estimation.
Returns
int, the actual number of observations

Modelbase::GetcX()
Returns number of X variables.
Returns
number of X variables

Modelbase::GetcY()
Returns number of Y (dependent) variables.
Returns
number of Y variables

Modelbase::GetcYlag()
Returns number of columns in m_mX that are lagged Y variables.
Returns
number of columns in m_mX that are lagged Y variables
Comments
Lagged Y's are at the start of m_mX.

Modelbase::Grow(const cTadd)
Grows the database sample size.
Parameters
in: int, number of observations to grow database sample by (> 0: cTadd observations are added at the end; < 0: -cTadd observations are added at the beginning).
cTadd
Returns
vector with database indices of variables for which new values were created (so not those that were just extended with .NaN).
Comments
Newly created observations are set to .NaN, except for variables named Constant, Trend, Seasonal, CSeasonal which are updated (NB. Season* and CSeason* are not extended); moves the estimation sample.

Modelbase::Init()
Resets everything.

virtual Modelbase::InitData()
Get the data (first stage prior to estimation).
Returns
TRUE if successful
Comments
If successful sets model status to MS_DATA.

virtual Modelbase::InitPar()
Initializes the parameter values (second stage prior to estimation).
Returns
TRUE if successful
Comments
If model status is less than MS_DATA InitData is called. If successful sets model status to MS_PARAMS.

virtual Modelbase::IsUnivariate()
Returns TRUE if the model is univariate.
Returns
TRUE if the model is univariate

virtual Modelbase::LoadOptions()
Used by OxPack to loads the options from persistent storage.

Modelbase::MapParToFree(const vPar)
Return the free parameters from the specified full parameter vector.
Parameters
vPar q vector with parameter values (both fixed and free)
Returns
p x 1 vector with free parameter values.

Modelbase::Modelbase()
Constructor.

virtual Modelbase::Output()
Prints estimation output.
Comments
Calls OutputHeader, OutputPar, OutputLogLik

Modelbase::OutputHeader(const sTitle)
Prints the header.
Parameters
sTitle string title of header

Modelbase::OutputLogLik()
Prints the loglikelihood and related statistics.

Modelbase::OutputMax(const sMethod, const iResult, const vPstart, const bNumerical)
Prints the maximization settings used.
Parameters
sMethod string, maximization method
iResult int, maximization result
vPstart vector with starting values (or <> to skip)
bNumerical int, {\tt TRUE} if using numerical derivatives

Modelbase::OutputPar()
Prints estimated parameters.

static Modelbase::PrintTestVal(const dTest, const cR, const cTdf, const sLabel)
Prints a test statistic and its significance.
Parameters
dTest test statistic
cR first degrees of freedom
cTdf second degrees of freedom (0 for chi^2, otherwise F-distribution)
sLabel name of test\\

virtual Modelbase::ReceiveData()
Called by OxPack to let the object receive the data; the object will ask for the data in this function and store it in the underlying database.

virtual Modelbase::ReceiveMenuChoice(const sDialog)
Called by OxPack to let the object receive the menu choice; the object can then perform the requested action.
Parameters
sMenu string, menu identifier label
Returns
1 if successful

virtual Modelbase::ReceiveModel()
Called by OxPack to let the object receive the model specification; the object will ask for the model in this function and store the selection in the underlying database.

Modelbase::ResetFixedPar()
Reset the values of the fixed parameters.

virtual Modelbase::SaveOptions()
Used by OxPack to store the options in persistent storage.

Modelbase::Select(const theGroup, const aSel)
Select variables by name into a group.
Parameters
followed by start_lag, end_lag (e.g. {"CONS",0,3, "Constant", "INC",0,1}
theGroup int or string, group identifier (e.g. "Y" or PcGive::Y_VAR)
aSel array of variable names, each optionally
Comments
Invalidates the selection sample. Also calls ClearModel

Modelbase::SelectByIndex(const theGroup, const iVar, const iLag0, const iLag1)
Select variables by name into a group.
Parameters
theGroup int or string, group identifier (e.g. "Y" or PcGive::Y_VAR)
iVar int or vector[k] column index or indices
iLag0 common start lag or vector[k] with starting lag lengths
iLag1 common end lag or vector[k] with ending lag lengths
Comments
Invalidates the selection sample. Also calls ClearModel

virtual Modelbase::SendFunctions()
Sends functions to dialog (used by DPD, e.g.).

virtual Modelbase::SendMenu(const sMenu)
Sends a menu specification to OxPack.
Parameters
sMenu string: "Model" or "Test" menu.

virtual Modelbase::SendSpecials()
Sends the names of special variables to OxPack for batch code.
Comments
Also used by DoFormulateDlg

virtual Modelbase::SendVarStatus()
Sends the specification of variable status types to OxPack for batch code.
Comments
Also used by DoFormulateDlg

virtual Modelbase::SetForecasts(const cForc, const bIsLessForecasts)
Set the number of forecasts.
Parameters
the estimation sample is unaffected.
cForc sets the number of forecasts
bIsLessForecasts TRUE: the estimation sample is reduced by the number of forecasts, FALSE:

Modelbase::SetFreePar(const vParFree)
Set the free parameters.
Parameters
vParFree p x 1 vector with free parameter values.

virtual Modelbase::SetMethod(const iMethod)
Sets the estimation method.
Parameters
theMethod int or string with estimation method

virtual Modelbase::SetModelSettings(const aValues)
Called by OxPack to update the estimation settings in the object.
Parameters
aValues array[] with {value, label} pairs.

Modelbase::SetModelStatus(const iModelStatus)
Sets the model status.
Parameters
iModelStatus, one of: MS_NONE, MS_DATA, MS_PARAMS, MS_ESTIMATED, MS_EST_FAILED

Modelbase::SetPar(const vPar)
Sets the parameter values (free and fixed) .
Parameters
vPar qx1 vector with parameter values (both fixed and free)
Comments
Also sets the parameter count if this is still zero.

Modelbase::SetParCount(const cPar, ...)
Set the number of parameters q (including fixed parameters).
Parameters
cPar int, parameter count
bAdd (optional) TRUE: add parameters to current count; else set the count.
Comments
Must be called as part of the estimation procedure.

Modelbase::SetPrint( fPrint)
Switches printing on or off.
Parameters
fPrint TRUE or FALSE

virtual Modelbase::SetRecursive(const bSet, const cInit)
Set the number of recursive steps to initiate recursive estimation.
Parameters
bSet True or FALSE
cInit int, initial observations for recursive estimation

Modelbase::SetResult(const iResult)
Sets the result of estimation.
Parameters
iResult int, usually result of MaxBFGS

Modelbase::SetSelDates(const iYear1, const iMonth1, const iDay1, const iYear2, const iMonth2, const iDay2)
Select a sample by year, month, day.
Parameters
iYear1 int, start year of selection
iMonth1 int, start month of selection
iDay1 int, start day of selection
iYear2 int, end year of selection
iMonth2 int, end month of selection
iDay2 int, end day of selection
Returns
Number of observations in the sample.
Comments
Also calls ClearModel

Modelbase::SetSelSample(const iYear1, const iPeriod1, const iYear2, const iPeriod2)
Select a sample (fixed frequency).
Parameters
iYear1 int, start year of selection, use -1 for earliest year and period
iPeriod1 int, start period of selection
iYear2 int, end year of selection, use -1 for latest year and period
iPeriod2 int, end period of selection
Returns
Number of observations in the sample.
Comments
Also calls ClearModel

Modelbase::SetSelSampleByDates(const dDate1, const dDate2)
Select a sample by date values.
Parameters
dDate1 date value, start date
dDate2 date value, end date
Returns
Number of observations in the sample.
Comments
Also calls ClearModel

virtual Modelbase::SetStartPar(const vParFree)
Set the starting values.
Returns
TRUE if successful
Comments
CallsInitPar, then sets the free parameters as specified.

Modelbase::SetVarEx(const mNew, const asNew, const iToffset=0, const viTindex=<>, const iPrint=0)
Sets variable(s) in the database, used to store estimation results or forecasts.
Parameters
mNew matrix[][k]
asNew string or array[k] of strings.
iToffset (optional) first index in database to store to (default is 0).
viTindex (optional) database observation indices to store to (default is <>).
iPrint (optional) prints information about the action (default is 0).
Comments
If the variable already exists, then observations outside the sample are not changed (unlike SetVar). If necessary, the database is extended to accomodate the observations (like SetVar).

static Modelbase::ShowBanner(const bSet)
Switch off/on printing of startup banner.

virtual Modelbase::StoreEstimates(const mX, const asX, const iPrint=0)
Stores estimation results, taking the estimation sample into account.
Parameters
mX matrix[T][k] with estimation results (e.g. residuals)
asX array[k] with names
iPrint prints storage report (default 0)
Comments
Results are stored from m_iT1est onwards, unless m_viTindex is set, in which case they are stored for all observations in the estimation sample. Uses SetVarEx

virtual Modelbase::StoreForecasts(const mX, const asX, const iPrint=0)
Stores forecasts, taking the estimation sample into account.
Parameters
mX matrix[T][k] with forecasts
asX array[k] with names
iPrint prints storage report (default 0)
Comments
Forecasts are stored from m_iT2est + 1 onwards (i.e. immediately following the estimation sample), unless m_viTindex is set, in which case they are stored for all observations <em>not</em> in the estimation sample. Uses SetVarEx

virtual Modelbase::TestRestrictions( mR, ...)
Tests a linear restriction.
Parameters
of free parameters that are set to zero in the test, or a vector of free parameter indices. linear restrictions and vR an sx1 or 1xs vector with values to which the restrictions should add. Unless vR==1 in which case the tests are on the longrun.
mR with this the only argument: an array of strings with names
vR (optional) if this argument is given, mR is an sxp matrix with
sGenRes (optional), string with general restrictions
Returns
Comments
GetFreeParNames, GetFreePar GetCovar

EvalTestRestrictions(const sResTestCode, const cP, const asMsg, const avResMap, const amResJac)