G7 Commands: M

madd <matrix A> = [bank letter.]<matrix B> + [bank letter.]<matrix C> [period]

The madd command performs addition or subtraction of two matrices and stores the results in a third. If the optional date <period> is absent, then the operation is done over the fdates range. If no bank letter is specified, the right-hand side matrices are assumed to be in the default Vam file.

Example:

fdates 1972 2020
madd A = B + C

This example forms A as the sum of B and C, over the period 1972 to 2020, with all matrices in the default Vam file.

Example:

fdates 1972 2020
madd A = e.B – e.C

This example forms A in the default Vam bank as the difference of B and C from bank ‘e’, over the period 1972 to 2020.

Related Topics: @bmk function, linv, mcopy, minv, mmult, mtrans

mainfontname <name>
Set the typeface in the main G7 window.

Related Topics: xl font

mainfontsize <size>
Set the size of the type in the main G7 window.

Related Topics: xl font

mainfontcolor <color>
Set the font color in the main G7 window.

Related Topics: xl font

maincolor <color>
Set the background color of the main G7 window.

Related Topics: xl font

mainautofontsize <0|1>
Specify whether to adjust the font size automatically in the main G7 window. Options may be specified as <0|1>, <yes|no>, <false|true>, or <off|on>.
mainfontbold <0|1>
Specify the bold setting in the main G7 window. Options may be specified as <0|1>, <yes|no>, <false|true>, or <off|on>.
mainfontitalic <0|1>
Specify the italic setting in the main G7 window. Options may be specified as <0|1>, <yes|no>, <false|true>, or <off|on>.
mainfontunderline <0|1>
Specify the underline setting in the main G7 window. Options may be specified as <0|1>, <yes|no>, <false|true>, or <off|on>.
mainfontstrikeout <0|1>
Specify the strikeout setting in the main G7 window. Options may be specified as <0|1>, <yes|no>, <false|true>, or <off|on>.
(matd)ata
(matu)pdate
This command brings data into G7 in a rectangular format, which easily could be prepared using Excel or OpenOffice. There are three alternative forms in which the series can be arranged. The series can be arranged either in vertical columns with the name of the series at the top of the column, or in horizontal rows with the names appear on the same line of the matdat command. Up to 20 columns of numbers occupying up to 160 characters per line may be given. The matdata command is used to provide data for a new series. If the series already is present in the databank, it will be overwritten. The matupdate command requires that the data already are present in the workspace bank, and it merges the new data with the existing series. The three forms of the command are:

Form 1:

matdat
               gnp     c       cd      cnd     cs
    1981.1    1513    950     146     359     445
    1981.2    1512    949     140     361     448
    1981.3    1522    956     143     361     450 ;

Dates appear as the first number on each line. Here 1513 is the value of “gnp” in 1981.1, 1522 is the value in 1981.2, etc.

Form 2:

matdat 1981.1
    gnp     c       cd      cnd     cs
    1513    950     146     359     445
    1512    949     140     361     448
    1522    956     143     361     450 ;

The date of the first observation appears on the command line, and no dates appear on subsequent lines. Use a semicolon to end the data. (You must have a semi-colon on the last line of data for either form.)

Here is yet another version of legal format for matdata.

Form 3:

matdat  gnp out(1-4) 1981.1
    1513    1512    1522
    950     949     956
    359     140     143
    359     361     361
    445     448     450;

Here, series names are given immediately after matdat with starting date given as the last argument on the matdat line. The first series reads from the first line after the matdat, the second series reads from the second line, and so on. Note also that group definitions are allowed in this version.

Related Topics: data

matin <matrix_name> <year> <firstrow> <lastrow> <firstcol> <lastcol> [<skip>]
[form]
The matin command reads matrix data for one year and stores it in a Vam file. For it to work, a Vam file already must be assigned and set as the default Vam file. Then a rectangular array must follow with numbers matching the <firstrow>, <lastrow>, <firstcol>, and <lastcol> parameters of the command. As in the vmatdata command, the optional <skip> parameter is the number of spaces to be skipped in reading each line. The <skip> parameter and the <form> line work together exactly as for vmatdata: the absence of a <skip> parameter indicates the presence of a form line. A ‘#’ in the first space of a line means to skip the whole line. Use of matin does not affect entries outside the specified area, so it can be used to update a matrix as well as to introduce it originally.

Example:

matin govstr 1987 1 25 1 5 4
    1     48      0      0      0     61
    2    495      0     32      0    453
    3      0      0      5      0      0
    4   1344      0      0      0   1651
    5    812      0    201      0      0
    6    859    555      0      0   3012
 ...

