Conditional Normal Random Distribution

6 ビュー (過去 30 日間)
Vinit Nagda
Vinit Nagda 2021 年 8 月 19 日
コメント済み: Paul 2021 年 8 月 23 日
I want to generate a random vector (a) from a normal distribution N(mu,sigma) (mu,sigma:known) with a condition that the first n values of vector 'a' are known and fixed (basically its fulfilling boundary conditions).
Is there any way I can use Multivariate normal random numbers function: R = mvnrnd(mu,Sigma) or any other method?

採用された回答

Paul
Paul 2021 年 8 月 19 日
Yes. If you know mu and Sigma of the vector x and the first n values of x are given, then the density of x(n+1:end) is also normal and can be derived from mu, Sigma, and x(1:n). See this link for the math to get the mean and covariance of x(n+1:end) condtioned on x(1:n), then you can use mvnrnd to generate random numbers of x(n+1:end)
  10 件のコメント
Vinit Nagda
Vinit Nagda 2021 年 8 月 23 日
@Paul Thank you very much for your response.
Actually, I didn't know what result to expect and I just compared your example with my code and thought something was wrong. But, I now understand the joint independence concept and thanks a lot for sharing that.
Also, thanks for your suggestions, I will try to make my code look more code-like with simplifications and clarity.
Just, one last final thing (I will then close this thread and not disturb you more). As in the link you shared, lower part of x(x2) is known and in my case x_1 is known so I have to do reindexing.
The order of elements in random normal vector and mu vector can be easily reversed, I just want to confirm the reindexing of Sigma matrix. Flipping the elements of matrix across diagonal and reversing the diagonal elements should work right?
Thank you. I very much appreciate your time and help.
Paul
Paul 2021 年 8 月 23 日
I didn't provide an example, so I'm still not sure what you've compared to your code.
Instead of reindexing your problem to fit the formula, it's probably easier to modfiy the formula to fit your problem. Just reverse the 1's and 2's.
mubar = mu2 + Sigma21/Sigma11*(a - mu1);
Sigmabar = Sigma22 - Sigma21/Sigma11*Sigma12;
Feel free to come back if you have any more questions, particularly if you want to post your code with an example. However, if you do, don't use a 10-element vector in the example. Maybe use a 3-element vector X and show the mubar and Sigmabar of X(3) given known values of X(1) and X(2).

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by