[ PcGive home | Index ]

CATS.oxh

CATS : Modelbase : Database : Sample class reference

CATS function members (public by default)
 ACTest_LB(const mResid, iOrder=0)
 Computes the Ljung-Box autocorrelation statistic.
virtual ACTest_LM(const mResid, const iOrder=1)
 Performs the LM test for autocorrelation.
static ARCHStats(const mResid, const iOrder=1)
 Univariate ARCH statistics.
static ARCHTest(const mResid, const iOrder=1)
 Multivariate ARCH test, Luetkepohl, 2004.
static AlphaBetaStart(const mAlpha, const mBeta, const amG, const amH, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const cInitSteps=2, const aAnalysis=<>)
 Get starting values for alpha,beta switching I(1) algorithm using GLS.
static AlphaBetaStartAnalysis(const mAlpha, const mBeta, const amG, const amH)
 Get starting values for alpha,beta switching I(1) algorithm using GLS.
static AlphaBetaStartSearch(const mAlpha0, const mBeta0, const fnAlphaBetaStart, const fnEstimate, const cStart, const mxStartIt, const iInfo, const bTrace=FALSE)
 
static AlphaBetaSwitching(const mAlpha, const mBeta, const amG, const amH, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const iLineSearch=2)
 Alpha, beta switching algorithm for estimating restricted Alpha and Beta vectors in the I(1)-model.
static AlphaKnown(const mA, const mBeta1, const mS00, const mS01, const mS11)
 Estimate under the restriction H0: Alpha = (G,G_orthogonal*Psi) where G is a known matrix
static ApplyColumnScale(const mA, const mB, const mC, const vNormRow)
 Applies a normalization to columns of a matrix, As*Bs = (A .* v)(B ./ v) = AB.
static ApplyColumnScaleVec( vP, const cAlpha, amG, const vOldScale, const bApply=TRUE)
 Apply/remove the scale transformation to theta or phi in vP
static AutoIdentify1( amH, const iR, const abIsIdentified)
 Automatic identification of the cointegration space.
static AutoIdentify2(const amH, const iR, const abIsIdentified)
 Automatic identification of the cointegration space.
static BartlettBeta(const iS, const iType, const mAlpha, const mBeta, const iRank, fnGetGamma, const mS00, const cT, const iDetTrend, const cSeas, const iMethod=0)
 Calculates the Bartlett correction factor for tests on the cointegrating relations.
static BartlettRank(const mAlpha, const mBeta, const iRank, fnGetGamma, const mS00, const cT, const iDetTrend, const bWarn=TRUE, const iMethod=0)
 Calculates the rank test Bartlett small sample correction of Johansen (2002) given the rank of Pi.
static Bartlett_c2(const mP, const mVpsi, const iMethod=0)
 Four methods to compute c_2: direct, summation, very large matrices, approximate.
static BetaStdErrors( amH, const viNorm, const mSM1, const cT)
 Calculates the asymptotic standard errors of beta for the I(1) model if the restrictions identify beta.
static BetaStdErrors_DiagH( amH, const viNorm)
 Calculates the DiagCat(amH) with normalization columns removed.
