SamplePosteriorPredictiveChains: Draw from a posterior predictive distribution

View source: R/post_predict.R

SamplePosteriorPredictiveChainsR Documentation

Draw from a posterior predictive distribution

Description

Simulate samples from a posterior predictive distribution for a feature f(g) a graph g.

Usage

SamplePosteriorPredictiveChains(x, p_predict, ...)

Arguments

x

A cia_chain(s) object.

p_predict

A function that draws from the posterior predictive distribution of interest given an adjacency matrix representing a DAG. The function must be of the form p_predict(dag, ...) and return either a vector of numeric values.

...

Parameters to be passed to p_predict.

Value

A cia_post_chain(s) 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.
SamplePosteriorPredictiveChains(dag_chains, function(dag) { return(dag) })


cia documentation built on April 4, 2025, 5:23 a.m.