Running TETRAD 3

 

TETRAD 3 is an interactive, command driven program. Whereas data and background assumptions are read in from a file, output is only produced in response to a command entered interactively. All of the high level commands work essentially the same way. You must prepare an input file (or files) with the necessary information, enter the program from your operating system, and issue the command of your choice. TETRAD then makes sure it has the kind of input information it needs to carry out the computation and a place to put the output. When these items are taken care of, the program carries out the specified computation and then waits for another command.

 

An Overview of the TETRAD 3 Modules

The main TETRAD 3 modules each have their own chapter later in this manual. In the following descriptions, when we say "data for continuous variables" we mean either a covariance or a correlation matrix or raw data for continous, or approximately continuous variables, and when we say "data for discrete variables" we mean raw data for variables that take on discrete values. The modules are:

 

Build: Takes background knowledge and data for continuous or discrete variables, or independence relations directly, and outputs a set of causal structures that entail the same conditional independence relations, and are compatible with any user-entered background knowledge.

 

Estimate: Takes a Bayesian network and data for discrete valued variables, and provides a maximum likelihood estimate of the parameters of a joint distribution that satisfies the independence constraints imposed by the Bayesian network's graphical structure. 

 

Update: Takes a parameterized Bayesian network and values for a subset of its variables, and produces the distribution of each of the remaining variables, conditional on the given values.

 

Tetrads: Takes an acyclic causal graph, and data for continuous variables, and outputs the set of tetrad equations entailed by the graph and the set of tetrad equations that are not rejected by a statistical test at a user set significance level.

 

Purify: Takes a list of latent variables, an initial measurement model for those latents, and data for continuous variables, and outputs a unidimensional submodel of the initial measurement model, if there is one.

 

MIMbuild: the Multiple Indicator Model Builder. Takes a list of latent variables, a unidimensional measurement model for those latents, data for continuous variables, and outputs a set of causal structures among the latent variables that entail the same vanishing tetrad differences.

 

Search: Takes data for continuous variables, and an initial recursive structural equation model, and outputs a set of respecifications of the model.

 

Makemodel: Takes an acyclic directed causal graph and information about the type and values of its parameters, and helps the user specify an input model for the Monte Carlo Generator.

 

Monte: The Monte Carlo Generator outputs sample data generated pseudo-randomly from the distribution characterized by a model created with Makemodel.

 

STATwriter: Takes an acyclic causal graph, interpreted as a recursive structural equation model, and data for continuous variables, and produces an input file to EQS, LISREL, or CALIS, all of which do parameter estimation for and tests of structural equation models.

 

Regress:

 

Cequiv:  Takes two directed graphs, cyclic or acyclic and compares them for Markov equivalence.

 

Gibbs:  Takes a structural equation model and covariance data, and after prompting for a prior distribution over the parameters, returns a sample from the posterior over the parameters.

 

Command Syntax

All TETRAD 3 commands consist of a single word. Any TETRAD 3 command can be abbreviated, as long as the string you type uniquely determines the name of a command. For example, the "Removeedges" command can be abbreviated to "Removeed," but it cannot be abbreviated to "Remove," because then it cannot be distinguished from the "Removetemporal" command. If you abbreviate a command so much that it cannot be distinguished from some other command, TETRAD 3 will warn you that the command you have entered is ambiguous.

TETRAD 3 commands are not case sensitive. It does not matter whether a character is upper-case or lower-case in any command. Thus as far as the program is concerned the commands "Removeed," "REMOVEED," "removeed," and "ReMoVeEd" are all equivalent and call the "Removeedge" command. However, the program does distinguish between lower case and uppercase letters in variable names.  Thus the variables names "x1" and "X1" are not equivalent. On the UNIX version, file names are case-sensitive, but on the DOS version they are not. "example.in" and "Example.in" are not equivalent on the UNIX version of the program, but are equivalent on the DOS version.

 

Entering and Exiting the Program

  

The user calls TETRAD 3 by typing "tetrad" at his operating system's prompt; in this case our operating system prompt is "C:\TETRAD\RELEASE."[1] To exit TETRAD 3, simply type "exit." This is illustrated in the following session.

 

Session 3-1: Entering and exiting TETRAD 3

 

******************************************************************

C:\TETRAD\RELEASE>tetrad

        TETRAD 3 - Version 1.2 for DOS

                       by

        Peter Spirtes, Richard Scheines,

       Christopher Meek, and Clark Glymour

           

  Copyright (C) 1994 by Lawrence Erlbaum Associates

 

For help, type "help"

Initializing Data Structures

>exit

C:\TETRAD\RELEASE>

*******************************************************************

 

Running the Program

 

Suppose we create the input file shown between the two lines of "###" in Fig. 3.1 with a text editor, and we are interested in using the Search command to find respecifications of the graph in this file.

 

############   search.in   ##############.in;.in;