static BetaSwitching(const mG, const amH, const vVpg, const mBeta, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
 Switching algorithm for estimating restricted Beta vectors in the I(1)-model.
static BlockInvHess(const mHessian, const aSizes)
 Creates an array of matrices with minus the inverse of diagonal blocks of a matrix.
 BootstrapRankTest( cB=399, const iType=0)
 Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
 BootstrapRestrictions( cB=199, const iType=0)
 Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
 CATS()
 Constructor, requires Ox 8.0 or newer.
 CATSminingSearch(const amRes, const bFixDet=TRUE, const iHomogenize=2, const dP1=0.05, const dP2=0.25)
 Finds restrictions on a cointegrating vector.
 CATSminingSelect(const amRes, const dP2=0.05, const dP4=0.05, const mxDepth=20)
 Selects from a set of possible cointegrating vectors.
static CheckConvergence(const dLogdet, const dLogdetPrev, const mPi, const mPiPrev, const dCrit, const iMaxIt, const iInfo, const iItno, mIterInfo=<>, const dStep=1, const bForceTerminate=FALSE)
 Checks convergence of switching algorithms based on relative
 CheckEstimated()
 Generates a run-time error if the unrestricted reduced rank model has not been estimated.
static CheckRestrictions(const sH, amH, const cRows, const iR, vVpg=<>, const bNeedRmatrices=TRUE)
 Check restrictions matrices (if any); if possible supply missing items.
static ClassifyDummies(const mR, const mDR)
 
static ColCat(const amA)
 Concatenates an array of matrices along the columns.
 CompanionRoots()
 Prints the roots of the companion matrix based on the current model.
virtual Covar()
 
static DecLQ(const mA)
 LQ decomposition
static DecQL(const mA)
 QL decomposition
static DecQRt(const mA)
 QR decomposition
static DiagCat(const amA)
 Concatenates an array of matrices along the diagonal.
virtual DoAutoOutput()
 Adds to the standard output (does nothing here).
 DoBartlettBetaFactor(const amH)
 Check if the restrictions on beta are such that the Bartlett correction can be applied.
 DoCompute(const iDo)
 Specify default computations and tabulations.
virtual DoEstimation( vPar)
 Estimates the model (called by `Modelbase::Estimate`).
static DoGetCompanion(const mAlpha, const mBeta, const mGamma_i, const amRoots)
 Returns the companion matrix based on the specified coefficients, optionally with roots.
 DoI1RankTable(const dAlpha=0.05, const bDoBartlett=TRUE)
 Computes the table of the I(1)-analysis.
 DoI1Residuals(const mPi)
 Computes the residuals of the I(1) model.
virtual DoMoments()
 Creates the QR transformations that are needed for estimation.
static DoRestrictAlphaBeta(const mAlpha0, const mBeta0, const amG, const amH, const bWithStandardErrors, const vNormBeta, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const dBFGSCrit, const iMaxItBFGS, const iSwitchOptions=0, const cStartSearch=20)
 
 DoSetI1Rank(const iR)
 Sets the cointegrating rank of Pi to r, 0 <= r <= n, after estimating the VAR.
 DoUpdateEstimates_I1(const mAlpha, const mBeta, dLogDet=.NaN, const viNorm=<>)
 Updates the model estimates with (restricted) alpha, beta, Omega.
 DoUpdateRestrictedSettings(const amG, const amH, const vVpg, const iAlphaFlag, const iBetaFlag, const cResCount, const sResType=0)
 Store the settings for restricted estimation.
 DropDiffLags(const vDropLags, const vDropLagsExo=<>)
 Drop lagged differences in the ECM representation of the VAR.
static ECMToVAR(const mPi, const mGammas)
 Translates the ECM coefficients to the VAR coefficients.
static Eigen(const ma, const amval, const amvec=0)
 As Ox eigen function, except that it always includes the imaginary part.
virtual EstimateAlphaBeta( amG, amH, const vNormBetaOvr=<>)
 Estimates the model using alpha-beta switching but doesn't make it the current model.
static FixRank(const mHj, const mRj, const mH, const iTargetRank)
 Used for the automatic Beta-space identification scheme.
static GammaApprox_I1(const dTstat, const iType, const dQuantile, const iDetTrend, const iP, const iR, const iDimX1, const iS=0, const cSD=0, const viSDDate=<>)
 Procedure for calculating the approximate p-values and quantiles of
static GammaApprox_I2(const dTstat, const iType, const dQuantile, const iDetTrend, const iP, const iR, const iDimX1, const iS=0, const cSD=0, const viSDDate=<>)
 Procedure for calculating the approximate p-values and quantiles of
 GenerateAsY(const mEps, const mAlpha, const mBeta, const mGams, const mPsi)
 Generates a random sample formulated as the current I(1) model, but with specified coefficients.
static GenerateECM(const cT, const iDet, const mAlpha, const mBeta, const mGams, const mPsi, const mOmegaSqrt=<>, const mYinit=<>, const mYmean=<>)
 
virtual GenerateY( mEps=<>)
 Generates a random sample from the current model.
 GetAlpha()
 Gets current alpha.
 GetAlphaSe()
 Gets standard errors of current alpha.
 GetAlphaVAR()
 Gets alpha for the full rank VAR.
static GetBar(const mA)
 returns A_bar.
 GetBeta()
 Gets current beta.
 GetBetaSe()
 Gets standard errors of current beta.
 GetBetaVAR()
 Gets beta for the full rank VAR.
static GetColumnScale(const mB, const cRows=0)
 Finds a row elements for each column to normalize a matrix.
virtual GetCompanion(const amRoots=0)
 Returns the companion matrix based on the current model, optionally with roots.
virtual GetDimensions(const sType="")
 Get model dimensions.
 GetEval()
 Gets the eigenvalues.
 GetGammaFrom(const mAlpha, const mBeta)
 Gets the current Gamma matrix (coefficient of lagged second difference) in the same format as the I(2) model.
 GetGamsInArray(const mAlpha, const mBeta)
 Calculates the Gamma_i matrices (coefficient of lagged differences) based on the alpha and beta.
virtual GetGroupLabels()
 
static GetInvertibleSubMatrix(const mB, const viNorm=<>)
 Finds a unique row elements for each column to rotate a matrix.
 GetLags()
 Returns the lag length of the dependent variables.
 GetLambdaXiSe()
 Computes standard errors of transformed eigenvalues and their sum.
 GetLogLikUnr()
 Gets the log-likelihood of the unrestricted model (except for the rank-restrictions).
 GetLogLikVAR()
 Gets the log-likelihood of the unrestricted VAR.
 GetMARep()
 Calculates and returns the matrices of the moving average representation.
 GetMaxMethodInfo()
 Gets the maximization method info.
 GetMaxMethodName()
 Gets the maximization method name.
 GetMethodLabel()
 Gets method label.
virtual GetMethodLabels()
 
 GetModelLabel()
 Gets model label.
 GetOmega()
 Gets current residual variance matrix Omega.
virtual GetPackageName()
 Gets the package name.
virtual GetPackageVersion()
 Gets the package version.
virtual GetParNames()
 Gets the names of the parameters.
 GetPi()
 Gets current Pi.
 GetPiSe()
 Gets standard errors of current Pi.
virtual GetRegsLongRun(const fCorrected=TRUE)
 Gets the long-run regressors, optionally corrected for the short-run regressors.
virtual GetResVar()
 Gets current residual variance matrix Omega.
 GetResiduals()
 Gets the residuals.
virtual GetS00()
 Gets S_{00}.
 GetSeasonals()
 
 GetTraceTest()
 Gets the trace-test statistics.
 GetTrend()
 
virtual GetUNames()
 Gets the names of the U variables.
virtual GetXNames()
 Gets the names of the X variables.
virtual GetYNames()
 
virtual GetZ0()
 Gets Z_0, the differenced Y.
virtual GetZ0Names()
 Gets the names of Z_0, the differenced Y.
virtual GetZ1()
 Gets Z1, the long-run regressors.
virtual GetZ2()
 Gets Z2, the short-run regressors.
virtual GetZ3()
 Gets Z3 which is empty in the I(1) model.
virtual GetcDfLoss()
 Degrees of freedom lost (no of estimated parameters).
virtual GraphicAnalysis(const iPlot=0, const bActualFitted=FALSE, const bActualFittedCross=FALSE, const iResiduals=2, const iCointegration=2, const iAcf=1, const iAcfLag=-1, const iDensity=0, const iRootsPlot=0, const iLevelsPlot=0, const iEqn=-1)
 Graphical analysis.
virtual I1Rank(const iR)
 Sets the cointegrating rank r and forces re-estimation of the CVAR.
 I1RankTable(const bDoBartlett=TRUE)
 Computes and prints the default I(1) rank test table.
 Init()
 Reset the transitory properties.
virtual InitData()
 Checks the model formulation and creates the data matrices.
virtual InitPar()
 Initialize the model parameters
static InsertFixedPhiInPar(const vP, const cAlpha, const vDroppedPhi)
 Reinserts the normalizations that are not in the parameter vector
static InvertSymQR(const mA, const pdLogLik=0)
 Returns the inverse of symmetric p.d. matrix.
virtual IsI2()
 Checks if this is an I(2) model
virtual IsIdentified()
 Get identification status.
static IsIdentifying(const amH, const bFull=FALSE)
 Tests if the r matrices H_i generically identify an r-dimensional space.
static IsIdentifyingJac(const mAlpha, const mBeta, const amG, const amH, const vDroppedPhi, const cPar)
 Tests if the G and H matrices identify the cointegrating space using the Jacobian criterion.
 IsOutsideCircle()
 Checks if the current model is inside the circle using the current radius.
virtual IsUnivariate()
 
static JacLinResBeta(const amH, const vDroppedPhi)
 Jacobian of linear restrictions on beta (optionally identified by fixing an element of each phi).
 Lags(const lags, const lagsExo=-1, const lagsDet=-1)
 Set the lag length of the dependent variables in the VAR.
static LineSearch(const vP, const vPprev, const vP0, const dF, const dFprev, const fnLogLik, const vStepGridUp, const vStepGridDown, cStages)
 Line search algorithm for switching.
 LogDetFromLogLik(const dLogLik)
 Translates the log-likelihood to log|Omega|.
 LogLikFromLogDet(const dLogDet)
 Translates log|Omega| to the log-likelihood.
static LogdetI1Model(const mAlpha, const mBeta, const cAlpha, const cBeta, const adFunc, const avScore, const amHessian, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const amG, const amH, const vDroppedPhi, const mJacA, const mJacB, const bAsymp=FALSE)
 Evaluates the scaled log-likelihood of the restricted I(1) model.
static LogdetSymQR(const mA)
 Returns the log determinant of a symmetric p.d. matrix.
virtual MARep()
 Prints the matrices of the moving average representation.
static MapParToAlphaBeta( vP, const cAlpha, const amG, const amH, const vDroppedPhi=<>)
 Maps the unrestricted (free) parameters back to alpha and beta using the specified restrictions.
static MapScoreToAlphaBeta(const mDloglikDpi, const mAlpha, const mBeta, const cAlpha, const cBeta, const amG, const amH, const vDroppedPhi)
 Maps the score of the scaled log-likelihood of the restricted I(1) model
static MapToPar(const mB, const amH)
 Maps the free parameters in A to a column vector using the specified restrictions.
static MapVarToAlphaBetaPiSE(const mAlpha, const mBeta, const mMaa, const mMbb, const mJacA, const mJacB)
 Maps the unrestricted (unscaled) variance matrices of the free parameters to
 MaxControl(const iMaxIt=10000, const iInfo=1000)
 Sets maximum iterations and output level for switching.
 MaxControlEps(const dSwitchCrit=1e-9, const dBFGSCrit=1e-5)
 Sets the convergence criterion for switching
 MaxOptions(const iHybridInit=-1, const iOptions=-1, const cStartSearch=20)
 Sets options for switching.
static NormalizePhiInPar( vP, const cBefore, const vDim, const dCutOff=0, const vNormIdxP=<>)
 Normalize the unrestricted (free) parameters in beta, adjusting alpha accordingly.
static NormalizeThetaPhiInPar( vP, const cAlpha, const amG, const amH, const bApply=FALSE, const vNormBeta=<>)
 Normalize the unrestricted (free) parameters in beta, adjusting alpha accordingly.
static Nullspace(const mA)
 Returns the orthogonal complement (null space) of a matrix.
virtual Output()
 Prints the estimated the model (called by `Modelbase::Estimate`).
 OutputBootstrapHeader(const sTitle, const cB, const iType, const time=0)
 Prints header of bootstraps report.
 OutputHeader(const sTitle, const asR, const asX)
 Prints the estimated the model (called by `CATS::Output`).
 OutputLogLik(const sExtra="")
 Prints the log-likelihood and dimensions.
virtual OutputOutliers( dSE)
 
 OutputRestrictionsTest()
 Prints the log-likelihood and dimensions.
static PartialMoments(const mY, const mX, const cT=-1, const fWarn=0, const amPi=0)
 Returns (R'R)/T where R are the residuals of regressing Y on X.
 PrintAlphaBeta(const mAlpha, const mBeta, const mAlphaSe, const mBetaSe, const asY, const mPiSe=<>, const bPiPrint=0)
 Writes the beta, alpha and Pi matrices and t-values (or standard errors).
 PrintDeterministics()
 Prints the Deterministic specification.
 PrintI1Rank(const sExtra="")
 Prints the estimates for the current rank.
 PrintI1RankTable(const mTable, const dAlpha, const sHeader, const sFooter="", asTraceAlt=0)
 Prints the table of the I(1)-analysis.
static PrintMat( mA, const mSE, const asRow, const asCol, const asOptions="")
 Prints a matrix with standard errors.
static ProjectOntoH(const mBeta, const amH, const bIsIdentified=TRUE, const vVpg=<>)
 Unrestricted vectors are projected onto H matrices.
static ProjectOntoH_reg(const mBeta, const amH)
 
static RROlsQ( mQtY, mQtX, const mQtYsq, const cT, const cR, const mQtZ=<>, const aGamma=0)
 Reduced rank regression of Y on X corrected for Z when Q'Y,Q'Z,Q'Z are already available.
static RROlsQ2( mQtY, mQtX, const mQtYsq, const cT, const cR, const mQtZ=<>, const aGamma=0)
 
static RanBootstrap(const mResiduals, const iType=0)
 
static RankOrder(const mA)
 Obtains the rank order of a matrix.
virtual RecursiveAnalysis(const iPlot=0, const cTMin=0, const bEval=FALSE, const bXi=TRUE, const bTrace=TRUE, const bLogLik=TRUE, const bAlpha=FALSE, const bBeta=FALSE, const bFixShortRun=FALSE, bApproxXiSe=TRUE)
 Recursive estimation.
 RenewY(const mY)
 Replaces the Y estimation data in the underlying database with the specified random sample.
 ResidualAnalysis()
 Prints multivariate and unvariate analysis of the estimated residuals.
virtual Restrict(const amRes, const vNormBetaOvr=<>)
 Estimates the model and prints results for the current rank imposing restrictions on alpha and beta using alpha-beta switching.
virtual RestrictAlphaBeta( amG, amH, const vNormBetaOvr=<>)
 Estimates the model and prints results for the current rank imposing restrictions on alpha and beta using alpha-beta switching.
 RestrictBeta( amG, amH, vVpg=<>)
 Estimates the model for the current rank imposing restrictions on alpha and beta using beta switching.
static RowCat(const amA)
 Concatenates an array of matrices along the rows.
 Seasonals(const iUse=1)
 
 SetAlphaBetaI1Start(const mAlpha, const mBeta)
 Sets current I(1) alpha,beta initial values for the starting value procedures.
static SetMaths(const iMaths, const sLabel)
 Sets the labels of mathematics symbols.
 SetMaxMethodInfo(const sName, const aInfo=<>)
 Sets the name of the maximization method.
 SetNormalization(const bSet)
 Sets default normalization mode.
 SetPrintMatOptions(const asOptions, const iAdd=0)
 Sets the options for `CATS::PrintMat`.
 SetRadius(const dRadius=1.00001)
 Sets the radius of 'unit' circle (default is 1.00001).
static SetTrackProgress(const bTrack)
 Sets progress tracking of iterative maximizers.
 SetUseDefaultSeed(const bSet)
 Sets usage of default seed for simulations and bootstraps on (TRUE) or off (FALSE, default setting).
 ShortRun()
 Prints the short-run coefficients.
 ShortRunEval(const mAlpha=0, const mBeta=0, const mOmega=0, const bDoStdDev=FALSE)
 Calculates the shortrun coefficients of the current model.
virtual ShrinkSample(const cDrop, const cTmin=1, const bFixShortRun=FALSE)
 Shrinks the estimation sample, but doesn't re-estimate yet.
 SimulateRankDet(const cTsim, const bPrint)
 Simulates and reports the asymptotic distribution of the I(1) rank test in the
 SimulateRankTest(const cTsim=400, const cM=1000)
 Simulates and reports the asymptotic distribution of the I(1) rank test in the
static SolveRRR(const mS00, const mS01, const mS11, const amEigVal, const amEigVec, const cR=-1)
 Solves the I(1) pencil |\lambda S_{11} - S_{10}S_{00}^{-1}S_{01}|.
static SplitRestrictions(const asRes, const asSections, const aaH1, ...)
 Split restrictions array by sections.
static StatComp(const mAlpha, mBeta, const amGamma, const iLags, const mS00, const amP, const amQ)
 Creates the companion matrix P and the matrix Q for the stationary process Y(t).
 TestAlphaCommon( mG)
 Tests restricted alpha, where alpha = (G*theta_1,theta_2) and G is a known matrix.
 TestAlphaKnown(const mG)
 Tests restricted alpha, where alpha = (G,G_orthogonal psi) and G is a known matrix.
static TestDiff(const x, const y)
 Computes a scaled norm of the difference of two vectors.
virtual TestEach(const bAlpha=TRUE, const bBeta=TRUE)
 Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
virtual TestEachAllRanks(const bAlpha=TRUE, const bBeta=TRUE)
 Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
 TestEachBetaRestriction( fnGetG, fnGetH, const vVpg, const asZ, const cRes, const sType)
 Tests similar restrictions over a range of elements using beta switching.
virtual TestForecastGraphics(const bExp)
 
virtual TestGraphicAnalysis()
 Plots residuals and ACF.
static TestRanksAndFix(const amH, const amR, const vIndex, const amHnew, const amRnew)
 Used for the automatic Beta-space identification scheme.
virtual TestSummary()
 
 Trend( mode)
 Specifies the trending behaviour of the model.

CATS data members (protected by default)
 m_asA
 
 m_iAFlag
 
 m_asAlpha
 
 m_mAlpha
 
 m_mAlpha_I1
 
 m_mAlpha_VAR
 
 m_mAlphaSE
 
 m_asB
 
 m_dBartletBetaCorr
 
 m_asBeta
 
 m_mBeta
 
 m_mBeta_I1
 
 m_mBeta_VAR
 
 m_mBetaSE
 
 m_dBFGSCrit
 
 m_iBFlag
 
 m_iDetTrend
 
 m_asDetTrend
 
 m_iDoCompute
 
 m_vDYLagSel
 
 m_vEigVal
 
 m_amG
 
 m_amH
 
 m_iIFlag
 
 m_cLags
 
 m_cLagsDet
 
 m_cLagsExo
 
 m_dLogLik_I1
 
 m_dLogLik_Unr
 
 m_dLogLik_VAR
 
static sm_asMaths
 
 m_aMaxMethodInfo
 
 m_sMaxMethodName
 
 m_asMethods
 
 m_iModel
 
 m_iModelClass
 
 m_bNormalizeOnAlpha
 
 m_viNormBeta
 
static sm_dNormCrit
 
 m_mOmega
 
 m_mOmega_I1
 
 m_mPiSE
 
 m_asPrintMatOptions
 
 m_mQtZ0_Z2
 
 m_mQtZ0sq_Z2
 
 m_mQtZ1_Z2
 
 m_iR
 
 m_iR_preset
 
 m_dRadius
 
 m_cResCount
 
 m_mResidual
 
 m_sResType
 
 m_mS00
 
 m_dS00logdet
 
 m_mS01
 
 m_mS11
 
 m_iSeasType
 
 m_mSigmaBB
 
 m_cStartSearch
 
 m_dSwitchCrit
 
 m_mxSwitchIter
 
 m_mxSwitchIter_BFGSstep
 
 m_iSwitchOptions
 
 m_iSwitchPrint
 
 m_vTestOrders
 
 m_sTexOutput
 
static sm_bTrackProgress
 
static sm_asTrend
 
 m_cU
 
 m_mU
 
 m_asU
 
 m_bUseDefaultSeed
 
 m_vVpg
 
 m_asX
 
 m_cX1
 
 m_cX2
 
 m_vXIndex
 
 m_mXlag
 
 m_vXType
 
 m_asY
 
 m_mYlag
 
 m_cZ0
 
 m_mZ0
 
 m_asZ0
 
 m_mZ0_Z2
 
 m_asZ1
 
 m_mZ1
 
 m_cZ1
 
 m_mZ1_Z2
 
 m_cZ2
 
 m_asZ2
 
 m_mZ2
 
 m_cZ2RegCount
 

CATS enum members (protected by default)
 {ALPHA_NONE, ALPHA_EACH, ALPHA_SAME}
 Type of restriction on beta.
 {BETA_NONE, BETA_EACH, BETA_SAME}
 Type of restriction on beta.
 {XTYPE_EXOG, XTYPE_DETERMINISTIC, XTYPE_D_IMPULSE, XTYPE_D_STEP, XTYPE_D_TREND, XTYPE_D_OTHER}
 Type of X variable.
 {NO_BREAK, LEVEL_BREAK, TREND_BREAK}
 Break options
 {I1, I2}
 model class
 {MAX_ITERATING, MAX_INITIALIZING}
 maximizattion extension
public:{Y_VAR, X_VAR, U_VAR, R_VAR, SEL_VAR, A_VAR}
 variable types for model specification
public:{M_NONE, M_OLS, M_RRR}
 estimators
public:{NONE, CIMEAN, DRIFT, CIDRIFT}
 deterministic specifications
public:{SW_UNUSED, SW_NO_INIT, SW_NO_RANDOMINIT, SW_SWITCH_ONLY, SW_NO_BFGS, SW_NO_LINESEARCH, SW_LINESEARCH_1, SW_LINESEARCH_1NEG, SW_LINESEARCH_ALT, SW_LINESEARCH_OPT}
 Switching options, not normally used; can be added together
public:{RANKTEST_TRACE, RANKTEST_LMAX, RANKTEST_BREAK}
 Type of test for cointegration rank, used in GammaApprox
public:{DO_BARTLETT, DO_BOOTSTRAP, DO_SKIPTABLE}
 Optional actions to do automatically, set by `CATS::DoCompute`
public:{BS_WILD, BS_IID, BS_SIGN, BS_PARAMETRIC, BS_JAD, BS_JAD2}
 Bootstrap sampling schemes
public:{MATHS_alpha, MATHS_beta, MATHS_tau, MATHS_phi, MATHS_psi, MATHS_Gamma, MATHS_Phi, MATHS_Pi, MATHS_Psi, MATHS_Omega, MATHS_zeta, MATHS_delta, MATHS_dee, MATHS_ee}
 Index for matrix label

CATSI2 : CATS : Modelbase : Database : Sample class reference

CATSI2 function members (public by default)
virtual ACTest_LM(const mResid, const iOrder=1)
 Performs the LM test for autocorrelation in an I(2) model.
 BootstrapRankTest( cB=399, const iType=0)
 Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
 CATSI2()
 Constructor.
static DeltaSwitching(const mAlpha, const mBeta, const amH, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
 Delta-switching algorithm for the I(2)-model.
 DoDeltaSwitching(const mAlpha, const mBeta, const amH=<>, const viNorm=<>)
 Estimation using delta-switching algorithm for ML-estimation of the I(2)-model.
 DoDeltaSwitchingLogLik(const mAlpha, const mBeta, const iS1)
 As `CATSI2::DoDeltaSwitching` but without setting estimates, only returning the log-likelihood, alpha and beta.
virtual DoEstimation( vPar)
 Estimates the model (called by `Modelbase::Estimate`).
 DoI2RankTable(const dAlpha=0.05, const iDoMLE=1)
 Computes the table of the I(1)-analysis.
 DoI2RankTable_2step()
 Computes the table of the I(1)-analysis using two-step estimation.
 DoI2Residuals(const mPi, const mGamma)
 Computes the residuals of the I(2) model z0_t = Pi z1_t - Gamma z2_t + rest.
virtual DoMoments()
 Partials out z3 and creates the transformed data matrices QZi that are needed for estimation.
 DoRestrictAlphaBeta( amA, amH, const vNormBetaOvr, bSetZeroV13, const dCrit, const iMaxIt, const iInfo, const dBFGSCrit, const iMaxItBFGS, const iSwitchOptions=0, const cStartSearch=20)
 Estimates the model and prints results for the current rank imposing restrictions on alpha and beta.
 DoSetI2Rank(const iS, const iTriangular=-1)
 Sets the I(2) to s==s1, 0 <= s <= p-r, after estimating the VAR.
 DoTauSwitching(const mAlpha, const mBeta, const mH=<>)
 Estimation using tau-switching algorithm for ML-estimation of the I(2)-model.
 DoTauSwitchingLogLik(const mAlpha, const mBeta, const iS1)
 As `CATSI2::DoTauSwitching` but without setting estimates, only returning the log-likelihood, alpha and beta.
 DoTriSwitching(const mAlpha=<>, const mBeta=<>)
 Estimation using triangular-switching algorithm for ML-estimation of the I(2)-model without restrictions on A,B.
 DoTriSwitchingLogLik(const mAlpha, const mBeta, const iS1)
 As `CATSI2::DoTriSwitching` but without setting estimates, only returning the log-likelihood, alpha and beta.
 DoUpdateEstimates_I2(const mAlpha, const mTau, const mRho, const mPsi, const mKappa, const mWterm, const mOmega, const dLogDet, viNorm=<>)
 Updates the I(2) model after estimation.
 DoUpdateEstimates_I2_AB(const mA, const mB, const mV, const iR, const iS1, const dLogDet, const vNorm=<>)
 Updates the I(2) model after estimation.
virtual EstimateAlphaBeta( amG, amH, const vNormBetaOvr=<>, bSetZeroV13=FALSE)
 Estimates the model using triangular switching but doesn't make it the current model.
 EstimateTau( mH)
 Test the **same** linear restrictions on all Tau vectors.
 EvalBetaSe()
 Computes standard errors of current beta, psi, dee.
 GenerateAsY_I2(const mEps, const mAlpha, const mBeta, const mGamma, const mPsis, const mPhi)
 Generates a random sample formulated as the current I(2) model, but with specified coefficients.
static GenerateECM_I2(const cT, const iDet, const mAlpha, const mBeta, const mGamma, const mPsis=<>, const mPhi=<>, const mOmegaSqrt=<>, const mYinit=<>, const mYmean=<>)
 
virtual GenerateY( mEps=<>)
 Generates a random sample from the current model.
 GetAWithSe()
 Gets A with standard errors.
 GetAlphaOrt1WithSe()
 Calculates the alpha_ort1 with asymptotic standard errors.
 GetAlphaOrt2WithSe(const viNorm=<>)
 Calculates the alpha_ort2 with asymptotic standard errors.
 GetBWithSe()
 Gets B with standard errors.
 GetBetaSe()
 Gets standard errors of current beta.
virtual GetCompanion(const amRoots=0)
 Returns the companion matrix based on the current model, optionally with roots.
 GetDeeEe()
 Gets the current dee and ee matrices.
static GetDeeEeFrom(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)
 
 GetDeeEeSe()
 Gets standard errors of current dee and ee.
 GetDeltaZeta()
 Gets the current delta and zeta matrices.
static GetDeltaZetaFrom(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)
 
 GetDeltaZetaSe()
 Gets standard errors of current delta and zeta.
virtual GetDimensions(const sType="")
 Get model dimensions.
 GetGamma()
 Gets the current Gamma matrix (coefficient of lagged second difference).
static GetGammaFrom_I2(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)
 Gets the Gamma matrix from tau, psi, kappa and w.
 GetPsiKappa()
 Gets the current psi and kappa matrices.
static GetPsiKappaFrom(const mAlpha, const mTau, const mGamma, const mOmega)
 
 GetPsiKappaSe()
 Gets standard errors of current psi and kappa.
virtual GetRegsLongRun(const fCorrected=TRUE)
 Gets the long-run regressors, optionally corrected for the short-run regressors.
virtual GetRegsMediumRun(const fCorrected=TRUE)
 Gets the medium-run regressors, optionally corrected for the short-run regressors.
 GetTheta()
 Gets the current Theta matrix
static GetTriFrom(const mAlpha0, const mBeta0, const mGamma0, const iS1, const bFixGamma_c=TRUE)
 
 GetVWithSe()
 Gets V with standard errors.
 GetWWithSe()
 Gets W with standard errors.
virtual GetZ0()
 Gets Z_0, the double-differenced Y.
virtual GetZ0Names()
 Gets the names of Z_0, the double-differenced Y.
virtual GetZ1()
 Gets Z1, the medium-run regressors.
virtual GetZ2()
 Gets Z2, the long-run regressors.
virtual GetZ3()
 Gets Z3, the long-run regressors.
virtual GetcDfLoss()
 Degrees of freedom lost (no of estimated parameters).
virtual GraphicAnalysis(const iPlot=0, const bActualFitted=FALSE, const bActualFittedCross=FALSE, const iResiduals=2, const iCointegration=2, const iAcf=1, const iAcfLag=-1, const iDensity=0, const iRootsPlot=0, const iLevelsPlot=0, const iEqn=-1)
 Graphical analysis.
virtual I1Rank(const iR)
 Sets the I(1) cointegrating rank r and switches to an I(1) model.
 I2Rank(const iS)
 Sets the I(2) rank s1 prior to estimating the VAR and switches to an I(2) model.
 I2RankMLE(const bPrint)
 
 I2RankTable(const iDoMLE=1)
 Computes and prints the default I(2) rank test table.
 I2RankTablePvals(const mTests, const dAlpha)
 Gets the p-values and fractiles for the test table of the I(2)-analysis.
 I2SwitchStart(const fnSwitching, const mAlpha, const mBeta, const iS1, const mAlpha2=<>, const mBeta2=<>)
 Starting values for tau-switching algorithm.
 Init()
 Reset the transitory properties.
virtual InitData()
 Checks the model formulation and creates the data matrices.
virtual IsI2()
 Checks if this is an I2 model.
static JacI2Model_AB(const vP, const vSelV, const vInitV, const cZ0, const cZ1, const iR, const iS, const amG, const amH, const vDroppedPhi=<>, const bNumerical=FALSE)
 Used in `CATSI2::RestrictAlphaBeta`.
static LogdetI2Model_AB(const vP, const mA, const mB, const mV, const mW, const vSelV, const iR, const iS, const adFunc, const avScore, const amHessian, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const amG, const amH, const vDroppedPhi, const mJac, const bAsympSE)
 
virtual MARep()
 Prints the matrices of the moving average representation.
static MapGammaToPar1(const mAlpha, const mBeta, const mGamma, const mXi, const mEta, const iS1, const mJ, const bUseKappa=TRUE)
 
static MapMatToPar_AB(const mA, const mB, const mV, const vSelV, const iR, const iS, const amG, const amH)
 Used in `CATSI2::RestrictAlphaBeta`.
static MapParToMat_AB( vP, const vSelV, const vInitV, const cZ0, const cZ1, const iR, const iS, const amG, const amH, const vDroppedPhi=<>)
 
static MapScore_AB(const mDloglikDpi, const mA, const mB, const amG, const amH, const vDroppedPhi=<>)
 
virtual Output()
 Prints the estimated the model (called by `Modelbase::Estimate`).
 PrintI2Rank(const sExtra="")
 Prints the estimates for the current rank.
 PrintI2RankTable(const mTests, const mPvals, const mFrac95, const sType="", const bWarn=TRUE)
 Prints the table of the I(2)-analysis.
virtual Restrict(const amRes, const vNormBetaOvr=<>)
 Estimates the model and prints results for the current rank imposing restrictions on alpha and beta.
virtual RestrictAlphaBeta( amA, amH, const vNormBetaOvr=<>, bSetZeroV13=FALSE)
 Estimates the model and prints results for the current rank imposing restrictions on alpha and beta.
 RestrictBeta( mG, amH)
 Estimates the I(2) model with linear restrictions on each beta vector using delta switching.
 RestrictTau( mH)
 Impose the **same** linear restrictions on all Tau vectors.
static RotateRho(const iR, const iS, mTau, mKappa, mRho)
 Rotates rho (I | 0), offsetting tau and kappa.
 ShortRun()
 Prints the short-run coefficients of the I(2) model.
 ShortRunEval_I2(const bDoStdDev=FALSE, const mAlpha=0, const mBeta=0, const mGamma=0, const mTau=0, const mPsi=0, const mOmega=0)
 Calculates the shortrun coefficients of the current I(2) model.
virtual ShrinkSample(const cDrop, const cTmin=1, const bFixShortRun=FALSE)
 Shrinks the estimation sample, but doesn't re-estimate yet.
 SimulateRankTest(const cTsim=400, const cM=1000)
 Simulates and reports the asymptotic distribution of the I(1) rank test in the
static SolveConditional(const mAlpha, const mTau, const mAlphaOrt, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 Solves the conditional equation from the tau representation.
static SolveDeltaForAlpha(const mAlpha, const mTau, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 Solve the delta representation given tau and tau_ort to get the remaining parameters
static SolveDeltaForGammaStart(const mAlpha, const mBeta, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 Get starting values for I(2) algorithm from alpha,beta with restricted beta from the delta representation.
static SolveDeltaForGammaStart2(const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 
static SolveDeltaForTau(const mAlpha, const iR, const iS1, const mDelta, const mZeta, const mOmega, const mH1, const mH2, const mQtZ0, const mQtZ1, const mQtZ2)
 Solve the delta representation given tau_ort, zeta, omega to get tau
static SolveMarginal(const mAlpha, const mBeta, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 Solves the marginal equation from the tau representation.
static SolveTauForAlpha(const iR, const mTau, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
 Solve the tau representation to get alpha.
static SolveTauForTau(const mAlpha, const mAlphaOrt, const iR, const iS1, const mRho, const mW, const mKappa, const mOmega, const mH, const mQtZ0, const mQtZ1, const mQtZ2)
 Solve the delta representation given tau_ort, zeta, omega to get tau
static TauSwitching(const mAlpha, const mBeta, const mH, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
 Tau-switching algorithm for the I(2)-model.
virtual TestEach(const bAlpha=TRUE, const bBeta=TRUE)
 Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
 TestEachBetaRestriction( fnGetG, fnGetH, const vVpg, const asZ, const cRes, const sType)
 Tests similar restrictions over a range of elements using alpha,beta switching.
static TriGetVFromAB(const mA, const mB, const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const bSetZeroV13=FALSE)
 Get V from A,B and the data
static TriNormalize(const mA, const mB, const mV, const iR, const iS1, const bA1IsFree=FALSE, const bA2IsFree=FALSE, const bB1IsFree=FALSE, const bB2IsFree=FALSE, const vNormBOverride=<>)
 
static TriOrthogonalize12(const mA, const mB, const mV, const iR, const iS1, const bA1IsFree, const bA2IsFree, const bB1IsFree, const bB2IsFree)
 
static TriRegularizeV(const mA, const mB, const mV, const iR, const iS1, const bA1B1IsFree, const bB2IsFree)
 
static TriRemoveW(const mA, const mV, const mW, const iR)
 
 TriStart(const mAlpha, const mBeta, const cAlpha, const cBeta, const iR, const iS1, const amG=<>, const amH=<>, const mAlphaI2=<>, const mBetaI2=<>)
 Get starting values for triangular switching algorithm trying several options.
static TriSwitching(const mA, const mB, const mV, const bFixW11, const bSetZeroV13, const amG, const amH, const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const bLineSearch=TRUE, const dAddLogdet=0)
 Triangular switching algorithm for the I(2) model with linear restrictions on A and B.

CATSI2 data members (protected by default)
 m_mA
 
 m_asAlpha1
 
 m_asAlpha2
 
 m_mAlpha_I2
 
 m_mASE
 
 m_mB
 
 m_asBeta1
 
 m_asBeta2
 
 m_mBeta_I2
 
 m_mBSE
 
 m_asDee
 
 m_mDeeSE
 
 m_mEeSE
 
 m_mGamma
 
 m_mGamma_I2
 
 m_mKappa
 
 m_dLogLik_I2
 
 m_mOmega_I2
 
 m_mPsi
 
 m_mPsiSE
 
 m_mQtZ0I2_Z3
 
 m_mQtZ0sqI2_Z3
 
 m_mQtZ1I2_Z3
 
 m_mQtZ2I2_Z3
 
 m_mRho_ort
 
 m_iS1
 
 m_iS1_preset
 
 m_mSigmaZZ
 
 m_mTau
 
 m_asTau
 
 m_mV
 
 m_mV00
 
 m_mV01
 
 m_mV02
 
 m_mV11
 
 m_mV12
 
 m_mV22
 
 m_mWterm
 
 m_mZ0I2
 
 m_asZ0I2
 
 m_mZ0I2_Z3
 
 m_mZ1I2
 
 m_asZ1I2
 
 m_mZ1I2_Z3
 
 m_mZ2I2
 
 m_asZ2I2
 
 m_mZ2I2_Z3
 
 m_asZ3I2
 
 m_mZ3I2
 
 m_asZeta
 

CATS::ACTest_LB(const mResid, iOrder=0)
Computes the Ljung-Box autocorrelation statistic.
Parameters
mResid matrix of residuals [T][p]
iOrder lag length for test (default 0 corresponds to T/4)
Returns
the test statistic

virtual CATS::ACTest_LM(const mResid, const iOrder=1)
Performs the LM test for autocorrelation.
Parameters
mResid matrix of residuals [T][p]
iOrder integer, lag length for test (default is 1)
Returns
the test statistic

static CATS::ARCHStats(const mResid, const iOrder=1)
Univariate ARCH statistics.
Parameters
mResid matrix of residuals [T][p]
iOrder lag length for ARCH statistics (default is 1)
Returns
(p x 2) matrix with single equation ARCH statistics and p-values

static CATS::ARCHTest(const mResid, const iOrder=1)
Multivariate ARCH test, Luetkepohl, 2004.
Parameters
mResid matrix of residuals [T][p]
iOrder lag length for ARCH test (default is 1)
Returns
(2 x 1) matrix: test statistic and degrees of freedom

static CATS::AlphaBetaStart(const mAlpha, const mBeta, const amG, const amH, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const cInitSteps=2, const aAnalysis=<>)
Get starting values for alpha,beta switching I(1) algorithm using GLS.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
mOmega[p][p] initial values for omega
amG array[r] of G_i G matrices
amH array[r] of H_i matrices
mQtZ0 matrix[n][cz0] Q'Z0 corrected for z2
mQtZ1 matrix[n][cz1] Q'Z1 corrected for z2
mQtZ0sq matrix[cz0][cz0] rest of Z0'Z0 corrected for z2
cT int, sample size
cInitSteps int, number of initialization steps, >= 1 (default is 2)
Returns
array with five elements: alpha, beta, dlogdet, success value (MAX_CONV), vp = theta|phi.

static CATS::AlphaBetaStartAnalysis(const mAlpha, const mBeta, const amG, const amH)
Get starting values for alpha,beta switching I(1) algorithm using GLS.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
amG array[r] of G_i G matrices
amH array[r] of H_i matrices
Returns
array with four elements: {#restrictions on alpha, #restrictions on beta, TRUE if all G are I, TRUE if all H are I, TRUE if common alpha restrictions, TRUE if beta identified}.

static CATS::AlphaBetaStartSearch(const mAlpha0, const mBeta0, const fnAlphaBetaStart, const fnEstimate, const cStart, const mxStartIt, const iInfo, const bTrace=FALSE)

static CATS::AlphaBetaSwitching(const mAlpha, const mBeta, const amG, const amH, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const iLineSearch=2)
Alpha, beta switching algorithm for estimating restricted Alpha and Beta vectors in the I(1)-model.
Parameters
mAlpha matrix [cz0][r] initial alpha
mBeta matrix [cz1][r] initial beta
cAlpha int, no of free parameters in alpha.
amG array[r] of G_i G matrices
amH array[r] of H_i matrices
mQtZ0,...,mQtZ0sq transformed data matrices
cT int, sample size
dCrit double, convergence tolerance
iMaxIt int, maximum number of iterations
iInfo int, >0: print output for every iInfo-th iteration
iLineSearch int, 0: no search, 1: 1-stage search, 2: 2-stage search (default)
Returns
array with five elements: alpha, beta, dlogdet, success value (MAX_CONV, MAX_WEAK_CONV, MAX_MAXIT, MAX_NOCONV, MAX_FUNC_FAIL), vp= theta|phi.

static CATS::AlphaKnown(const mA, const mBeta1, const mS00, const mS01, const mS11)
Estimate under the restriction H0: Alpha = (G,G_orthogonal*Psi) where G is a known matrix of dimension (n x S), 0 < S <= R.
Parameters
mG A matrix
mBeta1 current beta, determines rank and use if alpha=G (fully known)
Returns
array with four elements: alpha, beta, omega, adgf
Comments
Equation numbering refers to Johansen [1996].

static CATS::ApplyColumnScale(const mA, const mB, const mC, const vNormRow)
Applies a normalization to columns of a matrix, As*Bs = (A .* v)(B ./ v) = AB.
Parameters
mA A[p][n] matrix to scale by multiplication
mB B[m][n] matrix, m >= n, to scale by division
mC C[m][n] matrix providing scale factors (usually equal to mB)
vNormRow[q] vector with elements in B for normalization, row indices for columns 0,..,q-1.
Returns
array with three matrices {As, Bs, v}, As has inverse normalization applied, Bs [m][n] normalized matrix, v is normalization vector/matrix.

static CATS::ApplyColumnScaleVec( vP, const cAlpha, amG, const vOldScale, const bApply=TRUE)
Apply/remove the scale transformation to theta or phi in vP
Parameters
vP parameter vector
cAlpha offset in vP
amG array[r] of H_i matrices, one for each restriction
vOldScale old scale to remove
bApply TRUE: scale (default), FALSE: remove old scale
Returns
{vP, amG, newscale}

static CATS::AutoIdentify1( amH, const iR, const abIsIdentified)
Automatic identification of the cointegration space.
Parameters
amH array of H matrices
iR integer, rank for identification
abIsIdentified address, TRUE on output if amH is identifying, FALSE otherwise
bCheck boolean indicating if check should be performed
Returns
amH array of H matrices, possibly modified to obtain identification.

static CATS::AutoIdentify2(const amH, const iR, const abIsIdentified)
Automatic identification of the cointegration space.
Parameters
amH array of H matrices
iR integer, rank for identification
abIsIdentified address, TRUE on output if amH is identifying, FALSE otherwise
bCheck boolean indicating if check should be performed
Returns
amH array of H matrices, possibly modified to obtain identification.

static CATS::BartlettBeta(const iS, const iType, const mAlpha, const mBeta, const iRank, fnGetGamma, const mS00, const cT, const iDetTrend, const cSeas, const iMethod=0)
Calculates the Bartlett correction factor for tests on the cointegrating relations. Notation corresponds to Johansen (2000): A Bartlett Correction Factor for the Tests on the Cointegrating Relations, Econometric Theory, 16, 740-778.
Parameters
1: (Beta,Rho) known [Corollary 5] 2: Beta = H*Phi, Rho unrestricted [Corollary 6] 3: (Beta,Rho) partly known [Corollary 7] fnGetGammas(const mAlphar, const mBetar)
iS integer, the number of columns in H.
iType specifies the type of restriction on Beta being tested:
mAlpha alpha (adjusted internally to specified iRank)
mBeta beta (adjusted internally to specified iRank)
iRank integer of desired rank
fnGetGammas function that returns array[k-1] with gamma matrices ({} if lag length k <= 1),
mS00 S_{00} matrix
cT sample size
iDetTrend specification of constant/mean (1,2,3,4 for NONE,CIMEAN,DRIFT,CIDRIFT)
cSeas no of seasonal terms
Returns
the correction factor (double)

static CATS::BartlettRank(const mAlpha, const mBeta, const iRank, fnGetGamma, const mS00, const cT, const iDetTrend, const bWarn=TRUE, const iMethod=0)
Calculates the rank test Bartlett small sample correction of Johansen (2002) given the rank of Pi.
Parameters
fnGetGammas(const mAlphar, const mBetar) 1: use iteration, 2: calculations with (n^2 x n^2) matrices, 3: neglects a term. The default is 0; other values are just to measure the relative speed (2 will be very slow).
mAlpha alpha (adjusted internally to specified iRank)
mBeta beta (adjusted internally to specified iRank)
iRank integer of desired rank
fnGetGammas function that returns array[k-1] with gamma matrices ({} if lag length k <= 1),
mS00 S_{00} matrix
cT sample size
iDetTrend specification of constant/mean (1,2,3,4 for NONE,CIMEAN,DRIFT,CIDRIFT)
bWarn, TRUE: print warning when Sigma is not positive definite (the default)
iMethod, 0: use unsymmetric eigen value decomposition,
Returns
The Bartlett correction factor

static CATS::Bartlett_c2(const mP, const mVpsi, const iMethod=0)
Four methods to compute c_2: direct, summation, very large matrices, approximate.
Parameters
1: use iteration, 2: calculations with (n^2 x n^2) matrices, 3: neglects a term. The default is 0; other values are just to measure the relative speed (2 will be very slow).
mP P
mVpsi V_psi
iMethod, 0: use unsymmetric eigen value decomposition,
Returns
The Bartlett correction factor

static CATS::BetaStdErrors( amH, const viNorm, const mSM1, const cT)
Calculates the asymptotic standard errors of beta for the I(1) model if the restrictions identify beta. The identifying restrictions are of the form beta_i = H_i phi_i for i = 1,...,r.
Parameters
viNorm must have same number of rows as beta and the j'th entry should be the index of the element of vector j on which beta is normalized.
amH array of H_i matrices
viNorm matrix (vector of integers)
mSM1 matrix, unrestricted variance matrix
cT sample size (if scaling still needed)
Returns
matrix with standard errors of beta (or <> if computation failed)

static CATS::BetaStdErrors_DiagH( amH, const viNorm)
Calculates the DiagCat(amH) with normalization columns removed.
Parameters
viNorm must have same number of rows as beta and the j'th entry should be the index of the element of vector j on which beta is normalized.
amH array of H_i matrices
viNorm matrix (vector of integers)
Returns
large mapping matrix

static CATS::BetaSwitching(const mG, const amH, const vVpg, const mBeta, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
Switching algorithm for estimating restricted Beta vectors in the I(1)-model.
Parameters
of vectors in group i. The sum is the rank of the restricted beta.
mG matrix, <> or common restriction on alpha
amH array[q] of H matrices, one for each restriction
vVpg matrix[q] rank for each restriction. Entry i of vVpg gives the number
mBeta[p1][r] initial beta
mS00 S00 matrix
mS01 S01 matrix
mS11 S11 matrix
dCrit double, convergence tolerance (default 1e-6)
iMaxIt int, maximum number of iterations (default 1000)
iInfo int, >0: print output for every iInfo-th iteration (default 0)
iLineSearch int, 0: no search, 1: 1-stage search, 2: 2-stage search (default)
Returns
array with three elements: alpha, beta and success value ((MAX_CONV, MAX_WEAK_CONV, MAX_MAXIT, MAX_NOCONV, MAX_FUNC_FAIL))
Comments
The reported logdet is only the actual log-determinant if there are no restrictions on alpha.

static CATS::BlockInvHess(const mHessian, const aSizes)
Creates an array of matrices with minus the inverse of diagonal blocks of a matrix.
Parameters
mHessian Hessian matrices.
aSizes array[n] of block sizes, which should add up to the dimension of mHessian (or less).
Returns
array[n] withinverse of minus the the diagonal blocks

CATS::BootstrapRankTest( cB=399, const iType=0)
Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
Parameters
cB Number of bootstrap replications (B, optional argument, default is 399)
iType Type of bootstrap sampling: BS_WILD (Wild N[0,1], the default), BS_IID (IID resampling), BS_SIGN (+1,-1)
Returns
array[2] {table with tests and p-values, table of quantiles}

CATS::BootstrapRestrictions( cB=199, const iType=0)
Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
Parameters
cB Number of bootstrap replications (B, optional argument, default is 399)
iType Type of bootstrap sampling: BS_WILD (Wild N[0,1]), BS_IID (IID resampling), BS_SIGN (+1,-1)
Returns
array[2] {table with tests and p-values, table of quantiles}

CATS::CATS()
Constructor, requires Ox 8.0 or newer.

CATS::CATSminingSearch(const amRes, const bFixDet=TRUE, const iHomogenize=2, const dP1=0.05, const dP2=0.25)
Finds restrictions on a cointegrating vector.
Parameters
amRes array with restrictions, sections are [alpha],[beta],[fix] (without sections, [beta] is assumed)
bFixDet TRUE: fix deterministic variables (default is TRUE)
iHomogenize 1: homogenize (a=1,-1) selection, 2: include a+b=1,-1 (default is 2), 0: off
dP1 restrictions with pvalue < dP1 are rejected (default is 0.05)
dP2 homogenization restrictions with pvalue < dP2 are rejected (default is 0.25), unless it improves on the previous p-value
Returns
array with four elements: {array with restrictions (ordered), matrix with model estimation results for each restriction, amg, amhfix}.

CATS::CATSminingSelect(const amRes, const dP2=0.05, const dP4=0.05, const mxDepth=20)
Selects from a set of possible cointegrating vectors.
Parameters
param dP3 interim selections with pvalue < dP3 are rejected (default is 0.05) param dP4 final selections with pvalue < dP4 are rejected (default is 0.05)
amRes array with restrictions, sections are [alpha],[beta],[fix],[user] (without sections, [beta] is assumed)
mxDepth int: maximum number extended in each round (default is 20)
Returns
array with three elements: vector of tests for each.

static CATS::CheckConvergence(const dLogdet, const dLogdetPrev, const mPi, const mPiPrev, const dCrit, const iMaxIt, const iInfo, const iItno, mIterInfo=<>, const dStep=1, const bForceTerminate=FALSE)
Checks convergence of switching algorithms based on relative change in log-determinant and Pi.
Parameters
dLogdet current -log-determinant
dLogdetPrev previous -log-determinant
mPi current Pi matrix
mPiPrev current previous matrix
dCrit double, convergence criterion (<0 if step is down)
iMaxIt int, maximum number of iterations (default 1000)
iInfo int, >0: print output for every iInfo-th iteration (default 0)
mIterInfo <> or current info, updated if necessary
dStep int, !=1: current step size (default is 1)
Returns
{convergence criterion based on -logdet, convergence criterion based on pi, TRUE if converged, mIterInfo}

CATS::CheckEstimated()
Generates a run-time error if the unrestricted reduced rank model has not been estimated.

static CATS::CheckRestrictions(const sH, amH, const cRows, const iR, vVpg=<>, const bNeedRmatrices=TRUE)
Check restrictions matrices (if any); if possible supply missing items. Prints a warning for an error.
Parameters
sH string: label for matrix
amH array[q] of H matrices, q <= r, or array[q] of strings with restriction expressions
cRows int, no of rows in each H matrix.
vVpg vector[q] rank for each restriction, default is <>.
bNeedRmatrices TRUE: need one entry for each vector, so vVpg must be all ones, default is TRUE
Returns
array with siz items: 1. amH[q] array with restrictions 2. the number of restrictions imposed (-1 for an error), 3. no of free parameters, 4. vnorm[iR] for each vector, either -1 or index to be used for normalization (row vector) 5. vVpg[q], multiplicity of restrictions, and 6. the number of restrictions imposed on each vector

static CATS::ClassifyDummies(const mR, const mDR)

static CATS::ColCat(const amA)
Concatenates an array of matrices along the columns.
Parameters
amA array[n] of matrices.
Returns
~ on all the matrices in amA

CATS::CompanionRoots()
Prints the roots of the companion matrix based on the current model.

virtual CATS::Covar()

static CATS::DecLQ(const mA)
LQ decomposition
Parameters
mA A[m][n] matrix.
Returns
{L, Q, TRUE/FALSE}

static CATS::DecQL(const mA)
QL decomposition
Parameters
mA A[m][n] matrix.
Returns
Q, L

static CATS::DecQRt(const mA)
QR decomposition
Parameters
mA A[m][n] matrix.
Returns
Q, R'

static CATS::DiagCat(const amA)
Concatenates an array of matrices along the diagonal.
Parameters
amA array[n] of matrices.
Returns
diagcat on all the matrices in amA

virtual CATS::DoAutoOutput()
Adds to the standard output (does nothing here).

CATS::DoBartlettBetaFactor(const amH)
Check if the restrictions on beta are such that the Bartlett correction can be applied.
Parameters
amH array of H matrices
Returns
0 (no Bartlett correction available) or the correction factor.

CATS::DoCompute(const iDo)
Specify default computations and tabulations.
Parameters
iDo int, DO_ flags to specify computations to include

virtual CATS::DoEstimation( vPar)
Estimates the model (called by Estimate).
Parameters
vPar vector of initial parameters (ignored, all zero here)
Returns
vec(alpha)|vec(beta)|vec(Omega)

static CATS::DoGetCompanion(const mAlpha, const mBeta, const mGamma_i, const amRoots)
Returns the companion matrix based on the specified coefficients, optionally with roots.
Parameters
out: if array, amRoots will hold an [n][4] matrix : real part, imaginary part, absolute value and argument.
mAlpha[p][r] alpha
mBeta[p1][r] beta
mGamma_i[p][p * (k-1)] coefficients of lagged differences of y_t
amRoots in: array or 0 (default if no arguments)
Returns
companion matrix

CATS::DoI1RankTable(const dAlpha=0.05, const bDoBartlett=TRUE)
Computes the table of the I(1)-analysis.
Parameters
dAlpha Significance level to be used in table (default is 0.05 for 95% quantiles)
bDoBartlett boolean, TRUE to compute Bartlett correction (default is TRUE)
Returns
an array[2]: [m_cY][8] matrix with {"p-r", "r", "Eig.Value", "Trace", "Trace*", "Crit5%", "p-value", "p-value*"} and a message.

CATS::DoI1Residuals(const mPi)
Computes the residuals of the I(1) model.
Parameters
mPi matrix Pi[m_cY][cz1]
Returns
residual matrix [m_cT][m_cY]
Comments
Returns, in matrix form: Z0|Z2 - Z1|Z2 Pi_hat' where Pi_hat' = beta alpha'.

virtual CATS::DoMoments()
Creates the QR transformations that are needed for estimation.
Comments
Creates m_mQtZ0_Z2,m_mQtZ1_Z2, m_mQtZ0sq_Z2 as well as m_mS00, m_mS01, m_mS11.

static CATS::DoRestrictAlphaBeta(const mAlpha0, const mBeta0, const amG, const amH, const bWithStandardErrors, const vNormBeta, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const dBFGSCrit, const iMaxItBFGS, const iSwitchOptions=0, const cStartSearch=20)

CATS::DoSetI1Rank(const iR)
Sets the cointegrating rank of Pi to r, 0 <= r <= n, after estimating the VAR.
Parameters
iR integer, r
Comments
Use I1Rank to specify the rank prior to estimation. Called by DoEstimation to complete the estimation for the specified rank. DoSetI1Rank can be called after estimation to change the rank.

CATS::DoUpdateEstimates_I1(const mAlpha, const mBeta, dLogDet=.NaN, const viNorm=<>)
Updates the model estimates with (restricted) alpha, beta, Omega.
Parameters
mAlpha alpha matrix
mBeta beta matrix
mOmega Omega matrix or <>: compute from residuals
dLogDet double, log|Omega| or .NaN: compute from Omega
viNorm normalization vector or <>: normalize automatically

CATS::DoUpdateRestrictedSettings(const amG, const amH, const vVpg, const iAlphaFlag, const iBetaFlag, const cResCount, const sResType=0)
Store the settings for restricted estimation.
Parameters
amG array[r] or array[1] of G_i matrices
amH array[q] of H_i matrices
vVpg vector[q] rank for each restriction.
iAlphaFlag int, type of restrictions imposed on alpha, ALPHA_NONE,ALPHA_EACH,...
iBetaFlag int, type of restrictions imposed on beta, BETA_NONE,BETA_EACH,...
cResCount int, no of restrictions imposed
sResType 0 to used standard label (default), or string for specified label

CATS::DropDiffLags(const vDropLags, const vDropLagsExo=<>)
Drop lagged differences in the ECM representation of the VAR.
Parameters
vDropLags: vector with lags to drop.
vDropLagsExo (optional): vector with DX lags to drop (currently unsupported).

static CATS::ECMToVAR(const mPi, const mGammas)
Translates the ECM coefficients to the VAR coefficients.
Parameters
mPi[p][p1] matrix alpha*beta' mPi[][p:] part is ignored for this
mGammas[p][p * (k - 1)] matrix with coefficients of lagged differences
Returns
matrix[p][p * k] with parameters for the model in levels: A_1 ~ ... ~ A_k.

static CATS::Eigen(const ma, const amval, const amvec=0)
As Ox eigen function, except that it always includes the imaginary part.
Parameters
out: if array, amval will hold an [2][m] matrix with eigenvalues of A, first row is real part, second row imaginary part. out: if array, amvec will hold an [2m][m] matrix with eigenvectors of A (real values are in first m rows).
ma in: m x m matrix A
amval in: array
amvec in: array or 0
Returns
0 (success) or 1 (max iterations reached)

virtual CATS::EstimateAlphaBeta( amG, amH, const vNormBetaOvr=<>)
Estimates the model using alpha-beta switching but doesn't make it the current model.
Parameters
amG array[r] of G_i matrices
amH array[r] of H_i matrices
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
array {alpha, beta, retval, loglik, isidentified, no of restrictions, se_alpha, se_beta}
note
does not change any member variables, so can be called in parallel

static CATS::FixRank(const mHj, const mRj, const mH, const iTargetRank)
Used for the automatic Beta-space identification scheme. Finds a column of Hj to remove in order to increase the rank.
Parameters
Because the rank can only increased by 1 (a vector is added), the iTargetRank can only be one higher than the current rank.
mHj matrix, current (jth) H matrix
mRj matrix, orthogonal complement of current H matrix (zero sizec if mHj is square)
mH matrix, concatenation of all other H matrices
iTargetRank integer target rank.
Returns
array[3]: {1, modified mRj, modified mHj} if successful; if failed: {1, original mRj, original mHj}.

static CATS::GammaApprox_I1(const dTstat, const iType, const dQuantile, const iDetTrend, const iP, const iR, const iDimX1, const iS=0, const cSD=0, const viSDDate=<>)
Procedure for calculating the approximate p-values and quantiles of the asymptotic distribution of the I(1) test for the cointegrating rank.
Parameters
dTstat double trace test statistic
iType RANKTEST_TRACE, RANKTEST_LMAX or RANKTEST_BREAK
dQuantile double, 0.95 for alpha = 0.05
iDetTrend NONE, CIMEAN, DRIFT or CIDRIFT
iP integer, dimension of system (m_cY)
iR integer, rank
iDimX1 integer, no of weakly exogenous variables
iS integer, no of I(1) trends s_1 in the I(2) model (only used for GammaApprox_I2)
cSD integer, no of breaks (1,2, only for iType==RANKTEST_BREAK)
viSDDate vector, size of breaks (used for RANKTEST_BREAK, expressed as fraction of sample size)
Returns
array with two elements: {p-value, critical-value}
Comments
References: Doornik: Approximations to the Asymptotic Distribution of Cointegration Tests, Journal of Econometric Surveys, 1998, Vol 12, No 5. Johansen, Mosconi & Nielsen: Cointegration Analysis in the Presence of Structural Breaks in the Deterministic Trend, Econometrics Journal 2000, 3. Harbo, Johansen, Nielsen, Rahbek: Asymptotic Inference on the Cointegrating Rank in Partial Systems, Journal of Business and Economic Statistics 16.

static CATS::GammaApprox_I2(const dTstat, const iType, const dQuantile, const iDetTrend, const iP, const iR, const iDimX1, const iS=0, const cSD=0, const viSDDate=<>)
Procedure for calculating the approximate p-values and quantiles of the asymptotic distribution of the I(2) test for the cointegrating rank. See GammaApprox_I1

CATS::GenerateAsY(const mEps, const mAlpha, const mBeta, const mGams, const mPsi)
Generates a random sample formulated as the current I(1) model, but with specified coefficients.
Parameters
mEps matrix[T][p] error term for the random sample (must match the estimated sample size, which can be obtained by Modelbase::GetcT())
mAlpha[p][r] matrix or <>
mBeta[p1][r] matrix or <>
mGams[p][n * (k - 1)] matrix with coefficients on lagged differences
mPhi[p][d] matrix with coefficients on remaining short-run variables
Returns
matrix[T][p] random sample

static CATS::GenerateECM(const cT, const iDet, const mAlpha, const mBeta, const mGams, const mPsi, const mOmegaSqrt=<>, const mYinit=<>, const mYmean=<>)

virtual CATS::GenerateY( mEps=<>)
Generates a random sample from the current model.
Parameters
normality is assumed, as if specifying rann(GetcT(), GetcY()) * choleski(GetResVar())')
mEps <> or matrix[T][p] with error term for the random sample; if <> (the default)
Returns
matrix[T][p] random sample
Comments
To make mEps match the estimated variance use:

CATS::GetAlpha()
Gets current alpha.
Returns
current alpha matrix

CATS::GetAlphaSe()
Gets standard errors of current alpha.
Returns
matrix of standard errors of current alpha

CATS::GetAlphaVAR()
Gets alpha for the full rank VAR.
Returns
alpha[p][p] matrix for the full rank VAR

static CATS::GetBar(const mA)
returns A_bar.
Parameters
mA matrix[p][r], p >= r
Returns
A_bar

CATS::GetBeta()
Gets current beta.
Returns
current beta matrix

CATS::GetBetaSe()
Gets standard errors of current beta.
Returns
matrix of standard errors of current beta (<> if not identified)

CATS::GetBetaVAR()
Gets beta for the full rank VAR.
Returns
beta[p][p] matrix for the full rank VAR, beta'S_{11}beta = I_p

static CATS::GetColumnScale(const mB, const cRows=0)
Finds a row elements for each column to normalize a matrix.
Parameters
mB [m][n] matrix, m >= n
bDifferent each row index should be different (FALSE by default)
cRows int, >0: only consider rows 0,...,cRows-1 of mB (<= 0: all rows, this is the default)
Returns
[n] column vector with row indices for sizec 0,..,n-1.
Comments
Does not take small pivots into account.

virtual CATS::GetCompanion(const amRoots=0)
Returns the companion matrix based on the current model, optionally with roots.
Parameters
out: if array, amRoots will hold an [n][4] matrix : real part, imaginary part, absolute value and argument.
amRoots in: array or 0 (default if no arguments)
Returns
companion matrix

virtual CATS::GetDimensions(const sType="")
Get model dimensions.
Parameters
sType string: type of dimension ("p","p1","r","s","s2","R") or default "" for array with all
Returns
array with {p, p_1, r, 0, p-r, R (no of restrictions imposed)} or single dimension
Comments
Also see GetLags

CATS::GetEval()
Gets the eigenvalues.
Returns
column vector with n trace tests

CATS::GetGammaFrom(const mAlpha, const mBeta)
Gets the current Gamma matrix (coefficient of lagged second difference) in the same format as the I(2) model.
Parameters
mAlpha[p][r] matrix or <>
mBeta[p][r] matrix or <>
Returns
matrix Gamma[p][p1] = (Gamma_y : Gamma_0)
Comments
Not to be confused with the first return value of ShortRunEval. For the I(1) model: Gamma_y = I - \sum Gamma_i. Gamma_0 = (-\sum Psi_i : -mu_0)

CATS::GetGamsInArray(const mAlpha, const mBeta)
Calculates the Gamma_i matrices (coefficient of lagged differences) based on the alpha and beta.
Parameters
mAlpha[p][r] matrix or <>
mBeta[p][r] matrix or <>
Returns
{} if lag length k <= 1, else array[k-1] with Gamma_1,.. Gamma_{k-1}

virtual CATS::GetGroupLabels()

static CATS::GetInvertibleSubMatrix(const mB, const viNorm=<>)
Finds a unique row elements for each column to rotate a matrix.
Parameters
mB [m][n] matrix, m >= n
viNorm [n] specified override of normalization (default is <>: do not override)
Returns
array with three elements: { the submatrix of mB, adjusted mB, [n] column vector with unique row indices for columns 0,..,n-1. }
Comments
Uses pivoting info from the QR decomposition of B' to get the best (n x n) submatrix can be singular if rank(B)<n.

CATS::GetLags()
Returns the lag length of the dependent variables.
Returns
current an array with three values: lag length of VAR, lag length of exogenous variables, lag length of restricted deterministics. See Lags

CATS::GetLambdaXiSe()
Computes standard errors of transformed eigenvalues and their sum.
Returns
matrix[p+1][1] sdev(xi) | sdev(sum(xi))

CATS::GetLogLikUnr()
Gets the log-likelihood of the unrestricted model (except for the rank-restrictions).
Returns
double, log-likelihood of the unrestricted model (except for the rank-restrictions)

CATS::GetLogLikVAR()
Gets the log-likelihood of the unrestricted VAR.
Returns
double, log-likelihood of the unrestricted VAR

CATS::GetMARep()
Calculates and returns the matrices of the moving average representation.
Returns
array[9]: {C(1), SE[C(1)], alpha_ort, SE[alpha_ort], beta~, SE[beta~], tau, <>, correlations}

CATS::GetMaxMethodInfo()
Gets the maximization method info.
Returns
array with information

CATS::GetMaxMethodName()
Gets the maximization method name.
Returns
string with package name

CATS::GetMethodLabel()
Gets method label.
Returns
label of estimation method.

virtual CATS::GetMethodLabels()

CATS::GetModelLabel()
Gets model label.
Returns
string with CATS(#) where # is model number.

CATS::GetOmega()
Gets current residual variance matrix Omega.
Returns
current Omega matrix

virtual CATS::GetPackageName()
Gets the package name.
Returns
string with package name

virtual CATS::GetPackageVersion()
Gets the package version.
Returns
string with package version

virtual CATS::GetParNames()
Gets the names of the parameters.
Returns
array of strings with parameter names

CATS::GetPi()
Gets current Pi.
Returns
current Pi matrix

CATS::GetPiSe()
Gets standard errors of current Pi.
Returns
matrix of standard errors of current Pi

virtual CATS::GetRegsLongRun(const fCorrected=TRUE)
Gets the long-run regressors, optionally corrected for the short-run regressors.
Parameters
fCorrected, TRUE: corrected for short-run (default), else uncorrected.
Returns
(T x cZ1) matrix

virtual CATS::GetResVar()
Gets current residual variance matrix Omega.
Returns
current Omega matrix

CATS::GetResiduals()
Gets the residuals.
Returns
(T x p) matrix of residuals

virtual CATS::GetS00()
Gets S_{00}.
Returns
(cZ0 x cZ0) matrix with S_{00}

CATS::GetSeasonals()

CATS::GetTraceTest()
Gets the trace-test statistics.
Returns
column vector with n trace tests

CATS::GetTrend()
Returns
m_iDetTrend, which defines the current trend behaviour, see Trend

virtual CATS::GetUNames()
Gets the names of the U variables.
Returns
array of strings with U variable (exogenous I(0)) names

virtual CATS::GetXNames()
Gets the names of the X variables.
Returns
array of strings with X variable (exogenous I(1)) names

virtual CATS::GetYNames()

virtual CATS::GetZ0()
Gets Z_0, the differenced Y.
Returns
(T x p) matrix with Z_0 = DY

virtual CATS::GetZ0Names()
Gets the names of Z_0, the differenced Y.
Returns
array[2] with names

virtual CATS::GetZ1()
Gets Z1, the long-run regressors.
Returns
(T x cZ1) matrix with Z_1 = Y_1 ~ X

virtual CATS::GetZ2()
Gets Z2, the short-run regressors.
Returns
(T x cZ2) matrix with Z_2 = [DY_1 .. DY_{k-1}] ~ [DX1 .. DX1_{m-1}] ~ U

virtual CATS::GetZ3()
Gets Z3 which is empty in the I(1) model.
Returns
<>

virtual CATS::GetcDfLoss()
Degrees of freedom lost (no of estimated parameters).
Returns
number of estimated parameters

virtual CATS::GraphicAnalysis(const iPlot=0, const bActualFitted=FALSE, const bActualFittedCross=FALSE, const iResiduals=2, const iCointegration=2, const iAcf=1, const iAcfLag=-1, const iDensity=0, const iRootsPlot=0, const iLevelsPlot=0, const iEqn=-1)
Graphical analysis.
Parameters
iPlot int: index of first plot
bActualFitted TRUE: include plots of actual and fitted
bActualFittedCross TRUE: include crossplots of actual and fitted
iResiduals >0: include plots of 1: residuals, 2: scaled residuals, 3: standardized to IN[0,1] residuals (as in normality test)
iCointegration >0: cointegrating vectors, 1: one plot, 2: individual plots
iAcf >0: include ACF plots of 1: residuals, 2: squared residuals
iAcfLag: lag length for ACF plots (<=0 then using default)
iDensity >0: include histogram and QQ plots of residuals
iRootsPlot >0: include roots of companion matrix
iLevelsPlot >0: include levels plot Y (iLevelsPlot >1 with DY; iLevelsPlot >2 with DDY)
iEqn <0: plot for all equations, else plot specified equation
Returns
int: number of plots created.

virtual CATS::I1Rank(const iR)
Sets the cointegrating rank r and forces re-estimation of the CVAR.
Comments
Use DoSetI1Rank to change the rank after estimation.
Parameters
iR integer, 0 <= r <= p
Comments
This changes the model class to I1 (relevant for CATSI2).

CATS::I1RankTable(const bDoBartlett=TRUE)
Computes and prints the default I(1) rank test table.
Parameters
bDoBartlett, boolean, TRUE: include Bartlett correction (default)
Returns
the table.

CATS::Init()
Reset the transitory properties.

virtual CATS::InitData()
Checks the model formulation and creates the data matrices.

virtual CATS::InitPar()
Initialize the model parameters

static CATS::InsertFixedPhiInPar(const vP, const cAlpha, const vDroppedPhi)
Reinserts the normalizations that are not in the parameter vector
Parameters
(assumed sorted in ascending order)
vP, column vector with unrestricted (free) parameters.
cOffset int, no of free parameters before (usually alpha).
vDroppedPhi vector[r] indices of the elements of phi that are fixed at unity
Returns
modified vP (unchanged if vDroppedPhi == <>)

static CATS::InvertSymQR(const mA, const pdLogLik=0)
Returns the inverse of symmetric p.d. matrix.
Parameters
mA A[n][n] matrix, symmetric p.d. matrix.
pdLogDet in: address, out: log determinant.
Comments
Like invertsym, but using the QR. Unlike invertsym, this avoids a message on singularity, and will return a value when (close to) singular (which can be a disadvantage).

virtual CATS::IsI2()
Checks if this is an I(2) model
Returns
TRUE for I(2): s_1 != p - r, FALSE otherwise

virtual CATS::IsIdentified()
Get identification status.
Returns
TRUE if identified

static CATS::IsIdentifying(const amH, const bFull=FALSE)
Tests if the r matrices H_i generically identify an r-dimensional space.
Parameters
amH array[r] of matrices of dimension (n x s_i)
bFull bool, TRUE: check all matrices, FALSE: stop at first failure (default)
Returns
(r x 1) column vector with 1 in position i if H_i space full rank

static CATS::IsIdentifyingJac(const mAlpha, const mBeta, const amG, const amH, const vDroppedPhi, const cPar)
Tests if the G and H matrices identify the cointegrating space using the Jacobian criterion.
Parameters
mAlpha[p][r] alpha
mBeta[p1][r] beta
amG array[r] of matrices of dimension
amH array[r] of matrices of dimension
cPar no of parameters estimated
Returns
{TRUE if identified, rank of Jacobian}

CATS::IsOutsideCircle()
Checks if the current model is inside the circle using the current radius.
Returns
TRUE if inside (or the radius is >= 2)
Comments
Use SetRadius to set or get the radius.

virtual CATS::IsUnivariate()

static CATS::JacLinResBeta(const amH, const vDroppedPhi)
Jacobian of linear restrictions on beta (optionally identified by fixing an element of each phi).
Parameters
amH array[r] of H_i matrices, one for each restriction
Returns
Jacobian matrix

CATS::Lags(const lags, const lagsExo=-1, const lagsDet=-1)
Set the lag length of the dependent variables in the VAR.
Parameters
If this is zero, then no lagged differences are added unrestrictedly. If this is zero, then no lagged differences are added unrestrictedly.
lags: integer with Y lag length >= 1 (default is 2).
lagsExo (optional): integer with lag length >= -1 of weakly exogenous variables (default is -1: same as Y).
lagsDet (optional): integer with lag length >= -1 of restricted deterministic variables (default is -1: same as lagsDet).
Comments
Sets m_cLags, m_cLagsExo, and m_cLagsDet. If lagged Y are added through Select, then InitData will automatically set m_cLags from that instead. If no lags are set, the default is 2.

static CATS::LineSearch(const vP, const vPprev, const vP0, const dF, const dFprev, const fnLogLik, const vStepGridUp, const vStepGridDown, cStages)
Line search algorithm for switching.
Parameters
vP matrix[m][q] with parameters
vPprev matrix[m][q] with previous parameters
vP0 matrix[m][q] with previous candidate parameters (may be same as vPprev)
dF current function value,
dFprev previous function value,
fnLogLik function to compute function value (MaxBFGS format)
vStepGridUp vector with grid points when dF >= dFprev (progress)
vStepGridDown vector with grid points when dF < dFprev (went down)
cStages 1 or 2, number of linesearch stages (can also be -1, only used for research)
Returns
array with three elements: parameters, function value, step size

CATS::LogDetFromLogLik(const dLogLik)
Translates the log-likelihood to log|Omega|.
Parameters
dLogLik double log-likelihood
Returns
log-likelihoodlog|Omega|.

CATS::LogLikFromLogDet(const dLogDet)
Translates log|Omega| to the log-likelihood.
Parameters
dLogDet double log|Omega|, Omega = (V'V)/T
Returns
log-likelihood.

static CATS::LogdetI1Model(const mAlpha, const mBeta, const cAlpha, const cBeta, const adFunc, const avScore, const amHessian, const mQtZ0, const mQtZ1, const mQtZ0sq, const cT, const amG, const amH, const vDroppedPhi, const mJacA, const mJacB, const bAsymp=FALSE)
Evaluates the scaled log-likelihood of the restricted I(1) model. Only used in DoRestrictAlphaBeta

static CATS::LogdetSymQR(const mA)
Returns the log determinant of a symmetric p.d. matrix.
Parameters
mA A[n][n] matrix, symmetric p.d. matrix.
Returns
double: log determinant.
Comments
This uses the QR decomposition, so avoiding a message on singularity, and will return a value when (close to) singular (which can be a disadvantage).

virtual CATS::MARep()
Prints the matrices of the moving average representation.

static CATS::MapParToAlphaBeta( vP, const cAlpha, const amG, const amH, const vDroppedPhi=<>)
Maps the unrestricted (free) parameters back to alpha and beta using the specified restrictions.
Parameters
vP, column vector with unrestricted (free) parameters.
cAlpha int, no of free parameters in alpha.
amG array[r] of G_i G matrices
amH array[r] of H_i matrices, one for each restriction
vDroppedPhi vector[r] indices of the elements of phi that are fixed at unity (default is <> for none)
Returns
{alpha, beta}

static CATS::MapScoreToAlphaBeta(const mDloglikDpi, const mAlpha, const mBeta, const cAlpha, const cBeta, const amG, const amH, const vDroppedPhi)
Maps the score of the scaled log-likelihood of the restricted I(1) model w.r.t. Pi to that w.r.t. theta and phi. Used in DoRestrictAlphaBeta

static CATS::MapToPar(const mB, const amH)
Maps the free parameters in A to a column vector using the specified restrictions.
Parameters
mB[p][r] parameter matrix
amH array[r] of H_i matrices, one for each restriction
Returns
column vector with free parameters
Comments
If each H_i equals I_p, the return value is vec(mB)

static CATS::MapVarToAlphaBetaPiSE(const mAlpha, const mBeta, const mMaa, const mMbb, const mJacA, const mJacB)
Maps the unrestricted (unscaled) variance matrices of the free parameters to standard errors of alpha and beta.
Returns
{se_alpha, se_beta, se_pi}

CATS::MaxControl(const iMaxIt=10000, const iInfo=1000)
Sets maximum iterations and output level for switching.
Parameters
iMaxIt integer max iterations (default is 10000)
iInfo integer print every iInfo iterations (default is 1000)
Comments
For all parameters: use -1 to leave current value unchanged.

CATS::MaxControlEps(const dSwitchCrit=1e-9, const dBFGSCrit=1e-5)
Sets the convergence criterion for switching
Parameters
dSwitchCrit double, convergence epsilon for switching (default is 1e-8)
dBFGSCrit double, convergence epsilon for BFGS (default is 1e-5)

CATS::MaxOptions(const iHybridInit=-1, const iOptions=-1, const cStartSearch=20)
Sets options for switching.
Parameters
iMaxItBFGSstep no of steps for intermediate BFGS in Hybrid method (default -1 to leave current value unchanged; use 0 to reset default)
iOptions options for switching (default is -1 to leave current value unchanged; use 0 to reset default)
cStartSearch no of random starts for hybrid alpha-beta switching (default is 20, -1 to leave current value unchanged)
Comments
For all parameters: use -1 to leave current value unchanged.

static CATS::NormalizePhiInPar( vP, const cBefore, const vDim, const dCutOff=0, const vNormIdxP=<>)
Normalize the unrestricted (free) parameters in beta, adjusting alpha accordingly.
Parameters
vP, column vector with parameters.
cBefore int, no of parameters before phi starts in vP.
vDim[p] dimensions of column-parameters in phi
dCutOff |scale| > cutoff is accepted scale (default is 0)
vNormIdxPhi <> (default) or vector[p] with normalization indices (indices in each column of phi)
Returns
{vP (normalized), vNormIdxP (indices in vP of normalization)}

static CATS::NormalizeThetaPhiInPar( vP, const cAlpha, const amG, const amH, const bApply=FALSE, const vNormBeta=<>)
Normalize the unrestricted (free) parameters in beta, adjusting alpha accordingly.
Parameters
vP, column vector with unrestricted parameters (including normalizations).
cAlpha int, no of free parameters in alpha.
amG array[r] of G_i matrices, only used for dimensions, cannot be empty
amH array[r] of H_i matrices, only used for dimensions, cannot be empty
bApply TRUE: remove normalized elements from phi (default is FALSE to leave them)
vNormBeta <> or vector[r] with valid normalization indices
Returns
{vP (renormalized), vFixPhi (indices in phi), vDropPhi (indices in phi of dropped elements, <> if none), vScale (scale factors used)}

static CATS::Nullspace(const mA)
Returns the orthogonal complement (null space) of a matrix.
Parameters
mA A[m][n] matrix, m >= n with full column rank m.
Comments
Returns the null space of A. If n=0 this is I_m, if n=m this is an empty matrix, else it is the first m-n columns of nullspace(ma). There is currently no error message if A has deficient column rank.

This is different from nullspace:<br> 1. nullspace returns an (m x s) matrix where s is the column rank of A, s >= n;<br> 2. nullspace does not require m >= n.

virtual CATS::Output()
Prints the estimated the model (called by Estimate).
Comments
Switch printing of by calling SetPrint(FALSE).

CATS::OutputBootstrapHeader(const sTitle, const cB, const iType, const time=0)
Prints header of bootstraps report.

CATS::OutputHeader(const sTitle, const asR, const asX)
Prints the estimated the model (called by Output).
Comments
Switch printing of by calling SetPrint(FALSE).

CATS::OutputLogLik(const sExtra="")
Prints the log-likelihood and dimensions.

virtual CATS::OutputOutliers( dSE)

CATS::OutputRestrictionsTest()
Prints the log-likelihood and dimensions.

static CATS::PartialMoments(const mY, const mX, const cT=-1, const fWarn=0, const amPi=0)
Returns (R'R)/T where R are the residuals of regressing Y on X.
Parameters
mY [n][p] matrix
mX [n][k] matrix (may be <>, may be singular)
cT if -1 (the default) uses T=sizer(mY) else T=cT
fWarn TRUE: print warning for singularity or bad scaling (default FALSE)
amPi in: 0 or address of variable out: coefficient matrix Pi' (if array on input)
Returns
[p][p] matrix (R'R)/T

CATS::PrintAlphaBeta(const mAlpha, const mBeta, const mAlphaSe, const mBetaSe, const asY, const mPiSe=<>, const bPiPrint=0)
Writes the beta, alpha and Pi matrices and t-values (or standard errors).
Parameters
mAlpha alpha matrix, may be <>
mBeta beta matrix, may be <>
mAlphaSe standard errors of alpha, may be <>
mBetaSe standard errors of beta, may be <>
cT integer scale
mPiSe standard errors of Pi, may be <>
bPrintPi bool, TRUE: print Pi

CATS::PrintDeterministics()
Prints the Deterministic specification.

CATS::PrintI1Rank(const sExtra="")
Prints the estimates for the current rank.

CATS::PrintI1RankTable(const mTable, const dAlpha, const sHeader, const sFooter="", asTraceAlt=0)
Prints the table of the I(1)-analysis.
Parameters
mTable Table produced by DoI1RankTable
dAlpha Significance level used in table
bDoBartlett boolean, TRUE to if Bartlett correction used in table

static CATS::PrintMat( mA, const mSE, const asRow, const asCol, const asOptions="")
Prints a matrix with standard errors.
Parameters
mA in: matrix to print
mSE in: matrix with standard errors (conforms to A or <>)
asRow in: array with row labels
asCol in: array with column labels
asOptions in: array of strings with options: "t-values", "separate", "%lwr" (default is {})
bSeparate in: TRUE: separate matrices, else se/tvals below each row (default FALSE)

static CATS::ProjectOntoH(const mBeta, const amH, const bIsIdentified=TRUE, const vVpg=<>)
Unrestricted vectors are projected onto H matrices.
Parameters
checked for each vector. of vectors in group i, so adding up to r. Default is <>, in which case the restrictions are analyzed for duplicates.
mBeta[p1][r] unrestricted beta for rank r
amH array[q] of H matrices, one for each restriction
bIsIdentified TRUE: restrictions already known to be identifying, FALSE: rank of rotation
vVpg matrix[q] rank for each restriction. Entry i of vVpg gives the number
Returns
{rotated beta, rotation matrix, is_full_rank_rotation, beta satisfying the restrictions, parameter vector}.
Comments
See Johansen (1995, JEcts), top of p.120.

static CATS::ProjectOntoH_reg(const mBeta, const amH)

static CATS::RROlsQ( mQtY, mQtX, const mQtYsq, const cT, const cR, const mQtZ=<>, const aGamma=0)
Reduced rank regression of Y on X corrected for Z when Q'Y,Q'Z,Q'Z are already available.
Parameters
mQtY [n][p] matrix
mQtX [n][k] matrix
mQtYsq [p][p] matrix, rest of Q'Y'YQ
cT in: sample size
cR in: rank r
mQtZ [n][q] matrix (may be <>, may be singular), default is <>
aGamma in: array, out: gamma (if array and mQtZ != <>)
Returns
{alpha[p][r], beta[k][r], log|Omega|, evals

static CATS::RROlsQ2( mQtY, mQtX, const mQtYsq, const cT, const cR, const mQtZ=<>, const aGamma=0)

static CATS::RanBootstrap(const mResiduals, const iType=0)

static CATS::RankOrder(const mA)
Obtains the rank order of a matrix.
Parameters
m [m][n] matrix.
Returns
returns an [m][n] matrix with the rank order of each element in mX
Comments
The smallest element element has value 0, the largest is mn - 1. Does not handle ties.

virtual CATS::RecursiveAnalysis(const iPlot=0, const cTMin=0, const bEval=FALSE, const bXi=TRUE, const bTrace=TRUE, const bLogLik=TRUE, const bAlpha=FALSE, const bBeta=FALSE, const bFixShortRun=FALSE, bApproxXiSe=TRUE)
Recursive estimation.
Parameters
iPlot int: index of first plot (-1: no plots, default is 0)
cTMin int: min no of observations (<=0: decided here, default is 0)
bEval boolean: TRUE: recursive eigenvalues, FALSE (default): skip
bXi boolean: TRUE (default): recursive transformed eigenvalues, FALSE: skip
bTrace boolean: TRUE (default): recursive trace tests, FALSE: skip
bLogLik boolean: TRUE (default): recursive likelihood constancy, FALSE: skip
bAlpha boolean: TRUE: recursive alpha (only if identified), FALSE (default): skip
bBeta boolean: TRUE: recursive beta (only if identified), FALSE (default): skip
bFixShortRun boolean: TRUE: keep short run fixed (R1 form), FALSE (default): re-estimate short run (X form)
bApproxXiSe boolean: TRUE (default): approximate from last value, FALSE: re-estimate (only for X-form)

CATS::RenewY(const mY)
Replaces the Y estimation data in the underlying database with the specified random sample.
Parameters
mY matrix[T][p] T must match the estimated sample size, which can be obtained by Modelbase::GetcT()
Returns
matrix[T][p] random sample

CATS::ResidualAnalysis()
Prints multivariate and unvariate analysis of the estimated residuals.

virtual CATS::Restrict(const amRes, const vNormBetaOvr=<>)
Estimates the model and prints results for the current rank imposing restrictions on alpha and beta using alpha-beta switching. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
may also contain [method=beta]
amRes array with restrictions, sections are [alpha],[beta] (without sections, [beta] is assumed)
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
success value (0 failure, 1 success)

virtual CATS::RestrictAlphaBeta( amG, amH, const vNormBetaOvr=<>)
Estimates the model and prints results for the current rank imposing restrictions on alpha and beta using alpha-beta switching. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
(same as {G,G,..,G}; <> for unrestricted), or array[r] of strings with restriction expressions
amG array[r] of G_i G matrices ({} for unrestricted alpha), or matrix G with common restriction
amH array[r] of H matrices, one for each restriction ({} for no restrictions), or array[r] of strings with restriction expressions
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
success value (0 failure, 1 success)

CATS::RestrictBeta( amG, amH, vVpg=<>)
Estimates the model for the current rank imposing restrictions on alpha and beta using beta switching. Impose the restriction alpha = G theta, where G is a known (p x q) matrix of dimension (n x S), 0 < S <= R. Restrictions on beta are of the form beta=(H_1 phi_1, H_2 phi_2,...). The H_i must be linearly independent.
Parameters
Or a single matrix or string, which is treated as a common restriction on all columns of beta. of vectors in group i. If the argument is omitted, a vector of ones is used, unless amH is a matrix or string. The sum is the rank of the restricted beta.
amG G matrix (<> for unrestricted alpha) or string with common restrictions on alpha
amH array[q] of H matrices, one for each restriction ({} for no restrictions), or array[q] of strings with restriction expressions.
vVpg vector[q] rank for each restriction. Entry i of vVpg gives the number
Returns
success value (0 failure, 1 success)

static CATS::RowCat(const amA)
Concatenates an array of matrices along the rows.
Parameters
amA array[n] of matrices.
Returns
| on all the matrices in amA

CATS::Seasonals(const iUse=1)

CATS::SetAlphaBetaI1Start(const mAlpha, const mBeta)
Sets current I(1) alpha,beta initial values for the starting value procedures.
No return value

static CATS::SetMaths(const iMaths, const sLabel)
Sets the labels of mathematics symbols.
Parameters
iMaths: one of MATHS_... constants
sLabel: new label

CATS::SetMaxMethodInfo(const sName, const aInfo=<>)
Sets the name of the maximization method.
Parameters
sName: string with new name

CATS::SetNormalization(const bSet)
Sets default normalization mode.
Parameters
bSet: TRUE (most significant alpha) or FALSE (largest beta)

CATS::SetPrintMatOptions(const asOptions, const iAdd=0)
Sets the options for PrintMat
Parameters
asOptions in: array of strings with options: "t-values", "separate", "%lwr"
iAdd in: 0: replace existing options, 1: add to options (default), -1: remove from options
Returns
array with current options

CATS::SetRadius(const dRadius=1.00001)
Sets the radius of 'unit' circle (default is 1.00001).
Parameters
dRadius in: double, sets new radius if >0
Returns
current radius
Comments
Used by IsOutsideCircle

static CATS::SetTrackProgress(const bTrack)
Sets progress tracking of iterative maximizers.
Parameters
bTrack: TRUE or FALSE

CATS::SetUseDefaultSeed(const bSet)
Sets usage of default seed for simulations and bootstraps on (TRUE) or off (FALSE, default setting).
Parameters
bSet: TRUE or FALSE

CATS::ShortRun()
Prints the short-run coefficients.

CATS::ShortRunEval(const mAlpha=0, const mBeta=0, const mOmega=0, const bDoStdDev=FALSE)
Calculates the shortrun coefficients of the current model.
Parameters
mAlpha[p][r] matrix (or int 0 for current alpha, the default)
mBeta[p][r] matrix (or int 0 for current beta, the default)
mOmega[p][p] matrix (or int 0 for current omega, the default)
bDoStdDev TRUE: compute standard errors (default is FALSE)
Returns
array of four matrices: { Gamma_i[p][p * (k-1)] for lagged differences of y_t, Phi[p][] remainder, SE[Gamma_i], SE[Phi] } where m is the maximum lag length (gaps will be set to zero), and the SE matrices will be empty if bDoStdDev is FALSE (the default).

virtual CATS::ShrinkSample(const cDrop, const cTmin=1, const bFixShortRun=FALSE)
Shrinks the estimation sample, but doesn't re-estimate yet.
Parameters
cDrop int: number of observations to shrink the sample by
cTmin int: don't shrink past this sample size
bFixShortRun boolean: TRUE: keep short run fixed (R1 form), FALSE (default): re-estimate short run (X form)
Returns
TRUE if shrinkage was successful.

CATS::SimulateRankDet(const cTsim, const bPrint)
Simulates and reports the asymptotic distribution of the I(1) rank test in the presence of breaks in the restricted deterministic terms.
Parameters
cTsim Length of random walks (T, optional argument, default is 400)
cM Number of replications (M, optional argument, default is 1000)
Returns
array[3] {table with tests and p-values, table of Gamma quantiles, table of simulated quantiles }

CATS::SimulateRankTest(const cTsim=400, const cM=1000)
Simulates and reports the asymptotic distribution of the I(1) rank test in the presence of breaks in the restricted deterministic terms.
Parameters
cTsim Length of random walks (T, optional argument, default is 400)
cM Number of replications (M, optional argument, default is 1000)
Returns
array[3] {table with tests and p-values, table of Gamma quantiles, table of simulated quantiles }

static CATS::SolveRRR(const mS00, const mS01, const mS11, const amEigVal, const amEigVec, const cR=-1)
Solves the I(1) pencil |\lambda S_{11} - S_{10}S_{00}^{-1}S_{01}|.
Parameters
out: (r x 1) column vector with eigenvalues (<> if r==0 or failed) out: (r x r) matrix with eigenvectors in sizec, r=min(p,p1) (<> if r==0 or failed)
mS00 in: symmetric positive definite matrix S_{00}[p][p]
mS01 in: matrix S_{01}[p][p1]
mS11 in: symmetric matrix S_{11}[p1][p1]
cR in: optional rank R: r=(R,min(p,p1)); ignored if <0 (the default)
amEigVal in: address
amEigVec in: address
Returns
log|S_{00}| (.NaN if eigensymgen failed, .Inf if mS00 singular)

static CATS::SplitRestrictions(const asRes, const asSections, const aaH1, ...)
Split restrictions array by sections. Prints a warning for an error.
Parameters
asRes array to split by section
asSections array[q] strings with section labels
aaH1 first section
.. second section (or {}), etc

static CATS::StatComp(const mAlpha, mBeta, const amGamma, const iLags, const mS00, const amP, const amQ)
Creates the companion matrix P and the matrix Q for the stationary process Y(t).
Parameters
out: P matrix out: Q matrix
mAlpha matrix
mBeta matrix
mGamma array[lags - 1] of Gamma_i[p][p] matrices
cLags integer, autoregressive lag length
mS00 unrestricted variance matrix
amP in: address
amQ in: address
Comments
Creates the companion matrix P and the matrix Q for the stationary process Y(t) = P*Y(t-1) + Q*epsilon(t) where Y(t) = (X(t)'Beta,DX(t)',....,DX(t-k+2)')'.

CATS::TestAlphaCommon( mG)
Tests restricted alpha, where alpha = (G*theta_1,theta_2) and G is a known matrix.
Parameters
amG G matrix of dimension (n x S), 0 < S < r, or string.
Returns
array[6] {test, p-value, alpha, beta, omega, df}

CATS::TestAlphaKnown(const mG)
Tests restricted alpha, where alpha = (G,G_orthogonal psi) and G is a known matrix.
Parameters
mG G matrix of dimension (n x S), 0 < S <= r.
Returns
array[6] {test, p-value, alpha, beta, omega, df}
Comments
Known alpha restrictions cannot be combined with restrictions on beta.

static CATS::TestDiff(const x, const y)
Computes a scaled norm of the difference of two vectors.
Returns
Computes min_i{ |(y[i] - x[i]) / x[i]|, |(y[i] - x[i])|} for each element in the vectors x,y and returns the maximum of that.

virtual CATS::TestEach(const bAlpha=TRUE, const bBeta=TRUE)
Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
Parameters
bAlpha TRUE: Weak exogeneity and unit vectors (default)
bBeta TRUE: Variable exclusions and stationarity (default)
Returns
array[4]: matrix of tests results (first column test, 2nd pvalues) for each case: long-run, stationarity, weak exoegenity, unit alpha

virtual CATS::TestEachAllRanks(const bAlpha=TRUE, const bBeta=TRUE)
Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
Parameters
bAlpha TRUE: Weak exogeneity and unit vectors (default)
bBeta TRUE: Variable exclusions and stationarity (default)
Returns
array with three elements: vector of tests for each.

CATS::TestEachBetaRestriction( fnGetG, fnGetH, const vVpg, const asZ, const cRes, const sType)
Tests similar restrictions over a range of elements using beta switching.
Parameters
fnGetG function returning common restriction on alpha
fnGetH function returning restrictions on beta
vVpg vector with multiplicity of restrictions on beta
cRes no of restrictions imposed
sType type of restrictions (for output)
Returns
matrix of tests results (first column test, 2nd pvalues).

virtual CATS::TestForecastGraphics(const bExp)

virtual CATS::TestGraphicAnalysis()
Plots residuals and ACF.

static CATS::TestRanksAndFix(const amH, const amR, const vIndex, const amHnew, const amRnew)
Used for the automatic Beta-space identification scheme. Test the rank of a range of H matrices, fixing the rank if needed (and possible).
Parameters
amH array of H matrices
amH array of R matrices, the orthogonal complements the H matrices
vIndex vector with indices of H to consider from amH
amHnew address on input, if successful: new H matrix on output
amRnew address on input, if successful: new R matrix on output
Returns
-1 if failed, otherwise index in amH, amR of new H,R matrices

virtual CATS::TestSummary()

CATS::Trend( mode)
Specifies the trending behaviour of the model.
Parameters
Equivalently, use the strings "H_z","H_c","H_lc","H_l", or the predefined constants CATS::NONE, CATS::CIMEAN, CATS::DRIFT, CATS::CIDRIFT.
mode string: one of "NONE","CIMEAN","DRIFT","CIDRIFT".
Comments
Sets m_iDetTrend, which is used in InitData to add the Constant and Trend to the model. InitData takes the Constant and Trend that are specified through Select into account (and updates m_iDetTrend if necessary).

m_iDetTrend is set to CATS::NONE by default.

The I(1) hypotheses are:

X_VARU_VARU_VAR
HypothesisConstantTrend
H_z
H_c
H_lc
H_lX_VAR
The string argument is case sensitive.

virtual CATSI2::ACTest_LM(const mResid, const iOrder=1)
Performs the LM test for autocorrelation in an I(2) model.
Parameters
mResid matrix of residuals [T][p]
iOrder integer, lag length for test (default is 1)
Returns
the test statistic

CATSI2::BootstrapRankTest( cB=399, const iType=0)
Bootstraps and reports the bootstrap distribution of the rank test for the current specification.
Parameters
cB Number of bootstrap replications (B, optional argument, default is 399)
iType Type of bootstrap sampling: BS_WILD (Wild N[0,1], the default), BS_IID (IID resampling), BS_SIGN (+1,-1)
Returns
array[2] {table with tests and p-values, table of quantiles}

CATSI2::CATSI2()
Constructor.

static CATSI2::DeltaSwitching(const mAlpha, const mBeta, const amH, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
Delta-switching algorithm for the I(2)-model.
Parameters
mAlpha matrix [cz0][r] initial alpha
mBeta matrix [cz1][r] initial beta
iS integer 0 <= S < cz0-r
amH array[r] with H matrices or {}
mQtZ0,...,mQtZ0sq transformed data matrices
cT int, sample size
dCrit double, convergence tolerance (default 1e-6)
iMaxIt int, maximum number of iterations (default 1000)
iInfo int, >0: print output for every iInfo-th iteration (default 0)
Returns
array with 10 elements: { alpha, alpha_ort, tau, rho, psi, kappa, w, omega, log-determinant, retval (MAX_CONV, MAX_WEAK_CONV, MAX_NOCONV, MAX_FUNC_FAIL) }

CATSI2::DoDeltaSwitching(const mAlpha, const mBeta, const amH=<>, const viNorm=<>)
Estimation using delta-switching algorithm for ML-estimation of the I(2)-model.
Parameters
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
iS integer 0 <= s <= cz0-r (s==s1)
amH array[r] of H matrices
viNorm normalization vector, or <>: apply automatic normalization
Returns
the log-likelihood

CATSI2::DoDeltaSwitchingLogLik(const mAlpha, const mBeta, const iS1)
As DoDeltaSwitching but without setting estimates, only returning the log-likelihood, alpha and beta. Does not set any member variables of the object.

virtual CATSI2::DoEstimation( vPar)
Estimates the model (called by Estimate).
Parameters
vPar vector of initial parameters (ignored, all zero here)
Returns
vec(alpha)|vec(beta)|vec(Omega)

CATSI2::DoI2RankTable(const dAlpha=0.05, const iDoMLE=1)
Computes the table of the I(1)-analysis.
Parameters
(default is 0.05 for 95% quantiles)
dAlpha Significance level to be used in table when p-values are not available
iDoMLE 0: two-step, 1: ML using delta switching (default), 2: ML using triangular switching, 3: ML using tau switching
Returns
array with four matrices: tests, pvalues, quantiles, iteration_counts

CATSI2::DoI2RankTable_2step()
Computes the table of the I(1)-analysis using two-step estimation.
Returns
matrix with the table

CATSI2::DoI2Residuals(const mPi, const mGamma)
Computes the residuals of the I(2) model z0_t = Pi z1_t - Gamma z2_t + rest.
Parameters
mPi matrix Pi[m_cY][cz1]
mGamma matrix Gamma[m_cY][cz2]
Returns
residual matrix [m_cT][m_cY]
Comments
Runs the regression, in matrix form: Z0 - Z1 Pi_hat' + Z1 Gamma_hat' = Z2 Psi' + epsilon.

virtual CATSI2::DoMoments()
Partials out z3 and creates the transformed data matrices QZi that are needed for estimation.
Comments
Creates m_mZ0I2_Z3, m_mZ1I2_Z3, m_mZ2I2_Z3, m_mQtZ0sqI2_Z3, m_mQtZ0I2_Z3, m_mQtZ2I2_Z3, m_mQtZ1I2_Z3.

CATSI2::DoRestrictAlphaBeta( amA, amH, const vNormBetaOvr, bSetZeroV13, const dCrit, const iMaxIt, const iInfo, const dBFGSCrit, const iMaxItBFGS, const iSwitchOptions=0, const cStartSearch=20)
Estimates the model and prints results for the current rank imposing restrictions on alpha and beta. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
(same as {G,G,..,G}; <> for unrestricted), or array[r] of strings with restriction expressions
amG array[r(+s1+s2)] of G_i G matrices ({} for unrestricted alpha), or matrix G with common restriction
amH array[r(+s1+s2)] of H matrices, one for each restriction ({} for no restrictions), or array[r] of strings with restriction expressions
bSetZeroV13 TRUE: set V13 (and hence d) to zero, FALSE (default): leave unrestricted
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
success value (0 failure, 1 success)

CATSI2::DoSetI2Rank(const iS, const iTriangular=-1)
Sets the I(2) to s==s1, 0 <= s <= p-r, after estimating the VAR.
Parameters
iS integer, I(2) rank s (== s1)
iTriangular <=1: use delta switching (the default), 2: use Triangular switching, 3: Tau switching
Comments
Use I2Rank and I1Rank to specify the rank prior to estimation. Called by DoEstimation to complete the estimation for the specified rank. DoSetI2Rank can be called after estimation to change the rank.

CATSI2::DoTauSwitching(const mAlpha, const mBeta, const mH=<>)
Estimation using tau-switching algorithm for ML-estimation of the I(2)-model.
Parameters
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
mH matrix, restrictions matrix H with common restrictions or empty matrix for unrestricted
Returns
the log-likelihood

CATSI2::DoTauSwitchingLogLik(const mAlpha, const mBeta, const iS1)
As DoTauSwitching but without setting estimates, only returning the log-likelihood, alpha and beta. Does not set any member variables of the object.

CATSI2::DoTriSwitching(const mAlpha=<>, const mBeta=<>)
Estimation using triangular-switching algorithm for ML-estimation of the I(2)-model without restrictions on A,B.
Parameters
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
Returns
the log-likelihood

CATSI2::DoTriSwitchingLogLik(const mAlpha, const mBeta, const iS1)
As DoTriSwitching but without setting estimates, only returning the log-likelihood, alpha and beta.
Parameters
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
iS1 I(2) rank
Returns
the log-likelihood, alpha, beta, gamma

CATSI2::DoUpdateEstimates_I2(const mAlpha, const mTau, const mRho, const mPsi, const mKappa, const mWterm, const mOmega, const dLogDet, viNorm=<>)
Updates the I(2) model after estimation.
Parameters
mAlpha, .., mWterm matrices from estimation
dLogDet double, new log|Omega|
viNorm normalization vector, or <>: apply automatic normalization
Returns
log-likelihood

CATSI2::DoUpdateEstimates_I2_AB(const mA, const mB, const mV, const iR, const iS1, const dLogDet, const vNorm=<>)
Updates the I(2) model after estimation.
Parameters
mA,mB,mV matrices from estimation
iR rank r
iS1 rank s
dLogDet double, new log|Omega|
viNorm normalization vector or <>: normalize automatically
Returns
log-likelihood

virtual CATSI2::EstimateAlphaBeta( amG, amH, const vNormBetaOvr=<>, bSetZeroV13=FALSE)
Estimates the model using triangular switching but doesn't make it the current model.
Parameters
amG array[r] of G_i matrices
amH array[r] of H_i matrices
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
bSetZeroV13 TRUE: set V13 (and hence d) to zero, FALSE (default): leave unrestricted
Returns
array {alpha, beta, retval, loglik, isidentified, no of restrictions, se_alpha, se_beta}
note
does not change any member variables, so can be called in parallel

CATSI2::EstimateTau( mH)
Test the **same** linear restrictions on all Tau vectors. The restrictions have the format tau = H*Phi, H(DimZ1,M), Phi(M,R+S), 0 < M < DimZ1.
Parameters
mH matrix of restrictions H (or R if bIsR is TRUE)
Comments
Doesn't change the current model

CATSI2::EvalBetaSe()
Computes standard errors of current beta, psi, dee.
Returns
matrix of standard errors of current beta (<> if not identified)

CATSI2::GenerateAsY_I2(const mEps, const mAlpha, const mBeta, const mGamma, const mPsis, const mPhi)
Generates a random sample formulated as the current I(2) model, but with specified coefficients.
Parameters
if the I(2) model has s_1=p-r: Gamma_{I(2)} = Gamma_{I(1)} : -mu)
mEps matrix[T][p] error term for the random sample (must match the estimated sample size, which can be obtained by Modelbase::GetcT())
mAlpha[p][r] matrix or <>
mBeta[p1][r] matrix or <>
mGamma[p][p1] matrix, note sign: DDy_t=alpha*beta'y_{t-1} - Gamma Dy_{t-1} + ... (note the optional extra column,
mPsis[p][p * (k - 2)] matrix with coefficients on lagged double differences or <>
mPhi[p][d] matrix with coefficients on remaining short-run variables
Returns
matrix[T][p] random sample

static CATSI2::GenerateECM_I2(const cT, const iDet, const mAlpha, const mBeta, const mGamma, const mPsis=<>, const mPhi=<>, const mOmegaSqrt=<>, const mYinit=<>, const mYmean=<>)

virtual CATSI2::GenerateY( mEps=<>)
Generates a random sample from the current model.
Parameters
mEps matrix[T][p] error term for the random sample (must match the estimated sample size, which can be obtained by Modelbase::GetcT())
Returns
matrix[T][p] random sample

CATSI2::GetAWithSe()
Gets A with standard errors.
Returns
{A, SE[A]}

CATSI2::GetAlphaOrt1WithSe()
Calculates the alpha_ort1 with asymptotic standard errors.
Returns
array with 2 matrices: { alpha_ort1, SE[alpha_ort1] }

CATSI2::GetAlphaOrt2WithSe(const viNorm=<>)
Calculates the alpha_ort2 with asymptotic standard errors.
Parameters
viNorm [n] specified override of normalization (optional argument, default is <>: do not override)
Returns
array with 2 matrices: { alpha_ort2, SE[alpha_ort2] }

CATSI2::GetBWithSe()
Gets B with standard errors.
Returns
{B, SE[B]}

CATSI2::GetBetaSe()
Gets standard errors of current beta.
Returns
matrix of standard errors of current beta (<> if not identified)

virtual CATSI2::GetCompanion(const amRoots=0)
Returns the companion matrix based on the current model, optionally with roots.
Parameters
out: if array, amRoots will hold an [n][4] matrix : real part, imaginary part, absolute value and argument.
amRoots in: array or 0 (default if no arguments)
Returns
companion matrix

CATSI2::GetDeeEe()
Gets the current dee and ee matrices.
Returns
array with two matrices: d[p1][r], e[p1][p],

static CATSI2::GetDeeEeFrom(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)

CATSI2::GetDeeEeSe()
Gets standard errors of current dee and ee.
Returns
array[2] {matrix of standard errors of current dee, matrix of standard errors of current ee, matrix of standard errors of current ee (not taking restrictions on A1 into account)}

CATSI2::GetDeltaZeta()
Gets the current delta and zeta matrices.
Returns
array with two matrices: delta[r][s2*], zeta[p][r+s],
Comments
Note that zeta is not unique when beta is identified: it depends on the chosen normalization of B_1. Same for delta depending on B_2.

static CATSI2::GetDeltaZetaFrom(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)

CATSI2::GetDeltaZetaSe()
Gets standard errors of current delta and zeta.
Returns
array[2] {matrix of standard errors of current delta, matrix of standard errors of current zeta}

virtual CATSI2::GetDimensions(const sType="")
Get model dimensions.
Parameters
sType string: type of dimension ("p","p1","r","s","s2","R") or default "" for array with all
Returns
array with {p, p_1, r, s, s2, R (no of restrictions imposed)} or single dimension
Comments
Also see GetLags

CATSI2::GetGamma()
Gets the current Gamma matrix (coefficient of lagged second difference).
Returns
matrix Gamma[p][p1]

static CATSI2::GetGammaFrom_I2(const mAlpha, const mTau, const mPsi, const mKappa, const mWterm)
Gets the Gamma matrix from tau, psi, kappa and w.
Parameters
mAlpha matrix
mTau matrix
mPsi matrix
mKappa matrix
mWterm matrix
Returns
Gamma[p0][p1]

CATSI2::GetPsiKappa()
Gets the current psi and kappa matrices.
Returns
array with two matrices: psi[p1][r], kappa[r+s][p-r]

static CATSI2::GetPsiKappaFrom(const mAlpha, const mTau, const mGamma, const mOmega)

CATSI2::GetPsiKappaSe()
Gets standard errors of current psi and kappa.
Returns
array[2] {matrix of standard errors of current psi, matrix of standard errors of current kappa}

virtual CATSI2::GetRegsLongRun(const fCorrected=TRUE)
Gets the long-run regressors, optionally corrected for the short-run regressors.
Parameters
fCorrected, TRUE: corrected for short-run (default), else uncorrected.
Returns
(T x cZ1) matrix

virtual CATSI2::GetRegsMediumRun(const fCorrected=TRUE)
Gets the medium-run regressors, optionally corrected for the short-run regressors.
Parameters
fCorrected, TRUE: corrected for short-run (default), else uncorrected.
Returns
(T x cZ1) matrix

CATSI2::GetTheta()
Gets the current Theta matrix
Returns
matrix Theta[p][p]

static CATSI2::GetTriFrom(const mAlpha0, const mBeta0, const mGamma0, const iS1, const bFixGamma_c=TRUE)

CATSI2::GetVWithSe()
Gets V with standard errors.
Returns
{V, SE[V]}

CATSI2::GetWWithSe()
Gets W with standard errors.
Returns
{W, <>}

virtual CATSI2::GetZ0()
Gets Z_0, the double-differenced Y.
Returns
(T x p) matrix with Z_0 = DDY

virtual CATSI2::GetZ0Names()
Gets the names of Z_0, the double-differenced Y.
Returns
array[2] with names

virtual CATSI2::GetZ1()
Gets Z1, the medium-run regressors.
Returns
(T x cZ1) matrix with Z_1 = DY_1 ~ [1] ~ DX_1

virtual CATSI2::GetZ2()
Gets Z2, the long-run regressors.
Returns
(T x cZ2) matrix with Z_2 = Y_1 ~ [t] ~ X_1

virtual CATSI2::GetZ3()
Gets Z3, the long-run regressors.
Returns
(T x cZ3) matrix with Z_3 = [DDY_1 .. DDY_{k-1}] ~ [DDX1 .. DDX1_{m-1}] ~ U

virtual CATSI2::GetcDfLoss()
Degrees of freedom lost (no of estimated parameters).
Returns
number of estimated parameters

virtual CATSI2::GraphicAnalysis(const iPlot=0, const bActualFitted=FALSE, const bActualFittedCross=FALSE, const iResiduals=2, const iCointegration=2, const iAcf=1, const iAcfLag=-1, const iDensity=0, const iRootsPlot=0, const iLevelsPlot=0, const iEqn=-1)
Graphical analysis.
Parameters
iPlot int: index of first plot
bActualFitted TRUE: include plots of actual and fitted
bActualFittedCross TRUE: include crossplots of actual and fitted
iResiduals >0: include plots of 1: residuals, 2: scaled residuals, 3: standardized to IN[0,1] residuals (as in normality test)
iCointegration >0: cointegrating vectors, 1: one plot, 2: individual plots
iAcf >0: include ACF plots of 1: residuals, 2: squared residuals
iAcfLag: lag length for ACF plots (<=0 then using default)
iDensity >0: include histogram and QQ plots of residuals
iRootsPlot >0: include roots of companion matrix
Returns
int: number of plots created.

virtual CATSI2::I1Rank(const iR)
Sets the I(1) cointegrating rank r and switches to an I(1) model.
Parameters
iR integer, 0 <= r <= p
Comments
This changes the model class to I1.

CATSI2::I2Rank(const iS)
Sets the I(2) rank s1 prior to estimating the VAR and switches to an I(2) model.
Parameters
iR integer, 0 <= r + s1 <= p
Comments
This changes the model class to I2.

CATSI2::I2RankMLE(const bPrint)

CATSI2::I2RankTable(const iDoMLE=1)
Computes and prints the default I(2) rank test table.
Parameters
iDoMLE 0: two-step, 1: ML using delta switching (default), 2: ML using triangular switching
Returns
array with three matrices: tests, pvalues, quantiles

CATSI2::I2RankTablePvals(const mTests, const dAlpha)
Gets the p-values and fractiles for the test table of the I(2)-analysis.
Parameters
mTests matrix[cZ0][cZ0+1] with test statistics
dAlpha
Returns
matrix with p-values and matrix with 95% fractiles

CATSI2::I2SwitchStart(const fnSwitching, const mAlpha, const mBeta, const iS1, const mAlpha2=<>, const mBeta2=<>)
Starting values for tau-switching algorithm.
Parameters
fnSwitching function: TauSwitching or DeltaSwitching derived
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
Returns
{alpha, beta, gamma, log-determinant}

CATSI2::Init()
Reset the transitory properties.

virtual CATSI2::InitData()
Checks the model formulation and creates the data matrices.

virtual CATSI2::IsI2()
Checks if this is an I2 model.
Returns
TRUE for I(2), FALSE otherwise

static CATSI2::JacI2Model_AB(const vP, const vSelV, const vInitV, const cZ0, const cZ1, const iR, const iS, const amG, const amH, const vDroppedPhi=<>, const bNumerical=FALSE)
Used in RestrictAlphaBeta

static CATSI2::LogdetI2Model_AB(const vP, const mA, const mB, const mV, const mW, const vSelV, const iR, const iS, const adFunc, const avScore, const amHessian, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const amG, const amH, const vDroppedPhi, const mJac, const bAsympSE)

virtual CATSI2::MARep()
Prints the matrices of the moving average representation.

static CATSI2::MapGammaToPar1(const mAlpha, const mBeta, const mGamma, const mXi, const mEta, const iS1, const mJ, const bUseKappa=TRUE)

static CATSI2::MapMatToPar_AB(const mA, const mB, const mV, const vSelV, const iR, const iS, const amG, const amH)
Used in RestrictAlphaBeta

static CATSI2::MapParToMat_AB( vP, const vSelV, const vInitV, const cZ0, const cZ1, const iR, const iS, const amG, const amH, const vDroppedPhi=<>)

static CATSI2::MapScore_AB(const mDloglikDpi, const mA, const mB, const amG, const amH, const vDroppedPhi=<>)

virtual CATSI2::Output()
Prints the estimated the model (called by Estimate).
Comments
Switch printing off by calling SetPrint(FALSE).

CATSI2::PrintI2Rank(const sExtra="")
Prints the estimates for the current rank.

CATSI2::PrintI2RankTable(const mTests, const mPvals, const mFrac95, const sType="", const bWarn=TRUE)
Prints the table of the I(2)-analysis.
Parameters
mTests matrix with test statistics
mPvals matrix with p-values
mFrac95 matrix with 95% fractiles, used when p-values are missing

virtual CATSI2::Restrict(const amRes, const vNormBetaOvr=<>)
Estimates the model and prints results for the current rank imposing restrictions on alpha and beta. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
may also contain [method=beta], [method=delta], [method=tau]
amRes array with restrictions, sections are [alpha],[beta] (without sections, [beta] is assumed)
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
success value (0 failure, 1 success)

virtual CATSI2::RestrictAlphaBeta( amA, amH, const vNormBetaOvr=<>, bSetZeroV13=FALSE)
Estimates the model and prints results for the current rank imposing restrictions on alpha and beta. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
(same as {G,G,..,G}; <> for unrestricted), or array[r] of strings with restriction expressions
amG array[r(+s1+s2)] of G_i G matrices ({} for unrestricted alpha), or matrix G with common restriction
amH array[r(+s1+s2)] of H matrices, one for each restriction ({} for no restrictions), or array[r] of strings with restriction expressions
bSetZeroV13 TRUE: set V13 (and hence d) to zero, FALSE (default): leave unrestricted
vNormBetaOvr <> (default) or vector[r] with normalization indices (-1 for free to choose) used to override normalization of the restrictions
Returns
success value (0 failure, 1 success)

CATSI2::RestrictBeta( mG, amH)
Estimates the I(2) model with linear restrictions on each beta vector using delta switching. Impose the restriction alpha = (G_i theta_i) and beta=(H_i phi_i). The H_i must be linearly independent.
Parameters
(same as {G,G,..,G}; <> for unrestricted), or array[r] of strings with restriction expressions
amG matrix G with common restriction (I1 version only), otherwise ignored
amH array[r] of H matrices, one for each restriction ({} for no restrictions), or array[r] of strings with restriction expressions

CATSI2::RestrictTau( mH)
Impose the **same** linear restrictions on all Tau vectors. The restrictions have the format tau = H*Phi, H(DimZ1,M), Phi(M,R+S), 0 < M < DimZ1.
Parameters
mH matrix of restrictions H

static CATSI2::RotateRho(const iR, const iS, mTau, mKappa, mRho)
Rotates rho (I | 0), offsetting tau and kappa.
Returns
array { tau, kappa, rho }

CATSI2::ShortRun()
Prints the short-run coefficients of the I(2) model.

CATSI2::ShortRunEval_I2(const bDoStdDev=FALSE, const mAlpha=0, const mBeta=0, const mGamma=0, const mTau=0, const mPsi=0, const mOmega=0)
Calculates the shortrun coefficients of the current I(2) model.
Parameters
bDoStdDev TRUE: compute standard errors (default is FALSE)
mAlpha[p][r] matrix (or int 0 for current alpha, the default)
mBeta[p][r] matrix (or int 0 for current beta, the default)
mGamma matrix[p][p1] (or int 0 for current Gamma, the default)
mTau matrix (or int 0 for current Tau, the default)
mPsi matrix (or int 0 for current Psi, the default)
mOmega matrix[p][p] (or int 0 for current Omega, the default)
Returns
array of four matrices: { Psi_i[p][p * (k-2)] for lagged differences of y_t, Phi[p][] remainder, SE[Gamma_i], SE[Phi] } where k is the maximum lag length, and the SE matrices will be empty if bDoStdDev is FALSE (the default).

virtual CATSI2::ShrinkSample(const cDrop, const cTmin=1, const bFixShortRun=FALSE)
Shrinks the estimation sample, but doesn't re-estimate yet.
Parameters
cDrop int: number of observations to shrink the sample by
cTmin int: don't shrink past this sample size
bFixShortRun boolean: TRUE: keep short run fixed (R1 form), FALSE (default): re-estimate short run (X form)
Returns
TRUE if shrinkage was successful.

CATSI2::SimulateRankTest(const cTsim=400, const cM=1000)
Simulates and reports the asymptotic distribution of the I(1) rank test in the presence of breaks in the restricted deterministic terms.
Parameters
cTsim Length of random walks (T, optional argument, default is 400)
cM Number of replications (M, optional argument, default is 1000)
Returns
array[3] {table with tests and p-values, table of Gamma quantiles, table of simulated quantiles }

static CATSI2::SolveConditional(const mAlpha, const mTau, const mAlphaOrt, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
Solves the conditional equation from the tau representation.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
mAlphaOrt[p][p-r] mAlpha_ort
iS1 I(2) rank
mQtZ0 ... mQtZ0sq transformed data matrices
cT int, sample size
Returns
array with six elements: {gamma, omega, tau (rotated to beta~B1), kappa, psi, w}

static CATSI2::SolveDeltaForAlpha(const mAlpha, const mTau, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
Solve the delta representation given tau and tau_ort to get the remaining parameters
Parameters
mAlpha[p][r] alpha
mTau[p1][r+s] tau
mQtZ0 ... mQtZ0sq transformed data matrices
cT int, sample size
Returns
array with five elements: { alpha, gamma, omega, delta, zeta }.

static CATSI2::SolveDeltaForGammaStart(const mAlpha, const mBeta, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
Get starting values for I(2) algorithm from alpha,beta with restricted beta from the delta representation.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
iS1 I(2) rank
mQtZ0 matrix[cz0][cz0] Q'Z0 corrected for z3
mQtZ1 matrix[cz1][cz1] Q'Z1 corrected for z3
mQtZ2 matrix[cz1][cz1] Q'Z2 corrected for z3
mQtZ0sq matrix[cz0][cz0] rest of Z0'Z0 corrected for z3
cT int, sample size
Returns
array with four elements: alpha, beta, gamma, omega

static CATSI2::SolveDeltaForGammaStart2(const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)

static CATSI2::SolveDeltaForTau(const mAlpha, const iR, const iS1, const mDelta, const mZeta, const mOmega, const mH1, const mH2, const mQtZ0, const mQtZ1, const mQtZ2)
Solve the delta representation given tau_ort, zeta, omega to get tau
Parameters
mAlpha[p][r] alpha
mZeta[p][r+s] zeta
mOmega[p][p] Omega
mH1 restrictions on vec(beta) or <>
mH2 restrictions on vec(beta_1) or <> (either have both H1 and H2 empty or neither)
mQtZ0 ... mQtZ0sq transformed data matrices
cT int, sample size
Returns
{tau[p1][r+s], vectorized parameters in tau, delta}.

static CATSI2::SolveMarginal(const mAlpha, const mBeta, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
Solves the marginal equation from the tau representation.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
iS1 I(2) rank
mQtZ0 ... mQtZ0sq transformed data matrices
cT int, sample size
Returns
array with six elements: {xi, eta, tau, kappa, alpha_ort, beta_ort, eval}

static CATSI2::SolveTauForAlpha(const iR, const mTau, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT)
Solve the tau representation to get alpha.
Parameters
iR rank r
mAlpha[p][r] current alpha (will choose rotation to minimize distance of new alpha to old one)
mTau[p1][r+s] initial values for tau
mQtZ0 ... mQtZ0sq adjusted data matrices
cT int, sample size
Returns
array with two elements: { alpha, alpha_ort }.

static CATSI2::SolveTauForTau(const mAlpha, const mAlphaOrt, const iR, const iS1, const mRho, const mW, const mKappa, const mOmega, const mH, const mQtZ0, const mQtZ1, const mQtZ2)
Solve the delta representation given tau_ort, zeta, omega to get tau
Parameters
mAlpha[p][r] alpha
mAlphaOrt[p][p-r] alpha orthogonal
mRho[r+s][rs] rho
mPsi[p1][r] psi
mW[p][p-r] w
mKappa[r+s][p-r] kappa
mOmega[p][p] Omega
mQtZ0 ... mQtZ0sq adjusted data matrices
cT int, sample size
Returns
{tau[p1][r+s], vectorized parameters in tau}.

static CATSI2::TauSwitching(const mAlpha, const mBeta, const mH, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit=1e-6, const iMaxIt=1000, const iInfo=0, const iLineSearch=2)
Tau-switching algorithm for the I(2)-model.
Parameters
mAlpha matrix [cz0][r]
mBeta matrix [cz1][r]
iS integer 0 <= S < cz0-r
mH matrix[r+s][q] with H matrix for common restriction on tau
mQtZ0,...,mQtZ0sq transformed data matrices
cT int, sample size
dCrit double, convergence tolerance (default 1e-6)
iMaxIt int, maximum number of iterations (default 1000)
iInfo int, >0: print output for every iInfo-th iteration (default 0)
Returns
array with 10 elements: { alpha, alpha_ort, tau, rho, psi, kappa, w, omega, log-determinant, retval (MAX_CONV, MAX_WEAK_CONV, MAX_NOCONV, MAX_FUNC_FAIL) }

virtual CATSI2::TestEach(const bAlpha=TRUE, const bBeta=TRUE)
Tests variable exclusion, variable stationarity, long-run weak exogeneity, unit vector in alpha.
Parameters
bAlpha TRUE: Weak exogeneity and unit vectors (default)
bBeta TRUE: Variable exclusions and stationarity (default)
Returns
array with seven elements: matrix of tests for each (tests in first column, pvalues in second).

CATSI2::TestEachBetaRestriction( fnGetG, fnGetH, const vVpg, const asZ, const cRes, const sType)
Tests similar restrictions over a range of elements using alpha,beta switching.
Parameters
fnGetG function returning common restriction on alpha (one for each entry in asZ)
fnGetH function returning restrictions on beta (one for each entry in asZ)
vVpg vector with multiplicity of restrictions on beta
asZ array of test descriptions
cRes not used
sType type of restrictions (for output)
Returns
matrix of tests results (first column test, 2nd pvalues).

static CATSI2::TriGetVFromAB(const mA, const mB, const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const bSetZeroV13=FALSE)
Get V from A,B and the data
Parameters
mA[p][p]
mB[p1][p1]
mV[p][p1]
iR rank of Pi
iS1 rank of alpha_ort'Gamma*beta_y,ort
mQtZ0,mQtZ1,mQtZ2 : data matrices
bSetZeroV13: set V13 to zero (default is FALSE)
Returns
V

static CATSI2::TriNormalize(const mA, const mB, const mV, const iR, const iS1, const bA1IsFree=FALSE, const bA2IsFree=FALSE, const bB1IsFree=FALSE, const bB2IsFree=FALSE, const vNormBOverride=<>)

static CATSI2::TriOrthogonalize12(const mA, const mB, const mV, const iR, const iS1, const bA1IsFree, const bA2IsFree, const bB1IsFree, const bB2IsFree)

static CATSI2::TriRegularizeV(const mA, const mB, const mV, const iR, const iS1, const bA1B1IsFree, const bB2IsFree)

static CATSI2::TriRemoveW(const mA, const mV, const mW, const iR)

CATSI2::TriStart(const mAlpha, const mBeta, const cAlpha, const cBeta, const iR, const iS1, const amG=<>, const amH=<>, const mAlphaI2=<>, const mBetaI2=<>)
Get starting values for triangular switching algorithm trying several options.
Parameters
mAlpha[p][r] initial values for alpha
mBeta[p1][r] initial values for beta
cAlpha int, no of free parameters in alpha (unrestricted: p*r)
cBeta int, no of free parameters in beta (unrestricted: p1*r)
iR I(1) rank
iS1 I(2) rank
amG array of G_i G matrices ({} for unrestricted A)
amH array of H matrices, one for each restriction ({} for no restrictions)
mAlphaI2[p][r] initial unrestricted I(2) values for alpha (or <>)
mBetaI2[p1][r] initial unrestricted I(2) values for beta (or <>)
Returns
array with seven elements: {A,B,V,W,Omega,-logdet,max code}.

static CATSI2::TriSwitching(const mA, const mB, const mV, const bFixW11, const bSetZeroV13, const amG, const amH, const iR, const iS1, const mQtZ0, const mQtZ1, const mQtZ2, const mQtZ0sq, const cT, const dCrit, const iMaxIt, const iInfo, const bLineSearch=TRUE, const dAddLogdet=0)
Triangular switching algorithm for the I(2) model with linear restrictions on A and B. Impose the restriction A = (A_2 : A_1 : A_0=alpha) = (G_i theta_i) and B=(B_0=beta : B_1 : B_2) = (H_i phi_i). The H_i must be linearly independent.
Parameters
mA matrix initial A[p][p]
mB matrix initial B[p1][p1]
mV matrix initial V[p][p1]
bFixW: TRUE: W_{11}=I_r alwyas, FALSE: W_{11} is free if possible (but will be rotated back to I_r at the end)
amG array[r] of G_i G matrices ({} for unrestricted A)
amH array[r] of H matrices, one for each restriction ({} for no restrictions)
mQtZ0 matrix[cz0][cz0] Q'Z0 corrected for z3
mQtZ1 matrix[cz1][cz1] Q'Z1 corrected for z3
mQtZ2 matrix[cz1][cz1] Q'Z2 corrected for z3
mQtZ0sq matrix[cz0][cz0] rest of Z0'Z0 corrected for z3
cT int, sample size
dCrit double, convergence tolerance
iMaxIt int, maximum number of iterations
iInfo int, >0: print output for every iInfo-th iteration
bLineSearch int, FALSE: no search, TRUE: 2-stage search (default)
Returns
{A,B,V,W,Omega,-logdet,max code}