| Index | Topics |
| cpquery {bnlearn} | R Documentation |
Perform conditional probability queries
Description
Perform conditional probability queries (CPQs).
Usage
cpquery(fitted, event, evidence, method = "ls", ..., debug = FALSE)
Arguments
fitted |
an object of class bn.fit. |
event, evidence |
see below. |
method |
a character string, the method used to perform the conditional probability query. Currently only Logic Sampling is implemented. |
... |
additional tuning parameters. |
debug |
a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is
completely silent. |
Value
A numeric value, the conditional probability of event conditional on evidence.
Logic Sampling
The event and evidence arguments must be two expressions describing the event of
interest and the conditioning evidence in a format such that, if we denote with data the data set
the network was learned from, data[evidence, ] and data[event, ] return the correct
observations. If either parameter is equal to TRUE an unconditional probability query is
performed.
Two tuning parameters are available:
n: a positive integer number, the number of random observations to generate fromfitted. Defaults to5000 * nparams(fitted).batch: a positive integer number, the size of each batch of random observations. Defaults to10^4.
Author(s)
Marco Scutari
References
Korb K, Nicholson AE (2003). Bayesian Artificial Intelligence. Chapman & Hall/CRC.
Examples
fitted = bn.fit(hc(learning.test), learning.test) cpquery(fitted, (B == "b"), (A == "a")) # the result should be around 0.025.
| Index | Topics |
