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
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
5
for proper fontification of statements, distributions, functions, commands and
6
6
comments in BUGS model files, command files and log files. Second,
7
7
ESS creates templates for the command file from the model file so that
15
15
@node ESS(BUGS)--Model files, ESS(BUGS)--Command files, ESS for BUGS, ESS for BUGS
16
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}.
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
21
F12 performs the function
22
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.
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.
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
28
all capitals and start with '%': %N, %DATA, %INIT, %MONITOR and %STATS.
29
29
When you are finished editing your model file, pressing F12 will perform the
30
necessary replacements and build your command file for you.
30
necessary replacements and build your command file for you.
32
32
The %DATA variable appears in
33
the line 'data in "%DATA";'. On the second press of F12, %DATA will be
33
the line 'data in "%DATA";'. On the second press of F12, %DATA will be
34
34
replaced by the model file name except it will have the .dat extension. If
35
35
your data file is named something else, then change %DATA in the template to
36
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
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
42
character, #, at the beginning of the line. Or, if your
43
43
init file is named something else, then change %INIT in the template to the
44
appropriate file name.
44
appropriate file name.
46
46
The %N variable appears in the line 'const N = 0;#%N'. Although it is commented,
47
47
it is still active. Notice that later on in the template you have the line
48
48
'for (i in 1:N)'. The BUGS constant N is the number of rows in
49
49
your data file. When you press F12, the data file is read and the number of
50
50
lines are counted (after %DATA is resolved, if necessary). The number of
51
lines replace the zero in the 'const N = 0' statement.
51
lines replace the zero in the 'const N = 0' statement.
53
53
The %MONITOR variable appears on a line by itself. Although it is commented,
54
54
it is still active. This line is a list of variables that you want monitored.
69
69
@section ESS[BUGS]--Command files
71
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
72
you have finished editing your model file and press F12, a command file is
73
73
created if one does not already exist. However, the command file was
74
created, it recognizes two "replacement" variables: %MONITOR and %STATS.
74
created, it recognizes two "replacement" variables: %MONITOR and %STATS.
76
76
Two %MONITOR variables appears on lines by themselves. Although they are
77
commented, they are still active. Between them appears the necessary
77
commented, they are still active. Between them appears the necessary
78
78
statements to monitor the list of variables specified in the model file. The
79
79
behavior of the %STATS variable is similar.
81
81
When you are finished editing your command file, pressing F12 again will submit
82
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
83
Unix in the etc sub-directory of the ESS distribution. The DOS script is
84
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
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
87
87
which defaults to 32.
89
89
@comment node-name, next, previous, up
93
93
To avoid extension name collision, .bog is used for BUGS log files. The BUGS
94
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
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
97
you modify the auto-mode-alist variable. If you have done so, then you
98
98
may find F2 useful to refresh the .log if the batch process over-writes or