Skip to contents

This makes the assumption that the proposal has saved a variable "proposal_used" and mcmc has saved a variable 'accept'.

Usage

CalculateAcceptanceRates(chains, group_by = NULL)

Arguments

chains

MCMC chains.

group_by

Vector of strings that are in c("chain", "proposal_used"). Default is NULL which will return the acceptance rates marginalised over chains and the proposal used.

Value

Summary of acceptance rates per grouping.

Examples

data <- bnlearn::learning.test

dag <- UniformlySampleDAG(colnames(data))
#> Loading required namespace: igraph
partitioned_nodes <- DAGtoPartition(dag)

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

results <- SampleChains(10, partitioned_nodes, PartitionMCMC(), scorer)
CalculateAcceptanceRates(results)
#> # A tibble: 1 × 5
#>   mean_accept mean_black_obeyed mean_white_obeyed n_accept n_total
#>         <dbl>             <dbl>             <dbl>    <int>   <int>
#> 1         0.2                 1                 1        4      20