API
JuliaBUGS.Parser.@bugs
— Macro@bugs(program::Expr)
@bugs(program::String; replace_period::Bool=true, no_enclosure::Bool=false)
Constructs a Julia Abstract Syntax Tree (AST) representation of a BUGS program. This macro supports two forms of input: a Julia expression or a string containing the BUGS program code.
- When provided with a string, the macro parses it as a BUGS program, with optional arguments to control parsing behavior.
- When given an expression, it performs syntactic checks to ensure compatibility with BUGS syntax.
Arguments for String Input
For the string input variant, the following optional arguments are available:
replace_period::Bool
: When set totrue
, all periods (.
) in the BUGS code are replaced. This is enabled by default.no_enclosure::Bool
: Whentrue
, the parser does not require the BUGS program to be enclosed withinmodel{ ... }
brackets. By default, this is set tofalse
.
JuliaBUGS.compile
— Functioncompile(model_def, data[, initial_params])
Compile the model with model definition and data. Optionally, initializations can be provided. If initializations are not provided, values will be sampled from the prior distributions.
JuliaBUGS.initialize!
— Functioninitialize!(model::BUGSModel, initial_params::NamedTuple)
Initialize the model with a NamedTuple of initial values, the values are expected to be in the original space.
initialize!(model::BUGSModel, initial_params::AbstractVector)
Initialize the model with a vector of initial values, the values can be in transformed space if model.transformed
is set to true.