Learn R Programming

BiDAG (version 2.0.0)

edgep: Estimating posterior probabilities of single edges

Description

This function estimates the posterior probabilities of edges by averaging over a sample of DAGs obtained via an MCMC scheme.

Usage

edgep(MCMCchain, pdag = FALSE, burnin = 0.2, endstep = 1)

Arguments

MCMCchain

list of square matrices with elements in {0,1} and representing adjacency matrices of a sample of DAGs obtained via an MCMC scheme (object of class MCMCres with non-null element addtrace is also a valid data type, see MCMCmult)

pdag

logical, if TRUE (FALSE by default) all DAGs in the MCMCchain are first converted to equivalence class (CPDAG) before the averaging

burnin

(optional) number between 0 and 1, indicates the percentage of the samples which will be discarded as `burn-in' of the MCMC chain; the rest of the samples will be used to calculate the posterior probabilities; 0.2 by default

endstep

(optional) number between 0 and 1; 1 by default

Value

a square matrix with dimensions equal to the number of variables; each entry [i,j] is an estimate of the posterior probability of the edge from node i to node j

Examples

Run this code
# NOT RUN {
Bostonscore<-scoreparameters("bge", Boston)
# }
# NOT RUN {
samplefit<-orderMCMC(Bostonscore, iterations=25000,chainout=TRUE)
edgesposterior<-edgep(samplefit, pdag=TRUE, burnin=0.2)
# }

Run the code above in your browser using DataLab