KL.bn.fit {bnmonitor} | R Documentation |

## KL Divergence for `bn.fit`

### Description

`KL.bn.fit`

returns the Kullback-Leibler (KL) divergence between a Bayesian network and its update after parameter variation.

### Usage

```
## S3 method for class 'bn.fit'
KL(
x,
node,
value_node,
value_parents,
new_value,
covariation = "proportional",
...
)
```

### Arguments

`x` |
object of class |

`node` |
character string. Node of which the conditional probability distribution is being changed. |

`value_node` |
character string. Level of |

`value_parents` |
character string. Levels of |

`new_value` |
numeric vector with elements between 0 and 1. Values to which the parameter should be updated. It can take a specific value or more than one. In the case of more than one value, these should be defined through a vector with an increasing order of the elements. |

`covariation` |
character string. Co-variation scheme to be used for the updated Bayesian network. Can take values |

`...` |
additional parameters to be added to the plot. |

### Details

The Bayesian network on which parameter variation is being conducted should be expressed as a `bn.fit`

object.
The name of the node to be varied, its level and its parent's levels should be specified.
The parameter variation specified by the function is:

P ( `node`

= `value_node`

| parents = `value_parents`

) = `new_value`

### Value

A dataframe with the varied parameter and the KL divergence for different co-variation schemes. If `plot = TRUE`

the function returns a plot of the KL divergences.

### References

Kullback, S., & Leibler, R. A. (1951). On information and sufficiency. The annals of mathematical statistics, 22(1), 79-86.

Leonelli, M., Goergen, C., & Smith, J. Q. (2017). Sensitivity analysis in multilinear probabilistic models. Information Sciences, 411, 84-97.

### See Also

### Examples

```
KL(synthetic_bn, "y2", "1", "2", "all", "all")
KL(synthetic_bn, "y1", "2", NULL, 0.3, "all")
```

*bnmonitor*version 0.1.4 Index]