### 1.2 Running BayES

Once successfully installed, BayES can be used in two modes: (i) interactive mode using its GUI facilities, and (ii) batch mode by calling BayES from the command line and providing a script ﬁle for execution. Instructions on using BayES in each of these modes are presented separately in the following two sections. See also the video tutorials on BayES’ website.

#### 1.2.1 Running BayES in interactive mode

BayES can be initiated in interactive mode by (i) clicking on the BayES icon on the system’s ‘start’ menu or on the Launchpad (under macOS), (ii) double-clicking on the BayES icon on the system’s desktop (iii) typing BayES and hitting the return key on the system’s console window, or (iv) double-clicking on the BayES link ﬁle in the installation directory, as it was provided during installation. Note that the ﬁrst three options may be unavailable, depending on the options selected during installation. However, the fourth option will always be available.

When BayES starts in interactive mode the main window will appear. This window contains:

• the BayES console, where output will be printed once instructions are submitted by the user
• the datasets pane, which will contain a list of datasets held in memory, once any datasets are imported or created
• the models pane, which will contain a list of models held in memory, once any models are estimated and their results stored
• the matrices pane, which will contain a list of matrices held in memory, once any matrices are deﬁned by the user
• the main menu on the upper-left corner of the window, which provides the main way of interacting with BayES when using the GUI (importing data, estimating models, plotting, etc.)
• the main window toolbar, located right below the main menu, which provides quick access to some frequently used functions, such as importing data, saving and loading workspaces or interrupting the execution of a procedure
• the status bar at the bottom of the main window, which displays the current working directory as well as a progress bar that will display information on the progress of computationally intensive procedures

An additional window, the BayES script editor, which does not appear automatically when BayES starts, can be shown from the main menu: View Script Editor. This window can be used to type code in BayES’ scripting language and submit instructions in bulk.

Once the user submits instructions, either via the GUI or the script editor window, these instructions are interpreted and the appropriate actions executed. During this time most GUI functions will not be accessible. Upon completion of execution control returns to the user, who can continue with submitting further instructions.

The ﬁrst time that BayES starts in interactive mode the working directory is set to the installation directory, as provided during installation. This directory will be used as the starting point for importing data and saving output (datasets, matrices, plots, etc.) and looking for user-deﬁned functions. Depending on the options chosen by the user (from Help Preferences under Microsoft® Windows® and Linux systems and from Preferences under macOS systems in the main menu), this directory may change when BayES is subsequently invoked in interactive mode.

#### 1.2.2 Running BayES from the command shell

If BayES is made globally available from the command line3 then BayES can also be run in batch mode. This is achieved by submitting a command of the following form on the system’s command console (cmd under Microsoft® Windows® or bash under Linux and macOS):

BayES <input file> $\left[$<output file>$\right]$

where:

• <input file> is a BayES script ﬁle that contains statements written in the BayES language (see Chapter 2 for more details). <input file> should be provided as the name of the script ﬁle (including its extension), prepended by the path to the ﬁle, either in absolute terms or relative to the command console’s current directory.
• <output file> is an optional argument that deﬁnes a ﬁle to which any output from the BayES console is redirected. As before, <output file> should be provided as the name of the ﬁle (including its extension), prepended by the path to the ﬁle, either in absolute terms or relative to the command console’s current directory. If such a ﬁle does not exist then BayES will create it. If the ﬁle exists its contents will be replaced.

Once a command of this form is submitted to the system’s command console, BayES will ﬁre-up without displaying its GUI and it will start executing the commands contained in <input file>. If an <output file> is provided, output from the BayES console is directed to this ﬁle; otherwise output is printed on the system’s console window. Note that BayES does not distinguish between normal and error output and everything is printed on the normal channel. Upon completion of the execution of the statements contained in <input file> or upon encountering an error, BayES terminates and control is passed back to the system’s command console.

3This can be achieved by checking the relevant checkbox during installation.