MTGSAM utility programs
Several utilities are available to simplify some of the tasks necessary in using the Gibbs sampling programs. A brief description of each of the programs follows.
HERITCOR.FOR – This program generates a new sample file (MTGS64) that contains values
of the heritabilities (fraction of phenotypic variance for other variances) and correlations. The program reads the output from MTGSPREP to determine the model so that the calculation of phenotypic variance is determined without user intervention. The program is linked with subroutines in the
MTGSSUB.FOR, MTGSRSB.FOR, and timing subroutines. A batch file and make
file for automated compiling and linking are included.
LAGCOR.FOR – This program calculates the lags of samples written to MTGS61 or MTGS64. The user has the option of specifying additional burn-in rounds if the
value given in MTGSRUN is considered insufficient.
The program requests the gap between lag values calculated and the number of correlations to calculate. For example, if a value of 5 is used for
the lag and 20 correlations are requested, the program would calculate the correlation of samples written 5, 10, 15, ... 100 records apart in the sample file.
Remember that the samples in the sample files may already be thinned depending on the option chosen in MTDFRUN. This thinning rate
should be considered when determing any additional burn-in and when deciding
on the gap between values calculated.
The user specifies the original frequency of sample writing used in MTGSRUN so that correct lags can be calculated based on the original (unthinned) chain. The lags listed in the output file correspond to the original chain.
For example, assume that a thinning rate of 20 had been used in MTGSRUN (every 20th sample written to MTGS61). If the user requested that a gap of 5 records be used for calculating a total of 10 correlations, then the program would calculate correlations of samples written 5 apart corresponding to lags of 5, 10, 15, ..., 50 records apart in the thinned chain; these correlations would correspond to lags of 100, 200, ..., 1,000 samples apart in the original chain.
- MNSAMP.FOR – This program calculates the mean of the sampled values in MTGS61 or
MTGS64, which is especially useful to monitor a Gibbs chain for a run that has not completed. The
program allows the user to specify additional burn-in rounds if the value given in MTGSRUN is considered insufficient.
- PULLDAT.FOR – This program is used to read sampling data from MTGS61, 62, or 64 and copy that information to a user-specified text file. The user specifies the number of variables to copy to the text file (with a shortcut for writing all of the variables). The program allows the user
to specify additional burn-in rounds if the value given in MTGSRUN is considered insufficient. The program will write the sample information for a user-specified interval between samples read from
the sample file.
- PULLMAT.FOR – This program is used similarly to PULLDAT.FOR (described above) except that the output file is a user-specified MATLAB file. The resulting data set can be loaded into MATLAB using the "load filename" command. The file name must have .mat as the file extension. The
matrix will be called gs (in lower case), and the rows will contain the string of values for each parameter specified (rather than columns) … an attempt to minimize memory usage. The only way to write the data file with columns containing the variable is to read the whole data set
in, which will often be impossible. A result of this scheme is that the number of samples in the
sample file (MTGS61 or 64) must be known in advance.
- GIBBSIT.FOR – A FORTRAN program written by Raftery and Lewis, the
description comes from the header of the program. This program calculates the number of iterations required in a Markov-chain Monte Carlo (e.g., Gibbs sampling) run. The user has to specify the precision required. The program returns the number of iterations required to estimate the posterior cdf of the q-quantile of the quantity of interest (a function of the parameters) to within ±r with probability s. It also gives the number of "burn-in" iterations required for the conditional distribution given any starting point (of the derived 2-state process) to be within ε of the actual equilibrium distribution.
This program is not distributed with the utilities program but is available directly from
Please direct questions, comments, and program problems to Curt Van Tassell.
Last Modified: 01/12/2017