The above example actually is used to introduce the distribution of government structures by 25 categories to 5 government types in IdLift. The data presented is for 1987, and covers rows 1 to 25 and columns 1 to 5 of the matrix. Four columns are to be skipped at the beginning of each line, and this is where we keep the row number, which serves to make the file easier to read.

Related Topics: matin5, pmatin, pmatin1 vmatdata

matin5 <matrix_name> <year>[<width> <decs> <IndexWidth>]

The matin5 command is another command for reading data for a matrix. These data are in a format called “punch5.” This is an input format for matrices that is useful when a significant number of the matrix elements may be zero. On each line, there are 5 cells (hence the name), and for each cell, the row, column and value are specified. For this command to work, a Vam file must be assigned and set as the default Vam file. In the above syntax, <matrix_name> is the name of the matrix as shown in VAM.CFG, <year> is the year of the data, <width>, <decs> and <IndexWidth> are optional arguments that specify the width of the data field for each cell, the number of decimal points, and the width of the field for the row and column indexes. The end of the matrix data is signaled either by a ‘;’ in the first space on a line or by the end of the file.

Here is a sample from the beginning of an A-matrix:

matin5  am 1977 9 5 3
# A-matrix for 1977. 83 rows and 83 columns.
AM     1  1 0.245790  1  4 0.000220  1  8 0.000410  1  9 0.281300  1 10 0.058360
AM     1 11 0.002070  1 12 0.005680  1 13 0.000380  1 15 0.001700  1 16 0.003060
AM     1 22 0.089770  1 24 0.000070  1 48 0.001210  1 49 0.000130  1 50 0.000030

Related Topics: matin, pmatin, pmatin1, punch, punch5,

matty | matpr [file <file_name>] <date1> <date2> [<option>]
<series1> <series2> <series3> …. <seriesN> ;
The matty, or matpr, command creates or overwrites a file of data in parallel columns for input into spreadsheets or other software. The <file_name> is the name of the file created (if given it must be preceeded by “file”) and <date1> and <date2> are the starting and ending dates of the transfer. The only option currently available is the “dump” option, which prints data in a compact format. Up to 100 series may be transferred in one file. If no filename is given, the data are written to the screen and to the “save” file, if one currently is open. Width and precision are set by the current values given by either the format command or the width and decs commands. The year format is given by the yearformat (yf) command.

Example:

#  MATTY.TST -- Test the output of the "matty" command.
hbk quip a
matty file nipa.prn 1985.1 2000.2
gnp c v g;

Related Topics: Writing Data from G7, gridtype, p123, rp123, format

maxobs <number>

This command sets the maximum number of observations that can be in any series in the workspace bank.

Example:

maxobs 1500

allows series with up to 1500 observations. The default value of maxobs is 600. Increasing the value slows down most data operations and may reduce the number of variables that can be included in any regression. If long series are to be stored in the workspace bank, the maximum number of observations in this bank should also be increased. This number is set at the end of the G.CFG file.

Note that you may delete the workspace bank and set all new parameters all in one fell swoop with the zap command.

Related Topics: G.CFG file, zap

mcopy [bank letter.]<destination> = [bank letter.]<source> [<period>]

The mcopy command copies the matrix (or vector) from the source to the matrix (or vector) destination. If no bank letters are specified, then both the source and destination are assumed to be in the default Vam file. If a value is given for [period] then only the values for that period are copied. Otherwise, the starting period and ending period are determined by the fdates command.

Example:

vam \idlift\devel\hist b
vam \idlift\model\hist a
fdates 1972 2040
mcopy a.am = b.am

This example copies the matrix “am” from the IdLift development Vam file to the production Vam file for the period 1972 to 2040.

Note that the vc command also will copy vectors within the same Vam file, and the vc command also is capable of evaluating certain algebraic equations involving matrices.

Related Topics: Matrix Operations, madd, mmult, minv, linv, mtrans, vc

(mg)raph <name1> [<name2>] [<name3>] … [<name7>] <date1> <date2> [date3]
(mg)raph (<name1>) [(<name2>)] [(<name3>)] … [(<name7>)] <date1> <date2> [date3]
Consruct a Multi-scale Graph. This is exactly like the graph command except that the series has its own vertical scale chosen so that its graph extends from the top to the bottom of the screen. The scale shown on the left is for the first series; the scale shown on the right is for the second. If more than two series are displayed, the other series will also be plotted on their own scale, but that scale will not be displayed. Algebraic expressions may be provided in place of some or all of the series names, so long as the expressions are enclosed in parentheses.

Related Topics: Drawing Graphs, graph

minv [bank letter.]<matrix A> [period]

The minv command performs in-place matrix inversion. It works over the current fdates, or for the <period> specified.

Related Topics: Matrix Operations, linv, madd, mcopy, mtrans, mmult, vc

