Sample from multivariate exponential distribution

4 ビュー (過去 30 日間)
LM72
LM72 2017 年 2 月 3 日
コメント済み: the cyclist 2021 年 4 月 23 日
I'd like to generate random vectors according to a multivariate exponential distribution, that is with a pdf f: R^n->R given by
for appropriate normalisation constant c_e. I wondered if there was built in functionality to do this, if not how would I go about doing this manually?
  1 件のコメント
the cyclist
the cyclist 2017 年 2 月 3 日
Are the x variables independent, or correlated?

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

回答 (1 件)

Roger Stafford
Roger Stafford 2017 年 2 月 4 日
You can make use of the ‘gammaincinv’ function for this problem:
X = randn(m,n);
X = X.*repmat(gammaincinv(rand(m,1),n)./sqrt(sum(X.^2,2)),1,n);
The resulting array X has m rows, each consisting of n coordinates in R^n space with the requested distribution.
(I’m assuming here that ‘gammaincinv’ will accept the scalar n for its second argument. If not, the n will have to be repeated m times using ‘repmat’. I have also assumed that the n coordinate variables are to be statistically independent.)
  3 件のコメント
ayoub bouayaben
ayoub bouayaben 2021 年 4 月 22 日
@Roger Stafford hello, can you explain me please how can i modify the code that you mentioned before if i want to sample a vector of N elements from a gaussian distribution which is given by :
p(y) = exp(-1/2 *(y - a).' * C* ( y - a) ) with C is the cov matrix with y in R^n
Thank you for your help !
the cyclist
the cyclist 2021 年 4 月 23 日
Can you use just use the mvnrnd function for that?

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

Community Treasure Hunt

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

Start Hunting!

Translated by