KL.CI
returns the Kullback-Leibler (KL) divergence between an object of class CI
and its update after a model-preserving parameter variation.
Usage
# S3 method for CI
KL(x, type, entry, delta, ...)
Arguments
- x
object of class
CI
.- type
character string. Type of model-preserving co-variation: either
"total"
,"partial"
,row
,column
orall
. Ifall
the KL divergence is computed for every type of co-variation matrix.- entry
a vector of length 2 indicating the entry of the covariance matrix to vary.
- delta
numeric vector with positive elements, including the variation parameters that act multiplicatively.
- ...
additional arguments for compatibility.
Value
A dataframe including in the first column the variations performed, and in the following columns the corresponding KL divergences for the chosen model-preserving co-variations.
Details
Computation of the KL divergence between a Bayesian network and its updated version after a model-preserving variation.
References
C. Görgen & M. Leonelli (2020), Model-preserving sensitivity analysis for families of Gaussian distributions. Journal of Machine Learning Research, 21: 1-32.
Examples
KL(synthetic_ci, "total", c(1,1), seq(0.9,1.1,0.01))
#> Variation KL
#> 1 0.90 1.581454e-01
#> 2 0.91 1.182644e-01
#> 3 0.92 8.696323e-02
#> 4 0.93 6.236359e-02
#> 5 0.94 4.314355e-02
#> 6 0.95 2.833747e-02
#> 7 0.96 1.721842e-02
#> 8 0.97 9.225469e-03
#> 9 0.98 3.916686e-03
#> 10 0.99 9.377019e-04
#> 11 1.00 -5.773160e-15
#> 12 1.01 8.655459e-04
#> 13 1.02 3.335657e-03
#> 14 1.03 7.242781e-03
#> 15 1.04 1.244431e-02
#> 16 1.05 1.881787e-02
#> 17 1.06 2.625765e-02
#> 18 1.07 3.467156e-02
#> 19 1.08 4.397896e-02
#> 20 1.09 5.410879e-02
#> 21 1.10 6.499819e-02
KL(synthetic_ci, "partial", c(1,4), seq(0.9,1.1,0.01))
#> Variation KL
#> 1 0.90 NA
#> 2 0.91 1.274584e+00
#> 3 0.92 8.571036e-01
#> 4 0.93 6.145513e-01
#> 5 0.94 4.414538e-01
#> 6 0.95 3.080593e-01
#> 7 0.96 2.023536e-01
#> 8 0.97 1.190476e-01
#> 9 0.98 5.639604e-02
#> 10 0.99 1.534863e-02
#> 11 1.00 -5.773160e-15
#> 12 1.01 1.986247e-02
#> 13 1.02 9.740759e-02
#> 14 1.03 3.015206e-01
#> 15 1.04 1.238277e+00
#> 16 1.05 NA
#> 17 1.06 NA
#> 18 1.07 NA
#> 19 1.08 NA
#> 20 1.09 NA
#> 21 1.10 NA
KL(synthetic_ci, "column", c(1,2), seq(0.9,1.1,0.01))
#> Variation KL
#> 1 0.90 NA
#> 2 0.91 NA
#> 3 0.92 NA
#> 4 0.93 NA
#> 5 0.94 NA
#> 6 0.95 6.803239e-01
#> 7 0.96 3.056625e-01
#> 8 0.97 1.420330e-01
#> 9 0.98 5.582244e-02
#> 10 0.99 1.285627e-02
#> 11 1.00 -5.773160e-15
#> 12 1.01 1.186651e-02
#> 13 1.02 4.725234e-02
#> 14 1.03 1.084758e-01
#> 15 1.04 2.026946e-01
#> 16 1.05 3.471482e-01
#> 17 1.06 5.902917e-01
#> 18 1.07 1.185352e+00
#> 19 1.08 NA
#> 20 1.09 NA
#> 21 1.10 NA
KL(synthetic_ci, "row", c(3,2), seq(0.9,1.1,0.01))
#> Variation KL
#> 1 0.90 NA
#> 2 0.91 NA
#> 3 0.92 NA
#> 4 0.93 NA
#> 5 0.94 NA
#> 6 0.95 NA
#> 7 0.96 NA
#> 8 0.97 5.946741e-01
#> 9 0.98 1.523771e-01
#> 10 0.99 2.874803e-02
#> 11 1.00 -5.773160e-15
#> 12 1.01 2.072810e-02
#> 13 1.02 7.470749e-02
#> 14 1.03 1.554770e-01
#> 15 1.04 2.615591e-01
#> 16 1.05 3.955728e-01
#> 17 1.06 5.658572e-01
#> 18 1.07 7.932808e-01
#> 19 1.08 1.141520e+00
#> 20 1.09 2.094579e+00
#> 21 1.10 NA
KL(synthetic_ci, "all", c(3,2), seq(0.9,1.1,0.01))
#> Variation Total Partial Row_based Column_based
#> 1 0.90 1.072103e-02 NA NA NA
#> 2 0.91 8.621359e-03 NA NA NA
#> 3 0.92 6.763218e-03 NA NA NA
#> 4 0.93 5.141386e-03 NA NA NA
#> 5 0.94 3.750807e-03 NA NA NA
#> 6 0.95 2.586589e-03 NA NA NA
#> 7 0.96 1.643989e-03 NA NA NA
#> 8 0.97 9.184150e-04 NA 5.946741e-01 NA
#> 9 0.98 4.054146e-04 4.415445e-01 1.523771e-01 2.608256e-01
#> 10 0.99 1.006717e-04 5.963115e-02 2.874803e-02 4.273637e-02
#> 11 1.00 -5.773160e-15 -5.773160e-15 -5.773160e-15 -5.773160e-15
#> 12 1.01 9.933829e-05 3.476601e-02 2.072810e-02 2.762796e-02
#> 13 1.02 3.947454e-04 1.176098e-01 7.470749e-02 9.625765e-02
#> 14 1.03 8.823955e-04 2.313949e-01 1.554770e-01 1.944176e-01
#> 15 1.04 1.558574e-03 3.683344e-01 2.615591e-01 3.176784e-01
#> 16 1.05 2.419672e-03 5.247737e-01 3.955728e-01 4.657731e-01
#> 17 1.06 3.462184e-03 6.994265e-01 5.658572e-01 6.424443e-01
#> 18 1.07 4.682703e-03 8.928294e-01 7.932808e-01 8.577993e-01
#> 19 1.08 6.077918e-03 1.107496e+00 1.141520e+00 1.137218e+00
#> 20 1.09 7.644608e-03 1.348902e+00 2.094579e+00 1.564738e+00
#> 21 1.10 9.379640e-03 1.628337e+00 NA NA