MATRIX - Section 52 The B34S programming language capability is called with the command b34sexec matrix; /$ commands here b34srun; Example: b34sexec matrix; x=matrix(2,2:22. 33. 44. .02); ix=inv(x); test=ix*x; call print(x,ix,test); b34srun; The MATRIX command provides a 4th generation language to process selected calculations from B34S procedures and the ability to further process data. Analysis is supported for real*8, real*16, complex*16 and complex*32 data. Other data types such as character*1, character*8, real*4 and integer*4 are supported. Calculation of the inverse of a real*4 matrix, while supported, is not recommend due to accuracy loss. High resolution graphics are available on all currently supported platforms (Windows, RS/6000, Sun, Linux) and batch and interactive operation is supported. Many string operations are available for character*8 and character*1 data. The MATRIX facility supports user PROGRAMS, SUBROUTINES and FUNCTIONS. SUBROUTINES and FUNCTIONS have their own address space. Variables are built using object oriented programming with analytic statements such as: y = x*2.; where x is a variable that could be a matrix, 2D array, 1D array, vector or a scalar. The use of the MATRIX command FORMULA and the SOLVE subroutine allows recursive solution of an analytic statement over a range of index values. This facility speeds up calculations that would have had to use do loops which have substantial overhead. For intensely recursive calculations, the user can call Fortran routines from within a MATRIX command program or subroutine. The MATRIX command recognizes variables of KIND complex*16, real*8, real*4, real*16, complex*32, integer*4, character*1 and character*8. Due to possible accuray loss only array math is supported for integer*4 objects. While the inv(real4object) is supported, due to accuracy loss this is not recommended. The KLASS of an object determines how it is processed. KLASS types are scalar, 1D array, 2D array, vector and 2D matrix. For example the assingment statement y=2.0; sets y to be a real*8 scalar, while y=2; sets y to be a integer*4 scalar. If the commands x=33.; y=2; test=x*y; are given there will be a mixed-mode error message since the MATRIX command processor does not know whether test should be integer*4 or real*8. To create an integer*4 from a real*8 use testint=idint(x)*y; while to create a real*8 from an integer*4 variable y use testr8 =x*dfloat(y); Where possible Fortran names have been used for built-in functions to reduce the learning curve. To create a 2D array use xarray=array(2,2: 1., 2., 3., 4.); To create a 2D matrix use xmatrix=matrix(2,2:1., 2., 3., 4.); or xmatrix=mfam(xarray); There are a number of built in functions to convert the KIND and KLASS. Key ones are: SFAM( ) Create a scalar family. MFAM( ) Convert an array to a matrix. AFAM( ) Convert a matrix to an array. VFAM( ) Convert a 1D array to a 1D vector. DFLOAT( ) Convert integer to real*8. IDINT( ) Convert real*8 to integer. IQINT( ) Convert real*16 to integer. IDNINT( ) Nearest integer from real*8. IQNINT( ) Nearest integer from real*16 REAL( ) Obtain real*8 part of a complex*16 data type. QREAL( ) Obtain real*16 part of complex*32 data type. IMAG( ) Obtain the real*8 imaginary part of a complex*16 data type. QIMAG( ) Obtain the real*16 imaginary part of a complex*32 data type. COMPLEX( , ) Build a complex*16 variable from two real*8 variables. QCOMPLEX( , ) Build a complex*32 variable from two real*16 variables. QNINT( ) Real*16 representation of nearest whole number. DNINT( ) Real*8 representation of nearest whole number. R8TOR16( ) Real*8 to real*16. R16TOR8( ) Real*16 to real*8. C16TOC32( ) Complex*16 to complex*32. C32TOC16( ) Complex*32 to complex*16. KINDAS(x,yy) Set a variable the kind of x, but value of yy. More detail on these features will be given below. The B34S MATRIX language is very close to the Speakeasy language. In MATLAB all 2D and 1D objects are assumed to be what B34S calls the MATRIX KLASS. Assume x and y are 3 by 3 MATRIX objects in B34S and MATLAB. In MATLAB for an element by element operation the command is newobj=x.*y; In B34S and Speakeasy the command for the same operation is: newobj=afam(x)*afam(y); If it is desired to place this back in a matrix: newobj=mfam(afam(x)*afam(y)); Unlike MATLAB, B34S and Speakeasy are not case sensitive. Assume xarray is an array and xmatrix is a matrix. xxarray =2.+xarray; xxmatrix=2.+xmatrix; Speakeasy and B34S work the same. Here 2. is added to all elements in xarray and only the diagonal elements in xmatrix. In MATLAB 2+x adds 2 to all elements of the matrix. The development of the MATRIX facility has been influenced closely by Speakeasy. Wherever possible, the same command language has been used to facilitate transfer of data to Speakeasy for further processing. The MATRIX facility is NOT designed to run interactively but commands can be given interactively in the MANUAL mode. In this mode scripts can be edited and submitted. Output is written to the b34s.out file and error messages are displayed in both the b34s.out and b34s.log files. Under the Display Manager, the user can scroll the output files and run the MATRIX command before and after other b34s commands. The objective of the MATRIX facility is to give the user access to a powerful object oriented programming language so that custom calculations can be made. Of major interest is providing the ability to estimate complex nonlinear least squares and maximum likelihood models. Such models, which are specified in B34S MATRIX command programs, can be solved using either other B34S subroutines or with the MATRIX nonlinear commands NLLSQ, NL2SOL, MAXF1, MAXF2, MAXF3, CMAXF1, CMAXF2 and CMAXF3. While the use of B34S subroutines would give the user TOTAL control of the estimation process, speed would be given up. In addition to specification of the model, in the B34S MATRIX language it is also possible to write the model in a Fortran or C program and call this user program from within a B34S MATRIX program. For recursive systems where it is near impossible to vectorize the calculation, this is may be the best way to proceed. The B34S nonlinear solvers are based on time tested routines. The objective of the b34s implementation is to facilitate their use in a way whereby there is full knowledge of just what is being calculated. The design of the MATRIX facility allows other libraries of routines to be accessed from C or Fortran to provide other alternatives. The MATRIX nonlinear commands give the user complete control of the form of the estimated model which is specified in a MATRIX command PROGRAM. Since these programs are called by compiled solvers, there is a substantial speed advantage over a design that writes the solver in a subroutine. The file MATRIX2.MAC contains the subroutines DUD and MARQ which illustrate the subroutine approach to nonlinear least squares and the power of the MATRIX command language. While these subroutines can be used, the NLLSQ and NL2SOL commands are substantially more powerful and orders of magnitide faster. The MATRIX command display routines OUTSTRING, OUTINTEGER and OUTDOUBLE can be used to "instrument" the solution process such that the user can see how the search is proceeding if B34S is running in the Display Manager. These commands will not work for batch jobs since the proper windows have not been opened unless the b34s2 procedure is used. The B34S Matrix Language design allows DO loops and IF structures to be in the command stream provided the commands are not given in manual mode. This is not possible with Speakeasy. The command call manual; can be placed anywhere in the job to place the processor in manual mode whereby commands could be entered or the process modified. The main purpose of manual mode is to allow the user to take control of how a subroutine is running. If call manual; is used in a MATRIX program under the Display Manager, the user is placed in the IMATRIX mode where the output to date can be seen, errors can be trapped and commands can be given to see what has been calculated to date and scripts can be submitted. If the user is debugging a subroutine it is often useful to be able to see what variables are active and possible modify the course of the subroutines execution in a real-time mode. The command call break('Are at position a'); can be used to trap execution in a loop. If any key has been hit prior to call break being found, the program will stop. Otherwise the command is ignored. This saves having the program checking for a key stroke as each command is being executed which will slow speed. If call break is executed, the user can then either allow execution to proceed or terminate the process then and there. If the MATRIX workspace is saved with the SAVE command, it can be restored after more B34S commands have run. Unlike most other B34S commands, in many cases the MATRIX command requires that commas be used. Unlike other B34S commands, errors are written both in the LOG file and at the exact command that has caused a problem. The command call echooff; can be used to reduce output when running a user SUBROUTINE, FUNCTION or PROGRAM. If there is some question on how a certain section is running, the command call echoon; can be used to echo commands as they are executed. In Matlab commands that end with ; are not echoed, while commands that do not end in ; are. This "design" requires the user to modify code during the debug phase. As a result errors can creep in. The echoon and echoff commands allow one tyo globally turn off output. Every attempt has been made to increase the speed of execution. Unlike Speakeasy, the CALL command is needed to execute PROGRAMS or SUBROUTINES. By this design, a great deal of search time is saved. To avoid I/O and to avoid possible unforseen conflicts over names, user SUBROUTINES, PROGRAMS or FUNCTIONS must be loaded to be found. Automatic loading of user commands slows execution substantially since the processor would have to look in all libraries to see if a built-in command had been replaced by a user subroutine, program or function. A major reason automatic loading was not implemented was to avoid the danger that the wrong subroutine could be loaded and a "wrong" calculation be made and not caught. A major objective of the MATRIX command is to give the user total control over the processing of data. Users can develope extensions and modifications of the statistics calculated by other B34S commands. Over the years, more and more of the regular commands will be converted to save data for later use in the matrix command. The library of applications SUBROUTINES, FUNCTIONS and PROGRAMS in c:\b34slm\matrix2.mac will be inhanced. Since these procedures are written in the B34S MATRIX language, they are self documenting. Facilities are provided whereby users can add to these libraries. Since all procedures have to be loaded, there is NO possibility that a user procedure can conflict with a built-in command unless it is explicitly loaded. The only conflict possible is with a MATRIX language command. This design prevents the MATLAB problem of suddenly key commands not working because the order of the library is changed due to a new toolkit being added. The routines in matrix2.mac are of two types. General purpose routines, such CFREQ which will calculate a cumulative frequency distribution, are documented BOTH in the TOOLKIT section which lists all routines and under the matrix command subroutine list. Commands such as this have test problems of the same name in matrix.mac. Other programs in matrix2.mac of less general interest for production jobs are only documented in the TOOLKIT section. The library staging.mac contains example files for the proposed subroutines in staging2.mac. The MATRIX command can read and process a binary file. Reading can be done in any order. This facility allows the system to process and change a load module or recover data from a file that has a strange structure. Character*1 processing allows the user to read and parse lines of a file. This capability is of interest to the expert user. For NLLSQ and maximum likelihood models that involve recursive models, in many cases an alternative program may be RATS. Such models are slow to estimate since there is a heavy parse overhead and the the vector capability in the B34S MATRIX facility is not usuable. B34S is not designed to replace RATS in this area. In B34S NLLSQ and maximum likelihood estimation can be done where the model is specified in the user's program using MATRIX commands. This mode of operation combines the advantages of fast execution with the flexibility of allowing the user to specify the model using a 4th generation language. NLLSQ can also be done using subroutines DUD and MARQ which were written in the B34S MATRIX command language. The estimation of a ML model when a recursive system is not required is fast and a number of routines from IMSL are supplied. Supported capability includes constrained ML models. While recursive systems are possible, due to the fact that DO loops or SOLVE/FORMULA commands are needed, the speed is slower. The subroutine GARCH can be used to estimate a subset of the ARCH/GARCH class of models without some of the recursive call overhead. An even simplier command GARCHEST allows univariate estimation for simple ARCH/GARCH models. Since B34S can estimate a nonlinear programming model with nonlinear constraints, a fairly wide class of models can be estimated. The BGARCH subroutine allows the user's PROGRAM to estimate a bivariate GARCH model without the recursive overhead. Note: In the above NLLSQ refers to nonlinear least squares. The B34S MATRIX command has two commands for this calculation. NLLSQ uses the Meeter (1964a, 1964b) routines that were first developed at the University of Wisconsin and form the basis of much work in time series analysis. The alternative routine NL2SOL uses the Dennis-Gay-Welsch (1981) programs that have been widely used in the literature. As of May 2004, the NLLSQ command can be run with real*8 or real*16 data. The maximization routines supported all come from various versions of the IMSL library. The B34S MATRIX command subroutines DUD and MARQ use the logic of the SAS Nonlin command but are written in the B34S command language. These are supplied for research interest. For nonlinear least squares, these would be a third choice. List of Built-In Matrix Command Subroutines ACEFIT - Alternating Conditional Expectation Model Estimation ACF_PLOT - Simple ACF Plot ADDCOL - Add a column to a 2d array or matrix. ADDROW - Add a row to a 2d array or matrix. AGGDATA - Aggregate Data under control of an ID Vector. ALIGN - Align Series with Missing Data ARMA - ARMA estimation using ML and MOM. AUTOBJ - Automatic Estimation of Box-Jenkins Model BACKSPACE - Backspace a unit BDS - BDS Nonlinearity test. B_G_TEST - Breusch-Godfrey (1978) Residual Test BGARCH - Calculate function for a BGARCH model. BLUS - BLUS Residual Analysis BPFILTER - Baxter-King Filter. BREAK - Set User Program Break Point. BUILDLAG - Builds NEWY and NEWX for VAR Modeling CCFTEST - Display CCF Function of Prewhitened data CHAR1 - Place a string is a character*1 array. CHARACTER - Place a string in a character*1 array. CHECKPOINT - Save workspace in portable file. CLEARALL - Clears all objects from workspace. CLEARDAT - Clears data from workspace. CLOSE - Close a logical unit. CLS - Clear screen. CMAXF1 - Constrained maximization of function using zxmwd. CMAXF2 - Constrained maximization of function using dbconf/g. CMAXF3 - Constrained maximization of function using db2pol. COMPRESS - Compress workspace. CONSTRAIN - Subset data based on range of values. CONTRACT - Contract a character array. COPY - Copy an object to another object COPYLOG - Copy file to log file. COPYOUT - Copy file to output file. COPYF - Copy a file from one unit to another. CSPECTRAL - Do cross spectral analysis. CSUB - Call Subroutine CSV - Read and Write a CVS file DATA_ACF - Calculate ACF and PACF Plots DATAFREQ - Data Frequency DATAVIEW - View a Series Under Menu Control DELETECOL - Delete a column from a matrix or array. DELETEROW - Delete a row from a matrix or array. DES - Code / decode. DESCRIBE - Calculate Moment 1-4 and 6 of a series DF - Calculate Dickey-Fuller Unit Root Test. DISPLAYB - Displays a Buffer contents DIST_TAB - Distribution Table DODOS - Execute a command string if under dos/windows. DO_SPEC - Display Periodogram and Spectrum DOUNIX - Execute a command string if under unix. DQDAG - Integrate a function using Gauss-Kronrod rules DQDNG - Integrate a smooth function using a nonadaptive rule. DQDAGI - Integrate a function over infinite/semi-infinite interval. DQDAGP - Integrate a function with singularity points given DQDAGS - Integrate a function with end point singularities DQAND - Multiple integration of a function DTWODQ - Two Dimensional Iterated Integral ECHOOFF - Turn off listing of execution. ECHOON - Turn on listing of execution. EPPRINT - Print to log and output file. EPRINT - Print to log file. ERASE - Erase file(s). EXPAND - Expand a character array FORMS - Build Control Forms FORPLOT - Forecast Plot FREE - Free a variable. FPLOT - Plot a Function FPRINT - Formatted print facility. GAMFIT - Generalized Additive Model Estimation GARCH - Calculate function for a ARCH/GARCH model. GARCHEST - Estimate ARCH/GARCH model. GET - Gets a variable from b34s. GETDMF - Gets a data from a b34s DFM file. GETKEY - Gets a key GETMATLAB - Gets data from matlab. GET_FILE - Gets a File name GET_NAME - Get Name of a Matrix Variable GETRATS - Reads RATS Portable file. GETSCA - Reads SCA FSAVE and MAD portable files. GMFAC - LU factorization of n by m matrix GMINV - Inverse of General Matrix using LAPACK GMSOLV - Solve Linear Equations system using LAPACK GRAPH - High Resolution graph. GRAPHP - Multi-Pass Graphics Programing Capability GRCHARSET - Set Character Set for Graphics. GRREPLAY - Graph replay and reformat command. GTEST - Tests output of a ARCH/GARCH Model GWRITE - Save Objects in GAUSS Format using one file GWRITE2 - Save objects in GAUSS format using two files HEADER - Turn on header HEXTOCH - Concert hex to a character representation. HINICH82 - Hinich 1982 Nonlinearity Test. HINICH96 - Hinich 1996 Nonlinearity Test. HPFILTER - Hodrick-Prescott Filter. ISEXTRACT - Place data in a structure. IALEN - Get actual length of a buffer of character data IBFCLOSE - Close a file that was used for Binary I/O IBFOPEN - Open a File for Binary I/O IBFREADC - Reads from a binary file into Character*1 array IBFREADR - Reads from a binary file into Real*8 array IBFSEEK - Position Binary read/write pointer IBFWRITER - Write noncharacter buffer on a binary file IBFWRITEC - Write character buffer on a binary file IB34S11 - Parse a token using B34S11 parser IFILESIZE - Determine number of bites in a file IFILLSTR - Fill a string with a character IGETICHAR - Obtain ichar info on a character buffer IGETCHARI - Get character from ichar value IJUSTSTR - Left/Right/center a string ILCOPY - Move bites from one location to another ILOCATESTR - Locate a substring in a string - 200 length max ILOWER - Lower case a string - 200 length max INEXTR8 - Convert next value in string to real*8 variable INEXTR4 - Convert next value in string to real*4 variable INEXTSTR - Extract next blank deliminated sub-string from a string INEXTI4 - Convert next value in a string to integer. INTTOSTR - Convert integer to string using format IR8TOSTR - Convert real*8 value to string using format ISTRTOR8 - Convert string to real*8 ISTRTOINT - Convert string to integer IUPPER - Upper case a string - 200 length max I_DRNSES - Initializes the table used by shuffled generators. I_DRNGES - Get the table used in the shuffled generators. I_DRNUN - Uniform (0,1) Generator I_DRNNOR - Random Normal Distribution I_DRNBET - Random numbers from beta distribution I_DRNCHI - Random numbers from Chi-squared distribution I_DRNCHY - Random numbers from Cauchy distribution I_DRNEXP - Random numbers from standard exponential I_DRNEXT - Random numbers from mixture of two exponential distributions I_DRNGAM - Random numbers from standard gamma distribution I_DRNGCT - Random numbers from general continuous distribution I_DRNGDA - Random integers from discrete distribution alias approach I_DRNGDT - Random integers from discrete using table lookup I_DRNLNL - Random numbers from lognormal distribution I_DRNMVN - Random numbers from multivariate normal I_DRNNOA - Random normal numbers using acceptance/rejection I_DRNNOR - Random normal numbers using CDF method I_DRNSTA - Random numbers from stable distribution I_DRNTRI - Random numbers from triangular distribution I_DRNSPH - Random numbers on the unit circle I_DRNVMS - Random numbers from Von Mises distribution I_DRNWIB - Random numbers from Weibull distribution I_RNBIN - Random integers from binomial distribution I_RNGET - Gets seed used in IMSL Random Number generators. I_RNOPG - Gets the type of generator currently in use. I_RNOPT - Selects the type of uniform (0,1) generator. I_RNSET - Sets seed used in IMSL Random Number generators. I_RNGEO - Random integers from Geometric distribution I_RNHYP - Random integers from Hypergeometric distribution. I_RNMTN - Random numbers from multinomial distribution I_RNNBN - Negative binomial distribution I_RNPER - Random perturbation of integers I_RNSRI - Index of random sample without replacement KEENAN - Keenan Nonlinearity test KSWTEST - K Period Stock Watson Test KSWTESTM - Moving Period Stock Watson Test LAGMATRIX - Builds Lag Matrix. LAGTEST - 3-D Graph to display RSS for OLS Lags LAGTEST2 - 3-D Graph to display RSS for MARS Lags LAPACK - Sets Key LAPACK parameters LM - Engle Lagrange Multiplier ARCH test. LOAD - Load a Subroutine from a library. LOADDATA - Load Data from b34s into MATRIX command. LPMAX - Solve Linear Programming maximization problem. LPMIN - Solve Linear Programming minimization problem. LRE - McCullough Log Relative Error MAKEDATA - Place data in a b34s data loading structure. MAKEGLOBAL - Make a variable global (seen at all levels). MAKELOCAL - Make a variable seen at only local level. MAKEMATLAB - Place data in a file to be loaded into Matlab. MAKEMAD - Makes SCA *.MAD datafile from vectors MAKERATS - Make RATS portable file. MAKESCA - Make SCA FSV portable file. MANUAL - Place MATRIX command in manual mode. MARS - Multivariate Autoregressive Spline Models MARSPLINE - Updated MARS Command using Hastie-Tibshirani code MARS_VAR - Joint Estination of VAR Model using MARS Approach MAXF1 - Maximize a function using IMSL ZXMIN. MAXF2 - Maximize a function using IMSL DUMINF/DUMING. MAXF3 - Maximize a function using simplex method (DU2POL). MELD - Form all possible combinations of vectors. MENU - Put up user Menu for Input MESSAGE - Put up user message and allow a decision. MINIMAX - Estimate MINIMAX with MAXF2 MISSPLOT - Plot of a series with Missing Data MQSTAT - Multivariate Q Statistic NAMES - List names in storage. NLEQ - Jointly solve a number of nonlinear equations. NLLSQ - Nonlinear Least Squares Estimation. NL2SOL - Alternative Nonlinear Least Squares Estimation. NLPMIN1 - Nonlinear Programming fin. diff. grad. DN2CONF. NLPMIN2 - Nonlinear Programming user supplied grad. DN2CONG. NLPMIN3 - Nonlinear Programming user supplied grad. DN0ONF. NLSTART - Generate starting values for NL routines. NOHEADER - Turn off header. OLSQ - Estimate OLS, MINIMAX and L1 models. OLSPLOT - Plot of Fitted and Actual Data & Res OPEN - Open a file and attach to a unit. OUTDOUBLE - Display a Real*8 value at a x, y on screen. OUTINTEGER - Display an Integer*4 value at a x, y on screen. OUTSTRING - Display a string value at a x, y point on screen. PCOPY - Copy an object from one pointer address to another PERMUTE - Reorder Square Matrix PISPLINE - Pi Spline Nonlinear Model Building PLOT - Line-Printer Graphics POLYFIT - Fit an nth degree polynomial POLYVAL - Evaluate an nth degree polynomial POLYMCONV - Convert storage of a polynomial matrix POLYMDISP - Display/Extract a polynomial matrix POLYMINV - Invert a Polynomial Matrix POLYMMULT - Multiply a Polynomial Matrix PP - Calculate Phillips Peron Unit Root test PRINT - Print text and data objects. PRINTALL - Lists all variables in storage. PRINTOFF - Turn off Printing PRINTON - Turn on Printing (This is the default) PROBIT - Estimate Probit (0-1) Model. PVALUE_1 - Present value of $1 recieved at end of n years PVALUE_2 - Present value of an Annuity of $1 PVALUE_3 - Present value of $1 recieved throughout year QPMIN - Quadratic Programming. QUANTILE - Calculate interquartile range. READ - Read data directly into MATRIX workspace from a file. REAL16INFO - Obtain Real16 info REAL16OFF - Turn off Real16 add REAL16ON - Turn on extended accuracy REAL32OFF - Turn off Real32 add REAL32ON - Turn on extended accuracy for real*16 REAL32_VPA - Turn on extended accuracy for real*16 using vpa RESET - Calculate Ramsey (1969) regression specification test. RESET77 - Thursby - Schmidt Regression Specification Test RESTORE - Load data back in MATRIX facility from external save file. RTEST - Test Residuals of Model RTEST2 - Test Residuals of Model - No RES and Y Plots REVERSE - Test a real*8 vector for reversibility in Freq. Domain REWIND - Rewind logical unit. ROTHMAN - Test a real*8 vector for reversibility in Time Domain RMATLAB - Runs Matlab RRPLOTS - Plots Recursive Residual Data RUN - Terminates the matrix command being in "manual" mode. SAVE - Save current workspace in portable file format. SCHUR - Performs Schur decomposition SCREENCLOSE - Turn off Display Manager SCREENOPEN - Turn on Display Manager SCREENOUTOFF - Turn screen output off. SCREENOUTON - Turn screen output on. SET - Set all elements of an object to a value. SETCOL - Set column of an object to a value. SETLABEL - Set the label of an object. SETLEVEL - Set level. SETNDIMV - Sets an element in an n dimensional object. SETROW - Set row of an object to a value. SETTIME - Sets the time info in an existing series SETWINDOW - Set window to main(1), help(2) or error(3). SIGD - Set print digits. Default g16.8 SIMULATE - Dynamically Simulate OLS Model SMOOTH - Do exponential smoothing. SOLVEFREE - Set frequency of freeing temp variables. SORT - Sort a real vector. SPECTRAL - Spectral analysis of a vector or 1d array. STOP - Stop execution of a matrix command. SUBRENAME - Internally rename a subroutine. SUSPEND - Suspend loading and Execuiting a program SWARTEST - Stock-Watson VAR Test SYSTEM - Issue a system command. TABULATE - List vectors in a table. TESTARG - Lists what is passed to a subroutine or function. TIMER - Gets CPU time. TRIPLES - Calculate Triples Reversability Test TSAY - Calculate Tsay nonlinearity test. TSLINEUP - Line up Time Series Data TSD - Interface to TSD Data set VAREST - VAR Modeling VPASET - Set Variable Precision Math Options VOCAB - List built-in subroutine vocabulary. WRITE - Write an object to an external file. Matrix Command Built-In Function Vocabulary ACF - Calculate autocorrelation function of a 1d object. AFAM - Change a matrix or vector to an array class object. ARGUMENT - Unpack character argument at run-time ARRAY - Define a 1d or 2d array. BETAPROB - Calculate a beta probability. BINDF - Evaluate Binomial Distribution Function BINPR - Evaluate Binomial Probability Function BOOTI - Calculate integers to be used with bootstrap. BOOTV - Bootstraps a vector with replacement. BOXCOX - Box-Cox Transformation of a series given lamda. BSNAK - Compute Not a Knot Sequence BSOPK - Compute optimal spline knot sequence BSINT - Compute 1-D spline interpolant given knots BSINT2 - Compute 2-D spline interpolant given knots BSINT3 - Compute 3-D spline interpolant given knots BSDER - Compute 1-D spline values/derivatives given knots BSDER2 - Compute 2-D spline values/derivatives given knots BSDER3 - Compute 3-D spline values/derivatives given knots BSITG - Compute 1-D spline integral given knots BSITG2 - Compute 2-D spline integral given knots BSITG3 - Compute 3-D spline integral given knots C1ARRAY - Create a Character*1 array C8ARRAY - Create a Character*8 array CATCOL - Concatenates an object by columns. CATROW - Concatenates an object by rows. CCF - Calculate the cross correlation function on two objects. CHAR - Convect an integer in range 0-127 to character. CHARDATE - Convert julian variable into character date dd\mm\yy. CHARDATEMY - Convert julian variable into character data mm\yyyy. CHARTIME - Converts julian variable into character date hh:mm:ss CHISQPROB - Calculate chi-square probability. CHTOR - Convert a character variable to a real variable. CHTOHEX - Convert a character to its hex representation. CFUNC - Call Function COMB - Combination of N objects taken M at a time. COMPLEX - Build a complex variable from two real*8 variables. CSPLINEFIT - Fit a 1 D Cubic Spline using alternative models CSPLINE - Calculate a cubic spline for 1 D data CSPLINEVAL - Calculate spline value given spline CSPLINEDER - Calculate spline derivative given spline value CSPLINEITG - Calculate integral of a cubic spline CUSUM - Cumulative sum. CUSUMSQ - Cumulative sum squared. CWEEK - Name of the day in character. DABS - Absolute value of a real*8 variable. DARCOS - Arc cosine of a real*8 variable. DARSIN - Arc sine of a real*8 variable. DATAN - Arc tan of a real*8 variable. DATAN2 - Arc tan of x / y. Signs inspected. DATENOW - Date now in form dd/mm/yy DBLE - Convert real*4 to real*8. DCONJ - Conjugate of complex argument. DCOS - Cosine of real*8 argument. DCOSH - Hyperbolic cosine of real*8 argument. DDOT - Inner product to two vectors. DERF - Error function of real*8/real*16 argument. DERFC - Inverse of error function. DERIVATIVE - Analytic derivative of a vector. DET - Determinate of a matrix. DEXP - Exponential of a real*8 argument. DFLOAT - Convert integer*4 to real*8. DGAMMA - Gamma function of real*8 argument. DIAG - Place diagonal of a matrix in an array. DIAGMAT - Create diagonal matrix. DIF - Difference a series. DINT - Extract integer part of real*8 number DNINT - Extract nearest integer part of real*8 number DIVIDE - Divide with an alternative return. DLGAMMA - Natural log of gamma function. DLOG - Natural log. DLOG10 - Base 10 log. DMAX - Largest element in an array. DMAX1 - Largest element between two arrays. DMIN - Smallest element in an array. DMIN1 - Smallest element between two arrays. DMOD - Remainder. DROPFIRST - Drops observations on top or array. DROPLAST - Drops observations on bottom of an array. DSIN - Calculates sine. DSINH - Hyperbolic sine. DSQRT - Square root of real*8 or complex*16 variable. DTAN - Tangent. DTANH - Hyperbolic tangent. EIGENVAL - Eigenvalue of matrix. Alias EIG. EPSILON - Positive value such that 1.+x ne 1. EVAL - Evaluate a character argument EXP - Exponential of real*8 or complex*16 variable. EXTRACT - Extract elements of a character*1 variable. FACT - Factorial FDAYHMS - Gets fraction of a day. FFT - Fast fourier transform. FIND - Finds location of a character string. FLOAT - Converts integer*4 to real*4. FPROB - Probability of F distribution. FREQ - Gets frequency of a time series. FRACDIF - Fractional Differencing FYEAR - Gets fraction of a year from julian date. GENARMA - Generate an ARMA series given parameters. GETDAY - Obtain day of year from julian series. GETHOUR - Obtains hour of the day from julian date. GETNDIMV - Obtain value from an n dimensional object. GETMINUTE - Obtains minute of the day from julian date. GETMONTH - Obtains month from julian date. GETQT - Obtains quarter of year from julian date. GETSECOND - Obtains second from julian date. GETYEAR - Obtains year. GOODCOL - Deletes all columns where there is missing data. GOODROW - Deletes all rows where there is missing data. GRID - Defines a real*8 array with a given increment. HUGE - Largest number of type HYPDF - Evaluate Hypergeometric Distribution Function HYPPR - Evaluate Hypergeometric Probability Function INTEGER8 - Load an Integer*8 object from a string I4TOI8 - Move an object from integer*4 to integer*8 I8TOI4 - Move an object from integer*8 to integer*4 ICHAR - Convect a character to integer in range 0-127. ICOLOR - Sets Color numbers. Used with Graphp. IDINT - Converts from real*8 to integer*4. IDNINT - Converts from real*8 to integer*4 with rounding. INFOGRAPH - Obtain Interacter Graphics INFO IMAG - Copy imaginary part of complex*16 number into real*8. IAMAX - Largest abs element in 1 or 2D object IAMIN - Smallest abs element in 1 or 2D object IMAX - Largest element in 1 or 2D object IMIN - Smallest element in 1 or 2D object INDEX - Define integer index vector, address n dimensional object. INLINE - Inline creation of a program INT - Copy real*4 to integer*4. INTEGERS - Generate an integer vector with given interval. INV - Inverse of a real*8 or complex*16 matrix. INVBETA - Inverse beta distribution. INVCHISQ - Inverse Chi-square distribution. INVFDIS - Inverse F distribution. INVTDIS - Inverse t distribution. IQINT - Converts from real*16 to integer*4. IQNINT - Converts from real*16 to integer*4 with rounding. ISMISSING - Sets to 1.0 if variable is missing IWEEK - Sets 1. for monday etc. JULDAYDMY - Given day, month, year gets julian value. JULDAYQY - Given quarter and year gets julian value. JULDAYY - Given year gets julian value. KEEPFIRST - Given k, keeps first k observations. KEEPLAST - Given k, keeps last k observations. KIND - Returns kind of an object in integer. KINDAS - Sets kind of second argument to kind first arg. KLASS - Returns klass of an object in integer. KPROD - Kronecker Product of two matrices. LABEL - Returns label of a variable. LAG - Lags variable. Missing values propagated. LEVEL - Returns current level. LOWERT - Lower triangle of matrix. MCOV - Consistent Covariance Matrix MAKEJUL - Make a Julian date from a time series MASKADD - Add if mask is set. MASKSUB - Subtract if mask is set. MATRIX - Define a matrix. MEAN - Average of a 1d object. MFAM - Set 1d or 2d array to vector or matrix. MISSING - Returns missing value. MLSUM - Sums log of elements of a 1d object. MOVELEFT - Moves elements of character variable left. MOVERIGHT - Move elements of character variable right. NAMELIST - Creates a namelist. NEAREST Nearest distinct number of a given type NCCHISQ - Non central chi-square probability. NOCOLS - Gets number of columns of an object. NOELS - Gets number of elements in an object. NORMDEN - Normal density. NORMDIST - 1-norm, 2-norm and i-norm distance. NOROWS - Gets number of rows of an object. NOTFIND - Location where a character is not found. OBJECT - Put together character objects. PDFAC - Cholesky factorization of PD matrix. PDFACDD - Downdate Cholesky factorization. PDFACUD - Update Cholesky factorization. PDINV - Inverse of a PD matrix. PDSOLV - Solution of a PD matrix given right hand side. PI - Pi value. PINV - Generalized inverse. PLACE - Places characters inside a character array. POIDF - Evaluate Poisson Distribution Function POIPR - Evaluate Poisson Probability Function POINTER - Machine address of a variable. POLYDV - Division of polynomials. POLYMULT - Multiply two polynomials POLYROOT - Solution of a polynomial. PROBIT - Inverse normal distribution. PROBNORM - Probability of normal distribution. PROBNORM2 - Bivariate probability of Nornal distribution. PROD - Product of elements of a vector. QCOMPLEX - Build complex*32 variable from real*16 inputs. QINT - Extract integer part of real*16 number QNINT - Extract nearest integer part of real*16 number QREAL - Obtain real*16 part of a complex*326 number. QRFAC - Obtain Cholesky R via QR method. QRSOLVE - Solve OLS using QR. RANKER - Index array that ranks a vector. RCOND - 1 / Condition of a Matrix REAL - Obtain real*8 part of a complex*16 number. R8TOR16 - Convert Real*8 to Real*16 R16TOR8 - Convert Real*16 to Real*8 REAL16 - Input a Real*16 Variable REC - Rectangular random number. RECODE - Recode a real*8 or character*8 variable RN - Normally distributed random number. ROLLDOWN - Moves rows of a 2d object down. ROLLLEFT - Moves cols of a 2d object left. ROLLRIGHT - Moves cols of a 2d object right. ROLLUP - Moves rows of a 2d object up. RTOCH - Copies a real*8 variable into character*8. SEIGENVAL - Eigenvalues of a symmetric matrix. Alias SEIG. SEXTRACT - Takes data out of a field. SFAM - Creates a scalar object. SNGL - Converts real*8 to real*4. SPACING - Absolute spacing near a given number SPECTRUM - Returns spectrum of a 1d object. SUBSET - Subset 1d, 2d array, vector or matrix under a mask. SUBMATRIX - Define a Submatrix SUM - Sum of elements. SUMCOLS - Sum of columns of an object. SUMROWS - Sum of rows of an object. SUMSQ - Sum of squared elements of an object. SVD - Singular value decomposition of an object. TIMEBASE - Obtains time base of an object. TIMENOW - Time now in form hh:mm:ss TIMESTART - Obtains time start of an object. TINY Smallest number of type TDEN - t distribution density. TPROB - t distribution probability. TRACE - Trace of a matrix. TRANSPOSE - Transpose of a matrix. UPPERT - Upper Triangle of matrix. VARIANCE - Variance of an object. VECTOR - Create a vector. VFAM - Convert a 1d array to a vector. VOCAB - List built in functions. VPA - Variable Precision Math calculation ZDOTC - Conjugate product of two complex*16 objects. ZDOTU - Product of two complex*16 objects. ZEROL - Zero lower triangle. ZEROU - Zero upper triangle. ********************************************************************** Matrix Programming Language key words CALL - Call a subroutine CONTINUE - go to statement DO - Starts a do loop DOWHILE - Starts a dowhile loop NEXT i - End of a do loop ENDDO - End of a do loop ENDDOWHILE - End of a dowhile loop END - End of a program, function or Subroutine. EXITDO - Exit a DO loop EXITIF - Exit an IF statement FOR - Start a do loop, FORMULA - Define a recursive formula. GO TO - Transfer statement FUNCTION - Beginning of a function. IF( ) - Beginning of an IF structure ENDIF - End of an IF( )THEN structure PROGRAM - Beginning of a program, RETURN - Next to last statement before end. RETURN( ) - Returns the result of a function. SOLVE - Solve a recursive system. SUBROUTINE - Beginning of subroutine. WHERE( ) - Starts a where structure. ********************************************************************** Commands listed by Function Character & String Subroutines CHTOHEX - Convert a character to its hex representation. CONTRACT - Contract a character array DISPLAYB - Displays a Buffer contents EXPAND - Expand a character array EVAL - Evaluate a Character Argument HEXTOCH - Concert hex to a character representation. IALEN - Get actual length of a buffer of character data IBFCLOSE - Close a file that was used for Binary I/O IBFOPEN - Open a File for Binary I/O IBFREADC - Reads from a binary file into Character*1 array IBFREADR - Reads from a binary file into Real*8 array IBFSEEK - Position Binary read/write pointer IBFWRITER - Write noncharacter buffer on a binary file IBFWRITEC - Write character buffer on a binary file IB34S11 - Parse a token using B34S11 parser IFILESIZE - Determine number of bites in a file IFILLSTR - Fill a string with a character IGETICHAR - Obtain ichar info on a character buffer IGETCHARI - Get character from ichar value IJUSTSTR - Left/Right/center a string ILCOPY - Move bites from one location to another ILOCATESTR - Locate a substring in a string - 200 length max ILOWER - Lower case a string - 200 length max INEXTR8 - Convert next value in string to real*8 variable INEXTR4 - Convert next value in string to real*4 variable INEXTSTR - Extract next blank deliminated sub-string from a string INEXTI4 - Convert next value in a string to integer. INTTOSTR - Convert integer to string using format IR8TOSTR - Convert real*8 value to string using format ISTRTOR8 - Convert string to real*8 ISTRTOINT - Convert string to integer IUPPER - Upper case a string - 200 length max Character Functions CHAR - Convect an integer in range 0-127 to character. CHTOR - Convert a character variable to a real variable. DATENOW - Date now in form dd/mm/yy EXTRACT - Extract elements of a character*1 variable. FIND - Finds location of a character string. ICHAR - Convect a character to integer in range 0-127. INLINE - Inline creation of a program MOVELEFT - Moves elements of character variable left. MOVERIGHT - Move elements of character variable right. NAMELIST - Creates a namelist. NOTFIND - Location where a character is not found. OBJECT - Put together character objects. PLACE - Places characters inside a character array. RTOCH - Copies a real*8 variable into character*8. TIMENOW - Time now in form hh:mm:ss Data Building, loading and Display Subroutines ACF_PLOT - Simple ACF Plot ADDCOL - Add a column to a 2d array or matrix. ADDROW - Add a row to a 2d array or matrix. AGGDATA - Aggregate Data under control of an ID Vector. ALIGN Align Series with Missing Data BUILDLAG - Builds NEWY and NEWX for VAR Modeling CCFTEST - Display CCF Function of Prewhitened data CHAR1 - Place a string in a character*1 array. CHARACTER - Place a string in a character*1 array. CHECKPOINT - Save workspace in portable file. CLEARALL - Clears all objects from workspace. CLEARDAT - Clears data from workspace. CSUB - Call Subroutine CONSTRAIN - Subset data based on range of values. CSV - Read and Write a CVS file DATA_ACF - Calculate ACF and PACF Plots DATAVIEW - View a Series Under Menu Control DATAFREQ - Data Frequency DELETECOL - Delete a column from a matrix or array. DELETEROW - Delete a row from a matrix or array. DES - Code / decode. DESCRIBE - Calculate Moment 1-4 and 6 of a series DIVIDE - Divide with an alternative return. DO_SPEC - Display Periodogram and Spectrum GET_FILE - Get a File Name GET_NAME - Get Name of a Matrix Variable GTEST - Tests output of a ARCH/GARCH Model GWRITE - Save Objects in GAUSS Format using one file GWRITE2 - Save Objects in GAUSS Format using two files FREE - Free a variable. LAGMATRIX - Builds Lag matrix. MELD - Form all possible combinations of vectors. QUANTILE - Calculate interquartile range. RTEST - Test Residuals of Model RTEST2 - Test Residuals of OLS Model - No RES and Y Plots SET - Set all elements of an object to a value. SETCOL - Set column of an object to a value. SETLABEL - Set the label of an object. SETNDIMV - Sets an element in an n dimensional object. SETROW - Set row of an object to a value. SETTIME - Sets the time info in an existing series SORT - Sort a real vector. SUBRENAME - Internally rename a subroutine. Data Building Functions AFAM - Change a matrix or vector to an array class object. ARRAY - Define a 1d or 2d array. C1ARRAY - Create a Character*1 array C8ARRAY - Create a Character*8 array CATCOL - Concatenates an object by columns. CATROW - Concatenates an object by rows. CFUNC - Call Function COMB - Combination of N objects taken M at a time. COMPLEX - Build a complex variable from two real*8 variables. CUSUM - Cumulative sum. CUSUMSQ - Cumulative sum squared. DABS - Absolute value of a real*8 variable. DARCOS - Arc cosine of a real*8 variable. DARSIN - Arc sine of a real*8 variable. DATAN - Arc tan of a real*8 variable. DATAN2 - Arc tan of x / y. Signs inspected. DBLE - Convert real*4 to real*8. DCONJ - Conjugate of complex argument. DCOS - Cosine of real*8 argument. DCOSH - Hyperbolic cosine of real*8 argument. DDOT - Inner product to two vectors. DEXP - Exponential of a real*8 argument. DFLOAT - Convert integer*4 to real*8. DGAMMA - Gamma function of real*8 argument. DINT - Extract integer part of real*8 number DNINT - Extract integer part of real*8 number DLGAMMA - Natural log of gamma function. DLOG - Natural log. DLOG10 - Base 10 log. DMAX - Largest element in an array. DMAX1 - Largest element between two arrays. DMIN - Smallest element in an array. DMIN1 - Smallest element between two arrays. DMOD - Remainder. DROPFIRST - Drops observations on top or array. DROPLAST - Drops observations on bottom of an array. DSIN - Calculates sine. DSINH - Hyperbolic sine. DSQRT - Square root of real*8 or complex*16 variable. DTAN - Tangent. DTANH - Hyperbolic tangent. EPSILON - Positive value such that 1.+x ne 1. EXP - Exponential of real*8 or complex*16 variable. FLOAT - Converts integer*4 to real*4. FREQ - Gets frequency of a time series. FYEAR - Gets fraction of a year from julian date. GETIDIM - Obtain value from an n dimensional object. GMFAC - LU factorization of n by m matrix GMINV - Inverse of General Matrix using LAPACK GMSOLV - Solve Linear Equations system using LAPACK GOODCOL - Deletes all columns where there is missing data. GOODROW - Deletes all rows where there is missing data. GRID - Defines a real*8 array with a given increment. HUGE - Largest number of type IAMAX - Largest abs element in 1 or 2D object IAMIN - Smallest abs element in 1 or 2D object IMAX - Largest element in 1 or 2D object IMIN - Smallest element in 1 or 2D object INTEGER8 - Load an Integer*8 object from a string I4TOI8 - Move an object from integer*4 to integer*8 I8TOI4 - Move an object from integer*8 to integer*4 ICOLOR - Sets Color numbers. Used with Graphp. IDINT - Converts from real*8 to integer*4. IDNINT - Converts from real*8 to integer*4 with rounding. IMAG - Copy imaginary part of complex*16 number into real*8. INDEX - Define integer index vector. INFOGRAPH - Obtain Interacter Graphics INFO INT - Copy real*4 to integer*4. INTEGERS - Generate an integer vector with given interval. IQINT - Converts from real*16 to integer*4. IQNINT - Converts from real*16 to integer*4 with rounding. ISMISSING - Sets to 1.0 if variable is missing KEEPFIRST - Given k, keeps first k observations. KEEPLAST - Given k, keeps last k observations. KIND - Returns kind of an object in integer. KINDAS - Sets kind of second argument to kind first arg. KLASS - Returns klass of an object in integer. LABEL - Returns label of a variable. LAG - Lags variable. Missing values propagated. LOWERT - Lower triangle of matrix. MCOV - Consistent Covariance Matrix MASKADD - Add if mask is set. MASKSUB - Subtract if mask is set. MATRIX - Define a matrix. MFAM - Set 1d or 2d array to vector or matrix. MISSING - Returns missing value. NEAREST Nearest distinct number of a given type NOCOLS - Gets number of columns of an object. NOELS - Gets number of elements in an object. NOROWS - Gets number of rows of an object. NORMDIST - 1-norm, 2-norm and i-norm distance. PI - Pi value. QCOMPLEX - Build complex*32 variable from real*16 inputs. QINT - Extract integer part of real*16 number QNINT - Extract nearest integer part of real*16 number QREAL - Obtain real*16 part of a complex*32 number. RANKER - Index array that ranks a vector. REAL - Obtain real*8 part of a complex*16 number. R8TOR16 - Convert Real*8 to Real*16 R16TOR8 - Convert Real*16 to Real*8 REAL16 - Input a Real*16 Variable REC - Rectangular random number. RECODE - Recode a real*8 or chartacter*8 variable RN - Normally distributed random number. SEXTRACT - Takes data out of a field. SFAM - Creates a scalar object. SNGL - Converts real*8 to real*4. SPACING Absolute spacing near a given number SUBMATRIX - Define a Submatrix SUBSET - Subset 1d, 2d array, vector or matrix under a mask. SUM - Sum of elements. SUMCOLS - Sum of columns of an object. SUMROWS - Sum of rows of an object. SUMSQ - Sum of squared elements of an object. TIMEBASE - Obtains time base of an object. TIMESTART - Obtains time start of an object. TINY Smallest number of type UPPERT - Upper Triangle of matrix. VECTOR - Create a vector. VFAM - Convert a 1d array to a vector. ZDOTC - Conjugate product of two complex*16 objects. ZDOTU - Product of two complex*16 objects. ZEROL - Zero lower triangle. ZEROU - Zero upper triangle. Data Filtering Subroutines CSPECTRAL - Do cross spectral analysis. SPECTRAL - Spectral analysis of a vector or 1d array. FFT - Fast fourier transform. SPECTRUM - Returns spectrum of a 1d object. VAREST - VAR Modeling Date and Time Functions CHARDATE - Convert julian variable into character date dd\mm\yy. CHARDATEMY - Convert julian variable into character data mm\yyyy. CHARTIME - Converts julian variable into character date hh:mm:ss CWEEK - Name of the day in character. FDAYHMS - Gets fraction of a day. GETDAY - Obtain day of year from julian series. GETHOUR - Obtains hour of the day from julian date. GETMINUTE - Obtains minute of the day from julian date. GETMONTH - Obtains month from julian date. GETQT - Obtains quarter of year from julian date. GETSECOND - Obtains second from julian date. GETYEAR - Obtains year. IWEEK - Sets 1. for monday etc. JULDAYDMY - Given day, month, year gets julian value. JULDAYQY - Given quarter and year gets julian value. JULDAYY - Given year gets julian value. MAKEJUL - Make a Julian date from a time series Estimation and residual testing Subroutines ARMA - ARMA estimation using ML and MOM. AUTOBJ - Automatic Estimation of Box-Jenkins Model BDS - BDS Nonlinearity test. BPFILTER - Baxter-King Filter. DF - Calculate Dickey-Fuller Unit Root Test. GAMFIT - Generalized Additive Model Estimation GARCHEST - Estimate ARCH/GARCH model. KEENAN - Keenan Nonlinearity test KSWTEST - K Period Stock Watson Test KSWTESTM - Moving Period Stock Watson Test LAGTEST - 3-D Graph to display RSS for OLS Lags LAGTEST2 - 3-D Graph to display Rss for MARS Lags LM - Engle Lagrange Multiplier ARCH test. MINIMAX - Estimate MINIMAX with MAXF2 OLSQ - Estimate OLS, MINIMAX and L1 models. OLSPLOT - Plot of Fitted and Actual Data & Res POLYFIT - Fit an nth degree polynomial POLYVAL - Evaluate an nth degree polynomial PP - Calculate Phillips Peron Unit Root test PROBIT - Estimate Probit (0-1) Model. QUANTREG - Quantile Regression Program RESET - Calculate Ramsey(1969) regression specification test. RESET77 - Thursby - Schmidt Regression Specification Test REVERSE - Test a real*8 vector for reversibility in Freq. Domain ROTHMAN - Test a real*8 vector for reversibility in Time Domain RRPLOTS - Plots Recursive Residual Data SIMULATE - Dynamically Simulate OLS Model SMOOTH - Do exponential smoothing. SWARTEST - Stock-Watson VAR Test TRIPLES - Calculate Triples Reversability Test TSAY - Calculate Tsay nonlinearity test. TSD - Interface to TSD Data set Estimation and residual testing and Spline Functions BOOTI - Calculate integers to be used with bootstrap. BOOTV - Bootstraps a vector with replacement. BOXCOX - Box-Cox Transformation of a series given lamda. MLSUM - Sums log of elements of a 1d object. Spline Functions ACEFIT - Alternating Conditional Expectation Model Estimation BSNAK - Compute Not a Knot Sequence BSOPK - Compute optimal spline knot sequence BSINT - Compute 1-D spline interpolant given knots BSINT2 - Compute 2-D spline interpolant given knots BSINT3 - Compute 3-D spline interpolant given knots BSDER - Compute 1-D spline values/derivatives given knots BSDER2 - Compute 2-D spline values/derivatives given knots BSDER3 - Compute 3-D spline values/derivatives given knots BSITG - Compute 1-D spline integral given knots BSITG2 - Compute 2-D spline integral given knots BSITG3 - Compute 3-D spline integral given knots CSPLINEFIT - Fit a 1 D Cubic Spline using alternative models CSPLINE - Calculate a cubic spline for 1 D data CSPLINEVAL - Calculate spline value given spline CSPLINEDER - Calculate spline derivative given spline value CSPLINEITG - Calculate integral of a cubic spline MARS - Multivariate Autoregressive Spline Models MARSPLINE - Updated MARS Command using Hastie-Tibshirani code MARS_VAR - Joint Estination of VAR Model using MARS Approach PISPLINE - Pi Spline Nonlinear Model Building Integration Subroutines DQDAG - Integrate a function using Gauss-Kronrod rules DQDNG - Integrate a smooth function using a nonadaptive rule. DQDAGI - Integrate a function over infinite/semi-infinite interval. DQDAGP - Integrate a function with singularity points given DQDAGS - Integrate a function with end point singularities DQAND - Multiple integration of a function DTWODQ - Two Dimensional Iterated Integral IO routines Subroutines BACKSPACE - Backspace a unit CLOSE - Close a logical unit. COPYLOG - Copy file to log file. COPYOUT - Copy file to output file. COPYF - Copy a file from one unit to another. ECHOOFF - Turn off listing of execution. ECHOON - Turn on listing of execution. EPPRINT - Print to log and output file. EPRINT - Print to log file. ERASE - Erase file(s). FORMS - Build Control Forms FPRINT - Formatted print facility. GET - Gets a variable from b34s. GETDMF - Gets a data from a b34s DFM file. GETKEY - Gets a key GETMATLAB - Gets data from matlab. GETRATS - Reads RATS Portable file. GETSCA - Reads SCA FSAVE and portable portable files HEADER - Turn on header ISEXTRACT - Place data in a structure. LOADDATA - Load Data from b34s into MATRIX command. MAKEDATA - Place data in a b34s data loading structure. MAKEMAD - Makes SCA *.MAD datafile from vectors MAKEMATLAB - Place data in a file to be loaded into Matlab. MAKERATS - Make RATS portable file. MAKESCA - Make SCA FSV portable file. MENU - Put up user Menu for input MESSAGE - Put up user message and allow a decision. NOHEADER - Turn off header OPEN - Open a file and attach to a unit. PRINT - Print text and data objects. PRINTALL - Lists all variables in storage. PRINTOFF - Turn off Printing PRINTON - Turn on Printing (This is the default) READ - Read data directly into MATRIX workspace from a file. RESTORE - Load data back in MATRIX facility from external save file. REWIND - Rewind logical unit. RMATLAB - Runs Matlab SAVE - Save current workspace in portable file format. TABULATE - List vectors in a table. WRITE - Write an object to an external file. Matrix Functions DERIVATIVE - Analytic derivative of a vector. DET - Determinate of a matrix. DIAG - Place diagonal of a matrix in an array. DIAGMAT - Create diagonal matrix. EIGENVAL - Eigenvalue of matrix. Alias EIG. INV - Inverse of a real*8 or complex*16 matrix. KPROD - Kronecker Product of two matrices. PDFAC - Cholesky factorization of PD matrix. PDFACDD - Downdate Cholesky factorization. PDFACUD - Update Cholesky factorization. PDINV - Inverse of a PD matrix. PDSOLV - Solution of a PD matrix given right hand side. PERMUTE - Reorder Square Matrix PINV - Generalized Inverse. PROD - Product of elements of a vector. QRFAC - Obtain Cholesky R via QR method. QRSOLVE - Solve OLS using QR. RCOND - 1 / Condition of a Matrix. ROLLDOWN - Moves rows of a 2d object down. ROLLLEFT - Moves cols of a 2d object left. ROLLRIGHT - Moves cols of a 2d object right. ROLLUP - Moves rows of a 2d object up. SCHUR - Performs Schur decomposition SEIGENVAL - Eigenvalues of a symmetric matrix. Alias SEIG. SVD - Singular value decomposition of an object. TRACE - Trace of a matrix. TRANSPOSE - Transpose of a matrix. ZDOTC - Conjugate product of two complex*16 objects. ZDOTU - Product of two complex*16 objects. Miscellaneous Subroutines BREAK - Set User Program Break Point. COMPRESS - Compress workspace. COPY - Copy an object to another object LAPACK - Sets Key LAPACK parameters LOAD - Load a Subroutine from a library. MAKEGLOBAL - Make a variable global (seen at all levels). MAKELOCAL - Make a variable seen at only local level. MANUAL - Place MATRIX command in manual mode. NAMES - List names in storage. LRE - McCullough Log Relative Error PCOPY - Copy an object from one pointer address to another REAL16INFO - Obtain Real16 info REAL16OFF - Turn off Real16 add REAL16ON - Turn on extended accuracy REAL32OFF - Turn off Real32 add REAL16ON - Turn on Real*32 extended accuracy RUN - Terminates the matrix command being in "manual" mode. SETLEVEL - Set level. SETWINDOW - Set window to main(1), help(2) or error(3). SIGD - Set print digits. Default g16.8 STOP - Stop execution of a matrix command. TESTARG - Lists what is passed to a subroutine or function. TIMER - Gets CPU time. VOCAB - List built-in subroutine vocabulary. Miscellaneous Functions ARGUMENT - Unpack character argument at run-time FACT - Factorial LEVEL - Returns current level. POINTER - Machine address of a variable. POLYROOT - Solution of a polynomial. POLYDV - Division of polynomials. POLYMULT - Multiply two polynomials VOCAB - List built in functions. Nonlinear Estimation Capability Subroutines CMAXF1 - Constrained maximization of function using zxmwd. CMAXF2 - Constrained maximization of function using dbconf/g. CMAXF3 - Constrained maximization of function using db2pol. BGARCH Calculate function for a BGARCH model. GARCH - Calculate function for a ARCH/GARCH model. GARCHEST - Estimate ARCH/GARCH model. LPMAX - Solve Linear Programming maximization problem. LPMIN - Solve Linear Programming minimization problem. MAXF1 - Maximize a function using IMSL ZXMIN. MAXF2 - Maximize a function using IMSL DUMINF/DUMING. MAXF3 - Maximize a function using simplex method (DU2POL). NLEQ - Jointly solve a number of nonlinear equations. NLLSQ - Nonlinear Least Squares Estimation. NL2SOL - Alternative Nonlinear Least Squares Estimation. NLPMIN1 - Nonlinear Programming fin. diff. grad. DN2CONF. NLPMIN2 - Nonlinear Programming user supplied grad. DN2CONG. NLPMIN3 - Nonlinear Programming user supplied grad. DN0ONF. NLSTART - Generate starting values for NL routines. QPMIN - Quadratic Programming. SOLVEFREE - Set frequency of freeing temp variables. Random Number Generation and Testing - IMSL Names preserved I_RNGET - Gets seed used in IMSL Random Number generators. I_RNSET - Sets seed used in IMSL Random Number generators. I_RNOPG - Gets the type of generator currently in use. I_RNOPT - Selects the type of uniform (0,1) generator. I_DRNSES - Initializes the table used by shuffled generators. I_DRNGES - Get the table used in the shuffled generators. I_DRNUN - Uniform (0,1) Generator I_DRNNOR - Random Normal Distribution I_RNBIN - Random integers from binomial distribution I_DRNGDA - Random integers from discrete distribution alias approach I_DRNGDT - Random integers from discrete using table lookup I_RNGEO - Random integers from Geometric distribution I_RNHYP - Random integers from Hypergeometric distribution. I_RNNBN - Negative binomial distribution I_DRNBET - Random numbers from beta distribution I_DRNCHI - Random numbers from Chi-squared distribution I_DRNCHY - Random numbers from Cauchy distribution I_DRNEXP - Random numbers from standard exponential I_DRNEXT - Random numbers from mixture of two exponential distributions I_DRNGAM - Random numbers from standard gamma distribution I_DRNGCT - Random numbers from general continuous distribution I_DRNLNL - Random numbers from lognormal distribution I_DRNNOA - Random normal numbers using acceptance/rejection I_DRNNOR - Random normal numbers using CDF method I_DRNSTA - Random numbers from stable distribution I_DRNTRI - Random numbers from triangular distribution I_DRNVMS - Random numbers from Von Mises distribution I_DRNWIB - Random numbers from Weibull distribution I_RNMTN - Random numbers from multinomial distribution I_DRNMVN - Random numbers from multivariate normal I_DRNSPH - Random numbers on the unit circle I_RNPER - Random perturbation of integers I_RNSRI - Index of random sample without replacement Screen I/O and Plot Subroutines CLS - Clear screen. FPLOT - Plot a Function GRAPH - High Resolution graph. GRAPHP - Multi-Pass Graphics Programing Capability GRCHARSET - Set Character Set for Graphics GRREPLAY - Graph replay and reformat command. OUTDOUBLE - Display a Real*8 value at a x, y on screen. OUTINTEGER - Display an Integer*4 value at a x, y on screen. OUTSTRING - Display a string value at a x, y point on screen. PLOT - Line-Printer Graphics SCREENCLOSE - Turn off Display Manager SCREENOPEN - Turn on Display Manager SCREENOUTOFF - Turn screen output off. SCREENOUTON - Turn screen output on. Statistical Functions BETAPROB - Calculate a beta probability. BINDF - Evaluate Binomial Distribution Function BINPR - Evaluate Binomial Probability Function BLUS - BLUS Residual Analysis CHISQPROB - Calculate chi-square probability. DERF - Error function of real*8/real*16 argument. DERFC - Inverse of error function. FPROB - Probability of F distribution. HYPDF - Evaluate Hypergeometric Distribution Function HYPPR - Evaluate Hypergeometric Probability Function INVBETA - Inverse beta distribution. INVCHISQ - Inverse Chi-square distribution. INVFDIS - Inverse F distribution. INVTDIS - Inverse t distribution. MEAN - Average of a 1d object.vector. NCCHISQ - Non central chi-square probability. NORMDEN - Normal density. POIDF - Evaluate Poisson Distribution Function POIPR - Evaluate Poisson Probability Function PROBIT - Inverse normal distribution. PROBNORM - Probability of normal distribution. PROBNORM2 - Bivariate probability of Nornal distribution. TDEN - t distribution density. TPROB - t distribution probability. VARIANCE - Variance of an object. System Subroutines DODOS - Execute a command string if under dos/windows. DOUNIX - Execute a command string if under unix. SYSTEM - Issue a system command. Time Series Functions ACF - Calculate autocorrelation function of a 1d object. CCF - Calculate the cross correlation function on two objects. DIF - Difference a series. FRACDIF - Fractional Differencing. GENARMA - Generate an ARMA series given parameters. MAKEJUL - Make a Julian date from a time series Variable Precision Math Subroutines and Functions Subroutines VPASET - Set Variable Precision Math Options Functions VPA - Variable Precision Math calculation Listing of Alias function names Name Replaced by LOG DLOG LN DLOG LOG10 DLOG10 EXP DEXP MOD DMOD MAX DMAX MAX1 DMAX1 MIN DMIN INVERSE INV SIN DSIN COS DCOS R4TOR8 DFLOAT R8TOR4 FLOAT SQRT DSQRT SINH DSINH GAMMA DGAMMA COSH DCOSH CONJ DCONJ ATAN DATAN ATAN2 DATAN2 ARSIN DARSIN ARCOS DARCOS ABS DABS Index of Toolkit Routines contained in matrix2.mac Index of programs, subroutines and Functions ACF_PLOT - Simple ACF Plot AUTOCOV - Autocovariance BPF - Baxter - King MA Filter BPFM - Baxter - King MA Filter with missing data CFREQ - Determine Cumulative Frequency Distribution COINT2 - Cointegration Tests of Two Series COINT2LM - Cointegration Tests of Two Series, OLS, L1, MM COINT2M - Moving Cointegration of Two Series COINT2ME - Moving Cointegration of Two Series - Extended Args. COINT2M2 - Moving Cointegration of Two Series OLS, L1, MM COINT3 - Cointegration Tests of Three Series COINT3ME - Moving Cointegration of Three Series DATA_ACF - Calculate ACF and PACF Plots DATAVIEW - View a Series Under Menu Control DO_SPEC - Display Periodogram and Spectrum DUD - Derivative Free Nonlinear Estimation FDIFINFO - Fractional Differencing Information FILTER - High Pass / Low Pass Filter using Real FFT FILTERC - High Pass / Low Pass Filter using Complex FFT FORPLOT - Forecast Plot using GRAPHP GARCH2P - Two Pass GARCH Using ARMA Command GARCH2PF - Two pass GARCH using ARMA Command with forecasting GTEST - Tests output of a ARCH/GARCH Model GWRITE - Save Objects in GAUSS Format using one file GWRITE2 - Save Objects in GAUSS Format using two files HP_BP_1 - Baxter-King & Hodrick-Prescott Filtering HP_BP_2 - Baxter-King & Hodrick-Prescott Filtering Moving Window HP_2 - Hodrick & Prescott Filtering of a Moving Window LMTEST - Engle (1982) test for ARCH for a range of lags MARSPLOT - Automatically plot MARS Curves and Surface Plots MCLEODLI - McLeod-Li (1983) Linearity test MARQ - Estimation of a Nonlinear Model using Derivatives MINIMAX - Estimate MINIMAX with MAXF2 MISSPLOT - Plot of a series with Missing Data MQSTAT - Multivariate Q Statistic MOVEAVE - Moving average of a vector MOVEBJ - Moving Arima Forecast using AUTOBJ MOVEH82 - Moving Hinich 82 test MOVEH96 - Moving Hinich 96 test MOVEOLS - Moving OLS Calculation MOVEVAR - Moving Variance NLVARCOV - Calculates NLLSQ Variance Covariance OLSPLOT - Plot of Fitted and Actual Data & Res PAD - Pad a 1D Real*8 Series on both ends PVALUE_1 - Present value of $1 recieved at end of n years PVALUE_2 - Present Value of an Annuity of $1 PVALUE_3 - Present value of $1 recieved throughout year RTEST - Test Residuals of Model RTEST2 - Test Residuals of Model - No RES and Y Plots QUANTREG - Quantile Regression Program RESET77 - Thursby - Schmidt Regression Specification Test SUBSET - Subset 1d, 2d array, vector or matrix under a mask. Running the Matrix Command: The MATRIX command can be run in "batch mode" or interactively. When run interactively, statements can be reloaded and scripts can be edited and submitted. The file _imatrix.mac is the default name for the script files. The first member _matrix is automatically run if the script is submitted. The B34S save file format is the same as used by Speakeasy and the Speakeasy importall statement can be used to further process this file. The MATRIX command can also read and write SCA and RATS portable files and provides a bridge between these systems. The Display Manager provides a number of options on how to use the system. 1. The MATRIX button on the Display Manager window gets B34S into interactive MATRIX command mode. If the user wants to customize how the matrix command will come up, the IMATRIX section in the MATRIX.MAC file can be changed. In MANUAL mode one command at a time can be entered or scripts can be edited and run. The user is encouraged to modify the MATRIX file to load data etc. Interative use is intended for quick commands. If the MATRIX member of the MATRIX.MAC file is modified, the MATRIX button could be made to execute a matrix program, BEFORE going into MANUAL mode. The MATRIX member of matrix.mac is: /$ This shell can be modified to load data set if desired b34sexec matrix; call manual; b34srun; The _imatrix.mac file has a required member _matrix which can be edited and submitted while under in the interactive matrix command mode. A sample file is: