model.Rd
Create a greta_model
object representing a statistical
model (using model
), and plot a graphical representation of the
model. Statistical inference can be performed on greta_model
objects
with mcmc()
model(..., precision = c("double", "single"), compile = TRUE) # S3 method for greta_model print(x, ...) # S3 method for greta_model plot(x, y, colour = "#996bc7", ...)
… | for |
---|---|
precision | the floating point precision to use when evaluating this
model. Switching from |
compile | whether to apply XLA JIT compilation to the TensorFlow graph representing the model. This may slow down model definition, and speed up model evaluation. |
x | a |
y | unused default argument |
colour | base colour used for plotting. Defaults to |
model
- a greta_model
object.
plot
- a DiagrammeR::grViz()
object, with the
DiagrammeR::dgr_graph()
object used to
create it as an attribute "dgr_graph"
.
model()
takes greta arrays as arguments, and defines a
statistical model by finding all of the other greta arrays on which they
depend, or which depend on them. Further arguments to model
can be
used to configure the TensorFlow graph representing the model, to tweak
performance.
The plot method produces a visual representation of the defined
model. It uses the DiagrammeR
package, which must be installed
first. Here's a key to the plots:
# NOT RUN { # define a simple model mu <- variable() sigma <- normal(0, 3, truncation = c(0, Inf)) x <- rnorm(10) distribution(x) <- normal(mu, sigma) m <- model(mu, sigma) plot(m) # }