Learn R Programming

BCDAG (version 1.1.2)

confint.bcdagCE: Credible Intervals for bcdagCE Object

Description

Computes credible (not confidence!) intervals for one or more target variables from objects of class bcdagCE.

Usage

# S3 method for bcdagCE
confint(object, parm = "all", level = 0.95, ...)

Value

A matrix with columns giving lower and upper credible limits for each variable.

Arguments

object

a bcdagCE object from which credible intervals are computed.

parm

an integer vector indexing the target variables for which credible intervals are computed. If missing, all variables are considered.

level

the credible level required.

...

additional arguments.

Examples

Run this code
q = 8
w = 0.2
set.seed(123)
DAG = rDAG(q = q, w = w)
outDL = rDAGWishart(n = 1, DAG = DAG, a = q, U = diag(1, q))
L = outDL$L; D = outDL$D
Sigma = solve(t(L))%*%D%*%solve(L)
n = 200
# Generate observations from a Gaussian DAG-model
X = mvtnorm::rmvnorm(n = n, sigma = Sigma)
# Run the MCMC (set S = 5000 and burn = 1000 for better results)
out_mcmc = learn_DAG(S = 500, burn = 100, a = q, U = diag(1,q)/n, data = X, w = w,
                     fast = TRUE, save.memory = FALSE, verbose = FALSE)
out_ce <- get_causaleffect(out_mcmc, targets = c(4,6), response = 1)
confint(out_ce, c(4,6), 0.95)

Run the code above in your browser using DataLab