plot.dynamiteformula function

Plot the Model Structure as a Directed Acyclic Graph (DAG)

Plot the Model Structure as a Directed Acyclic Graph (DAG)

Plot a snapshot of the model structure at a specific time point with a window of the highest-order lag dependency both into the past and the future as a directed acyclic graph (DAG). Only response variables are shown in the plot. This function can also produce a TikZ code of the DAG to be used in reports and publications.

## S3 method for class 'dynamiteformula' plot( x, show_auxiliary = TRUE, show_covariates = FALSE, tikz = FALSE, vertex_size = 0.25, label_size = 18, ... )

Arguments

  • x: [dynamiteformula]

    The model formula.

  • show_auxiliary: [logical(1)]

    Should deterministic auxiliary responses be shown in the plot? If FALSE, the vertices corresponding to such responses will be projected out. The default is TRUE.

  • show_covariates: [logical(1)]

    Should unmodeled covariates be shown in the plot? The defaults is FALSE.

  • tikz: [logical(1)]

    Should the DAG be returned in TikZ format? The default is FALSE returning a ggplot object instead.

  • vertex_size: [double(1)]

    The size (radius) of the vertex circles used in the ggplot DAG. (The vertical and horizontal distances between vertices in the grid are 1, for reference.)

  • label_size: [double(1)]

    Font size (in points) to use for the vertex labels in the ggplot DAG.

  • ...: Not used..

Returns

A ggplot object, or a character string if tikz = TRUE.

Examples

data.table::setDTthreads(1) # For CRAN multichannel_formula <- obs(g ~ lag(g) + lag(logp), family = "gaussian") + obs(p ~ lag(g) + lag(logp) + lag(b), family = "poisson") + obs(b ~ lag(b) * lag(logp) + lag(b) * lag(g), family = "bernoulli") + aux(numeric(logp) ~ log(p + 1)) # A ggplot plot(multichannel_formula) # TikZ format plot(multichannel_formula, tikz = TRUE)

See Also

Drawing plots plot.dynamitefit()