query.cibn: Inference in a causal independence Bayesian network

Description Usage Arguments Details Value References See Also Examples

View source: R/cibn.r

Description

Perform exact inference in a causal independence Bayesian network through the joint tree algorithm (interface to the gRain package)

Usage

1
query.cibn(x, target=NULL, evidence=NULL, type="marginal")

Arguments

x

An object of class cibn.

target

The name of the target variable. If NULL (the default), all the variables in the Bayesian network will be set as targets.

evidence

A named list with each component indicating the evidence on a specific variable in the form of a vector of state names. See the examples below.

type

A character string indicating the type of inference: "marginal", "joint" or "conditional". Default is "marginal".

Details

This function is an interface to function querygrain in the gRain package.

Value

A list with one component for each variable in the Bayesian network, indicating its probability distribution given the evidence.

References

S. L. Lauritzen and D. J. Spiegelhalter (1988). Local computations with probabilities on graphical structures and their application to expert systems. Journal of the Royal Statistical Society, Series B (Methodological), 50(2): 157-224. DOI: 10.1023/A:1008935617754.

See Also

new.cibn; sample.cibn.

Examples

1
2
3
4
5
6
7
8
data(bankrisk_code)
bankrisk_bn <- new.cibn(bankrisk_code)
#
getStates(bankrisk_bn)  ## see the sample spaces
#
query.cibn(bankrisk_bn, target="Risk", evidence=list(Age="31_50",Portf="mixed"))
query.cibn(bankrisk_bn, target="Risk", evidence=list(Age="31_50",Portf="money_market"))
query.cibn(bankrisk_bn, target="Risk", evidence=list(Age="31_50",Portf="stock_market"))

alessandromagrini/cibn documentation built on Feb. 7, 2022, 10:55 p.m.