missing <y | n> [<missing_text>]

This command does two things. First it tells G7 whether to rely on missing values to be present when performing regressions, interpolations, or other functions. When missing is set to “y”, then G7 will complain if missing values are in any of the data in a regression. Functions such as @benchmark and @lint rely on missing values to tell which periods of a series need to be filled. If missing is “n”, then G7 treats zeroes as missing values, and the regression command will not complain if there are zeroes.

The second function of the missing command is to supply some text to be displayed when missing values are present. A missing value is equal to -0.0000001, so by default it will be displayed as -0.0. However, by using the missing command, you can tell G7 to display missing values as “miss”, “N/A”, or some other character string. Just make sure that the <missing_text> is short enough to line up well with the other data being displayed.

You can convert the zeroes in a series to missing values by using the @miss() function. Conversely, you can convert missing values to zeroes using the @zeroes function.

Related Topics: Functions in G7, Missing Values

mmult [bank letter.]<matrix A> = [bank letter.]<matrix B>*[bank letter.]<matrix C> [period]
mmult [bank letter.]<matrix A> = [bank letter.]<matrix B>’[bank letter.]<matrix C> [period]
mmult [bank letter.]<matrix A> = [bank letter.]<matrix B>/[bank letter.]<matrix C> [period]
mmult [bank letter.]<matrix A> = [bank letter.]<matrix B>&[bank letter.]<matrix C> [period]
The mmult command is actually a family of commands, with four operations available:
  1. The asterisk (*) operator is matrix multiplication. If the matrices are conformable, then

    mmult A = B*C
    

    multiples matrix B by matrix C and stores the result in matrix A. If a date is specified on the command line, the operation will be done for that period only. Otherwise, it is performed over the current fdates.

  2. The apostrophe (’) operator forms the transpose of the first matrix and then calculates the matrix multiplication. If the matrices are conformable, then

    mmult d.A = e.B'e.C
    

    multiples the transpose of matrix B in bank ‘e’ by matrix C in bank ‘e’ and stores the result in matrix A in bank ‘d’.

  3. The slash (/) operator does element-by-element division. So,

    mmult A = B / C
    

    divides each element of B by the corresponding element in C and places the result in A.

  4. The ampersand (&) operator does element-by-element multiplication. So,

    mmult A = B & C
    

    multiplies each element of B by the corresponding element in C, and places the result in A.

Related Topics: Matrix Operations, linv, madd, mcopy, minv, mtrans, vc

mode <test | forecast> or mode <t | f>

mode determines what is to be done between <rdate2> and <rdate3>. The default mode is test. In that case, the values “predicted” by the equation for the period from <rdate2> to <rdate3> are compared to the actual data and SEE and MAPE parameters are computed for the test period. For forecast mode to work, the series for all independent variables except lagged values of the independent variable must extend to <rdate3>. Then, in forecast mode, two forecasts are made for the period from <rdate2> to <rdate3>. The first simply is the predicted value; the second is the predicted value plus the “rho adjustment” to take account of the error in the last period of fit.

Related Topics: Ordinary Regression, limits, regress

monup(mup) <series_name>

This command is used for updating a quarterly series with monthly data.

Example:

mup rtb
  1983.3  9.120 9.390 9.050   8.710 8.710 8.960
  1984.1  8.930 9.030 9.440;

“rtb” is a quarterly series being updated with monthly data. 9.120 is the value of rtb in July 1983; 9.390 is the value in August 1983, etc.. Note that quarterly dates are the first numbers on each line and three monthly observations must be present for each quarter.

move <matrix> <up|down|left|right> <first> <last> <newfirst> [year]

This command moves a block a rows up or down, or moves a block of columns left or right, where:

<matrix>:

is the name of a matrix whose rows or columns are to be moved.

<up|down|left|right>:

indicates the direction of movement

<first>:

indicates the first row or column of the block that is to be moved.

<last>:

indicates the last row or column of the block that is to be moved.

<newfirst>:

indicates the first row or column to which the block is to be moved.

[year]:

specifies a single year. If not specified, the function will do the move for all years between the active fdates.

Example:

move fact left 2 4 1 1997

In this example, columns 2 through 4 are moved left and overwrite columns 1 through 3. Column 4 will be zero.

Related topics: coef, flow, rdras

mtrans <matrix A> [bank letter.]<matrix B> [period]

The mtrans command takes the transpose of the second matrix (B) and places it in the first matrix (A). The two matrices can be in different Vam files, but A must be in the default Vam bank. If no bank letter are specified for B, then B is assumed to be in the default Vam file.

mtrans A e.B

sets A to the transpose of B, where B is found in bank ‘e’.

Related topics: Matrix Operations, linv, madd, mcopy, minv, mmult, vc