Skip to contents

Computation of an updated GBN object after a variation of the covariance matrix.

Usage

covariance_var(gbn, entry, delta)

Arguments

gbn

object of class GBN.

entry

a vector of length 2 specifying the entry of the covariance matrix to vary.

delta

additive variation coefficient for the entry of the co-variation matrix given in entry.

Value

If the resulting covariance is positive semi-definite, covariance_var returns an object of class GBN with an updated covariance matrix. Otherwise it returns an object of class npsd.gbn, which has the same components of GBN but also has a warning entry specifying that the covariance matrix is not positive semi-definite.

Details

Let the original Bayesian network have a Normal distribution \(\mathcal{N}(\mu,\Sigma)\) and let entry be equal to \((i,j)\). For a variation of the covariance matrix by an amount \(\delta\), a variation matrix \(D\) is constructed as $$D_{k,l}=\left\{ \begin{array}{ll} \delta & \mbox{if } k=i, l=j\\ \delta & \mbox{if } l=i, k=j \\ 0 & \mbox{otherwise} \end{array} \right.$$ Then the resulting distribution after the variation is \(\mathcal{N}(\mu,\Sigma +D)\), assuming \(\Sigma+ D\) is positive semi-definite.

References

Gómez-Villegas, M. A., Maín, P., & Susi, R. (2007). Sensitivity analysis in Gaussian Bayesian networks using a divergence measure. Communications in Statistics—Theory and Methods, 36(3), 523-539.

Gómez-Villegas, M. A., Main, P., & Susi, R. (2013). The effect of block parameter perturbations in Gaussian Bayesian networks: Sensitivity and robustness. Information Sciences, 222, 439-458.

Examples

covariance_var(synthetic_gbn,c(1,1),3)
#> $order
#> [1] "y1" "y2" "y3" "y4"
#> 
#> $mean
#>      [,1]
#> [1,]    0
#> [2,]    0
#> [3,]    0
#> [4,]    0
#> 
#> $covariance
#>      [,1] [,2] [,3] [,4]
#> [1,]    4    2    2    7
#> [2,]    2    5    5   17
#> [3,]    2    5    6   19
#> [4,]    7   17   19   63
#> 
#> attr(,"class")
#> [1] "GBN"
covariance_var(synthetic_gbn,c(1,2),-0.4)
#> $order
#> [1] "y1" "y2" "y3" "y4"
#> 
#> $mean
#>      [,1]
#> [1,]    0
#> [2,]    0
#> [3,]    0
#> [4,]    0
#> 
#> $covariance
#>      [,1] [,2] [,3] [,4]
#> [1,]  1.0  1.6    2    7
#> [2,]  1.6  5.0    5   17
#> [3,]  2.0  5.0    6   19
#> [4,]  7.0 17.0   19   63
#> 
#> $warning
#> [1] "The covariance is not positive semidefinite"
#> 
#> attr(,"class")
#> [1] "npsd.gbn"