I was reading the following blog post: https://fabiandablander.com/statistics/Two-Properties.html
Suppose you have a 2 Dimensional (Bivariate) Joint Normal Distribution :
Where:
According to the theory (for multivariate gaussian distribution only), the conditional distribution of X1 given X2 is:
Question: Is it possible to obtain the conditional distribution of the joint distribution using R?
If I have a bivariate normal distribution (e.g. assume no covariances) :
library(bivariate)
f = bmbvpdf (
mean.X1=10, mean.X2=5,
sd.X1=3 , sd.X2=4,
)
plot(f)
Is is possible to use R (or some statistical software) to find out the conditional distribution of X1, i.e. the probability distribution of "X1 given X2"? Is it possible to output the parameters of this distribution (i.e. the mean and the variance) in a matrix or data frame?
I understand that for a simple bivariate normal distribution, this can be done by hand – but for high dimensional multivariate distributions, if you know the exact joint probability distribution : Using R, can you easily determine the conditional distribution from a joint distribution. For example, if you have a multivariate guassian mixture distribution that looks something like this:
If you have the joint probability distribution as a function F(X1,X2,X3, X4, X5) : Can you determine F(X1 | X2,X3, X4, X5) using R?
Thanks!
Best Answer
R is not a symbolic computing language like Mathematica, so it won't output functional forms or expected values etc. If all you want is numerical values, though, just
Other values, e.g., the mean, can be calculated in the obvious way by replacing the calculation in step 2 with the appropriate function times $f(x_1, \dots, x_5)$.
For example:
... and, as we hope, the numerical integration calculation gives us essentially the same value for the conditional mean that the (more) exact calculation does.