In a bayes net context consider the following covariance matrix where G is the child node and D and E are continuous parents

           G         D         E
G 11.4038771 0.8944238 9.3671434
D  0.8944238 0.2937604 0.2322106
E  9.3671434 0.2322106 8.8262010


36.6174413683 #mean of G
[7.35806706, 15.06258672] #mean of D and E respectively

I know that the equation used is

μa|b = μa +Σab Σbb−1(xb −μb)

But I am just having some trouble to compute the conditional linear gaussian mean with more than one continuous parent, so please someone show how to compute it with some clear steps.

Notice: this is the clgaussian.test dataset from bnlearn R library.

  • $\begingroup$ You can still use this equation μa|b = μa +Σaa Σab−1(xb −μb) even when you have more than one parent... $\endgroup$
    – user30490
    Commented Sep 11, 2015 at 15:40
  • $\begingroup$ @ZERO clear steps please $\endgroup$
    – m.awad
    Commented Sep 11, 2015 at 15:44
  • $\begingroup$ Actually, that formula is incorrect. The correct one should read: µa|b = µa + ∑ab ∑bb-1 (xb - µb). $\endgroup$
    – Vimal
    Commented Sep 11, 2015 at 15:48
  • $\begingroup$ @Vimal I have edited my question with the correct formula..it was an honest typo I swear $\endgroup$
    – m.awad
    Commented Sep 11, 2015 at 15:56

1 Answer 1


Wiki has a clear description of how to compute the conditional mean and conditional variance: https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Conditional_distributions

If your covariance matrix is:

$\Sigma = \begin{bmatrix} \sigma_{dd} & \sigma_{de} & \sigma_{dg} \\ \sigma_{ed} & \ldots & \\ \sigma_{gd} & \ldots \end{bmatrix}$

You can compute (there's a mistake in your conditional mean formula):

$\mu_{G|D,E=(d,e)} = \mu_G + \begin{bmatrix} \sigma_{gd} & \sigma_{ge}\end{bmatrix} \begin{bmatrix} \sigma_{dd} & \sigma_{de} \\ \sigma_{ed} & \sigma_{ee}\end{bmatrix}^{-1} \begin{bmatrix} d - \mu_d \\ e - \mu_e\end{bmatrix} $


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.