/Covariance

 2000

 x1    x2    x3    x4    x5  

 1.00000

 0.54508  1.00000

 0.53433  0.46815  1.00000

 0.58426  0.53134  0.51528  1.00000

 0.63433  0.56856  0.78859  0.62387  1.00000

 

/graph

T x1

T x2 

T x3

T x4

T x5

 

############   search.in   #############

Fig. 3.1: The Input File "search.in"

 

We would proceed through the interaction we show in session 3.2.

 

Session 3.2

 

*******************************************************************

C:\TETRAD\RELEASE>tetrad

        TETRAD 3 - Version 1.2 for DOS

            COPYRIGHT (C) 1994 by

        Peter Spirtes, Richard Scheines,

       Clark Glymour and Christopher Meek

 

For help, type "help"

Initializing Data Structures

 

>input

Input File: search.in

 

After inputting the file search.in, we now issue the "search" command. Because we have not yet specified an output file, TETRAD prompts us for one. We type in "search.out," which names a file TETRAD will create and into which it will write the output from the "search" command.

 

>search

Output file: search.out

 

Adding edge:

      x5 -> x3

      x3 C  x5

      x3 -> x5

 

After a preliminary search to find those edges that can be added to the original model that do the most to improve the fit to the data, TETRAD 3 begins the main part of the search. Each edge considered is printed to the screen. When it has finished writing to the file "search.out," TETRAD offers its prompt and waits for any further commands.

 

>exit

C:\TETRAD\RELEASE>

*******************************************************************

.out;

We discuss the "search" command and explain its output in chapter 11.

 

Aborting a Run

 

A computation can be aborted in either of two ways. Holding the control key down while striking the "c" key will eject you from the program and put you back at the operating system prompt. On UNIX systems holding the control key down while striking the "\" key will stop the computation but leave you in the TETRAD 3 program, whereas on DOS systems holding down the control key while typing "g" will have the same effect.[2] The second procedure may not stop the computation immediately, because the program tries to save as much information as possible, and only some of the commands can be interrupted in this way.  

 

Help

The help command provides a list of the commands available.  If you type "help" and a carriage return the program will give you a list of the commands, and a very brief description of their functions.

 

Session 3.3: Help

 

*******************************************************************

>help

The main TETRAD 3 commands are:

BUILD       Constructs a set of causal models from covariance matrix

            or raw continuous data.

ESTIMATE    Estimates the parameters of a discrete Bayesian Network

EXIT        Exits the program.

MAKEMODEL   Creates a statistical model for the Monte Carlo module.

MIMBUILD    Creates a set of linear multiple indicator models.

MONTE       Creates pseudo-random samples from a given model.

PURIFY      Purifies indicators from a multiple indicator

            measurement model.

SEARCH     Searches for respecifications of a given linear structural

            equation model.

STATUS      Prints the values of all parameters controlling output.

STATWRITER  Prepares input files for EQS, LISREL, or CALIS.

TETRADS     Computes the tetrad constraints implied by a model

            and those that are judged to hold in the population.

UPDATE      Computes conditional probabilities in a discrete

            Bayes Network.

>

*******************************************************************

 

The Status Command

If at the TETRAD 3 prompt you type "status" and a carriage return, the program will report the values of any parameters you have set, either interactively or in an active input file. For example, if we had input the file search.in, as we show in session 3.2, but ask for status before running the search module, we get the following response (session 3.4):

 

Session 3-4: Status

 

*******************************************************************

>status

Output file: search.out

Graph file: search.in

Data file: search.in

Graph: 

    T -> x1   T -> x2   T -> x3   T -> x4   T -> x5  

   

Parameters:

 

  Sample Size: 2000

  Continuous Data

 

Covariance Matrix

x1       x2       x3       x4       x5      

 1.0000  

 0.5451    1.0000  

 0.5343    0.4681    1.0000  

 0.5843    0.5313    0.5153    1.0000  

 0.6343    0.5686    0.7886    0.6239    1.0000  

 

  Significance:      0.0500

  Weight:            0.1000

  Width:             0.9500

  Depth:            Unbounded

 

  Acyclic:          YES

  LM:               YES

  MM:               YES

  ML:               YES

  LL:               YES

  Singleconnection: YES

  Common:           YES

  Settime:          Unbounded

*****************************************************************



[1] If the TETRAD 3 program resides in a different directory than your current directory, then the program is invoked by typing the full path name or configuring your computer to search in other directories. For example on the UNIX system if the program is in the "/usr/user" directory, type "/usr/user/tetrad." On the DOS version, if the program is in the "c:\tetrad" directory, type "c:\tetrad," or put Path: c:\tetrad in the autoexec.bat file.

[2]On the UNIX operating system, TETRAD 3 uses a "quit" signal to interrupt the program.  On many Unix systems, the default key combination for sending a quit signal is holding down the contral key while typing "\".  If you type "stty all" at your operating system prompt, the operating system will state what key combination sends a quit signal on your version of the operating system.  This key combination is the one that you should use to interrupt TETRAD 3 on UNIX versions of the program.