1
ESS[BUGS] was designed for use with BUGS software. It was developed by
2
Rodney A. Sparapani and has some similarities with ESS[SAS].
3
ESS facilitates BUGS batch with ESS[BUGS], the mode for files with the .bug
4
extension. ESS provides 5 features. First, BUGS syntax is described to allow
5
for proper fontification of statements, distributions, functions, commands and
6
comments in BUGS model files, command files and log files. Second,
7
ESS creates templates for the command file from the model file so that
8
a BUGS batch process can be defined by a single file. Third, ESS
9
provides a BUGS batch script that allows ESS to set BUGS batch
10
parameters. Fourth, key sequences are defined to create a command
11
file and submit a BUGS batch process. Lastly, interactive submission of BUGS
12
commands is also supported.
14
@comment node-name, next, previous, up
15
@node ESS(BUGS)--Model files, ESS(BUGS)--Command files, ESS for BUGS, ESS for BUGS
16
@section ESS[BUGS]--Model files
18
Model files (with the .bug extension) are edited in ESS[BUGS] mode. Two keys
19
are bound for your use in ESS[BUGS], F2 and F12. F2 performs the same action
20
as it does in ESS[SAS], @xref{ESS(SAS)--Function keys for batch processing}.
21
F12 performs the function
22
ess-bugs-next-action which you will use a lot. Pressing F12 in an empty buffer
23
for a model file will produce a template for you.
25
ESS[BUGS] supports "replacement" variables. These variables are created as
26
part of the template, i.e. with the first press of F12 in an empty buffer.
28
all capitals and start with '%': %N, %DATA, %INIT, %MONITOR and %STATS.
29
When you are finished editing your model file, pressing F12 will perform the
30
necessary replacements and build your command file for you.
32
The %DATA variable appears in
33
the line 'data in "%DATA";'. On the second press of F12, %DATA will be
34
replaced by the model file name except it will have the .dat extension. If
35
your data file is named something else, then change %DATA in the template to
36
the appropriate file name and no replacement will occur.
38
The %INIT variable appears in
39
the line 'inits in "%INIT";'. On the second press of F12, %INIT will be
40
replaced by the model file name except it will have the .in extension. If
41
your model will be generating it's own initial values, place a comment
42
character, #, at the beginning of the line. Or, if your
43
init file is named something else, then change %INIT in the template to the
44
appropriate file name.
46
The %N variable appears in the line 'const N = 0;#%N'. Although it is commented,
47
it is still active. Notice that later on in the template you have the line
48
'for (i in 1:N)'. The BUGS constant N is the number of rows in
49
your data file. When you press F12, the data file is read and the number of
50
lines are counted (after %DATA is resolved, if necessary). The number of
51
lines replace the zero in the 'const N = 0' statement.
53
The %MONITOR variable appears on a line by itself. Although it is commented,
54
it is still active. This line is a list of variables that you want monitored.
55
When you press F12, the appropriate statements are created in
56
the command file to monitor the list of variables. If the line is blank, then
57
the list is populated with the variables from the 'var' statement.
59
The %STATS variable is similar to the %MONITOR variable. It is a list of
60
variables for which summary statistics will be calculated. When you press
61
F12, the appropriate statements will be generated in your command file.
63
Please note that the %DATA and %INIT variables are only replaced on the second
64
press of F12, but the actions for %N, %MONITOR and %STATS are performed on
65
each press of F12 if you re-visit the model file.
67
@comment node-name, next, previous, up
68
@node ESS(BUGS)--Command files, ESS(BUGS)--Log files, ESS(BUGS)--Model files, ESS for BUGS
69
@section ESS[BUGS]--Command files
71
To avoid extension name collision, .bmd is used for BUGS command files. When
72
you have finished editing your model file and press F12, a command file is
73
created if one does not already exist. However, the command file was
74
created, it recognizes two "replacement" variables: %MONITOR and %STATS.
76
Two %MONITOR variables appears on lines by themselves. Although they are
77
commented, they are still active. Between them appears the necessary
78
statements to monitor the list of variables specified in the model file. The
79
behavior of the %STATS variable is similar.
81
When you are finished editing your command file, pressing F12 again will submit
82
your command file as a batch job. Batch scripts are provided for both DOS and
83
Unix in the etc sub-directory of the ESS distribution. The DOS script is
84
called "BACKBUGS.BAT" and the Unix script is "backbugs". These scripts allow
85
you to change the number of bins to use in the Griddy algorithm
86
(Metropolis sampling). That is handled by the variable ess-bugs-default-bins
89
@comment node-name, next, previous, up
90
@node ESS(BUGS)--Log files, , ESS(BUGS)--Command files, ESS for BUGS
91
@section ESS[BUGS]--Log files
93
To avoid extension name collision, .bog is used for BUGS log files. The BUGS
94
batch script provided with ESS creates the .bog file from the .log file when
95
the batch process completes. If you need to look at the .log file while
96
the batch process is running, it will not appear in ESS[BUGS] mode unless
97
you modify the auto-mode-alist variable. If you have done so, then you
98
may find F2 useful to refresh the .log if the batch process over-writes or