Skip to contents

Plot cumulative mean trace plot.

Usage

PlotCumulativeMeanTrace(
  x,
  ncol = NULL,
  nrow = NULL,
  scales = "fixed",
  dir = "v"
)

Arguments

x

A posterior predictive sample object.

ncol

Number of columns.

nrow

Number of rows.

scales

Whether the scales should the fixed ('fixed', the default), free ('free') or free in one dimension ('free_x', 'free_y')?

dir

Direction to fill facets. Either 'h' for horizontal or 'v' for vertical.

Value

A ggplot object.

Examples

data <- bnlearn::learning.test

dag <- UniformlySampleDAG(colnames(data))
partitioned_nodes <- DAGtoPartition(dag)

scorer <- CreateScorer(
  scorer = BNLearnScorer, 
  data = data
  )

results <- SampleChains(10, partitioned_nodes, PartitionMCMC(), scorer)
dag_chains <- PartitiontoDAG(results, scorer)

# Sample the edge probability.
p_edge <- function(dag) { return(as.vector(dag)) }
pedge_sample <- SamplePosteriorPredictiveChains(dag_chains, p_edge)

PlotCumulativeMeanTrace(pedge_sample,
                        nrow = length(data), 
                        ncol = length(data))