I want to be able to generate values from an $n$-dimensional multivariate Gaussian distribution truncated to $[0, 1]$ range with given means and a covariance matrix, such that they sum to one.

I think this is the same as sampling from the standard $n$-simplex according to the Gaussian distribution, but how would I go about doing this?

  • $\begingroup$ Thanks for your quick response, I was trying to use this to randomly generate weightings according to a normal. So another constraint would be all values between 0 and 1, so this would make it a truncated distribuion. I was also hoping to be able to further refine these later eg. X1 between .2 and .3 but I was trying to get the main idea down first. $\endgroup$ – sam10269 Aug 15 '17 at 7:55
  • $\begingroup$ I'm trying to simulate different assets of an investment portfolio. I'm assuming normality for each asset, so I want the whole multivariate distribution to be normal and the weighting to each asset to sum up to 1. Stats was never my strong point so apologies if this is the wrong way to go about it. $\endgroup$ – sam10269 Aug 15 '17 at 8:43
  • 5
    $\begingroup$ I edited your question to add the information that you are talking about truncated normal distribution. PS check here to learn more about Dirichlet distribution as it is usually a "distribution of choice" for such problems. $\endgroup$ – Tim Aug 15 '17 at 11:34
  • $\begingroup$ sampling from the standard n-simplex according to the Gaussian distribution is a contradiction of terms since the Gaussian distribution is defined on the whole $\mathbb{R}^p$ space. $\endgroup$ – Xi'an Aug 25 '17 at 5:09
  • $\begingroup$ To make the question precise, can you please write down the density you want to simulate on the standard $n$-simplex? $\endgroup$ – Xi'an Aug 28 '17 at 7:39

These papers describe how to sample from a multivariate normal truncated on a (p - 1) simplex ([http://ieeexplore.ieee.org/abstract/document/6884588/], [dobigeon.perso.enseeiht.fr/papers/Dobigeon_TechReport_2007b.pdf]). Sampling is done via Gibbs sampling or HMC. In short, it uses ideas from the (conditional) multivariate Normal distribution. Assume that you want to sample a vector $\alpha_{(p\times 1)}$ which is contrained to a Multivariate Normal truncated on a $p-1$ simplex, i.e., $\alpha\sim N(\mu,\Sigma)I(\alpha\in\mathbb{S}^{p-1})$. You can sample the $j^{th}$ component ($\alpha_j$) conditional on $\alpha_{-j}$ (i.e., the remaining components of $\alpha$), and set the last component ($p^{th}$) to $1 - \sum_{j=1}^{p-1}\alpha_j$ with conditional mean $\mu_{j|-j}$ and conditional variance $\Sigma_{j|-j}$. The papers I mentioned describe how to calculate these. Note that there's only $p - 1$ pieces of information.


It sounds like you want the logit-normal distribution. This distribution shows up a lot in Compositional Data Analysis (CDA). CDA is often used in geology to measure the composition of minerals within soil or rock samples. The logit-normal takes a logit tranform of your random variable and this logit-transformed random variable is a normally distributed random variable. Formally,


where $X$ is logit-normal and $Y$ is normal. Multivariate extensions exist and are the more commonly used forms of the density.

If this is not what you want and you truly want a normal random variable that is restricted by a collection of constraints to always sum to 1 and have all entries be non-negative, you'll need to resort to other simulation techniques to get draws from the distribution. It is fairly complicated to perform these draws. John Geweke wrote a paper about doing this and Christian Robert also wrote a paper on sampling from this type of distribution.

  • $\begingroup$ Thank you for the references. Our parallel papers dealt with restrictions to open sets. Handling the zero measure set that the sum of the components add up to one is not covered by our approach, I believe. $\endgroup$ – Xi'an Aug 24 '17 at 18:54
  • $\begingroup$ @Xi'an, When I wrote this answer the question wasn't clarified whether they OP was trying to sample from a distribution w/truncations which I believe your paper on John Geweke's both address-or-on a probability simplex like the logit-normal or neither and in fact a Gaussian with simplex constraints. It now seems the OP wants to sample from the latter; multivariate Gaussian with simplex constraints on top of the Gaussian (non-negativity, and sum to 1 constraints need to be satisfied). Unfortunately neither of the approaches I've outlined here address the OP's question. $\endgroup$ – Lucas Roberts Aug 25 '17 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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