tag:blogger.com,1999:blog-6555947.post112951144577801689..comments2021-11-16T10:00:09.696-07:00Comments on The Geomblog: Sampling from the simplexSuresh Venkatasubramanianhttp://www.blogger.com/profile/15898357513326041822noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-6555947.post-30345557666224503232008-12-12T23:54:00.000-07:002008-12-12T23:54:00.000-07:00I believe this code does it in Mathematica:simplex...I believe this code does it in Mathematica:<BR/><BR/>simplexPoint[k_Integer] := Normalize[-Log@RandomReal[{0, 1}, k], Total]<BR/> <BR/>or, trusting Mathematica to generate Exponentials (why not?):<BR/> <BR/>simplexPoint[k_Integer] :=<BR/> Normalize[RandomReal[ExponentialDistribution[2], k], Total]<BR/> <BR/>Either way, in 10-space, for example:<BR/> <BR/>simplexPoint[10]<BR/> <BR/>{0.0312847, 0.0193921, 0.0125146, 0.071352, 0.00115483, 0.167582, \<BR/>0.0487961, 0.208346, 0.0438064, 0.395771}<BR/> <BR/>BobbyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6555947.post-18294737797088072582008-12-11T15:21:00.000-07:002008-12-11T15:21:00.000-07:00sorry. no clue. I don't know mathematica at allsorry. no clue. I don't know mathematica at allSuresh Venkatasubramanianhttps://www.blogger.com/profile/15898357513326041822noreply@blogger.comtag:blogger.com,1999:blog-6555947.post-41097520949737611862008-12-11T13:31:00.000-07:002008-12-11T13:31:00.000-07:00Suresh -- Any thoughts on how to implement this in...Suresh -- Any thoughts on how to implement this in Mathematica code? I have an almost identical problem to address.<BR/><BR/>Rgds,<BR/>AA^2https://www.blogger.com/profile/02977106948855700431noreply@blogger.comtag:blogger.com,1999:blog-6555947.post-1130093742879668492005-10-23T12:55:00.000-06:002005-10-23T12:55:00.000-06:00I think Jeff Vitter's "Faster Methods for Random S...I think Jeff Vitter's "Faster Methods for Random Sampling" (1984) uses the exponential-RVs method, where the application is jumping through a database to get a random sample.<BR/><BR/>Those must be some high dimensional simplices, to want to avoid sorting.<BR/><BR/>(Sorry, Suresh, I should be reading.)<BR/> <BR/><BR/><A></A><A></A>Posted by<A><B> </B></A><A HREF="http://geomblog.blogspot.com/2005/10/sampling-from-simplex.html" REL="nofollow" TITLE="clarkson at research dot bell-labs dot com">Ken Clarkson</A>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6555947.post-1129742292851680822005-10-19T11:18:00.000-06:002005-10-19T11:18:00.000-06:00I was a tad disenchanted with the boost graph libr...I was a tad disenchanted with the boost graph librarires: their performance seemed a bit slow, especially in comparison to some hacked up stuff I wrote in python. I guess that sampling libraries won't have that much overhead (the graph libraries were highly templated), so might work well. <BR/><BR/>Thanks for the tip ! <BR/><BR/><A></A><A></A>Posted by<A><B> </B></A>SureshSuresh Venkatasubramanianhttps://www.blogger.com/profile/15898357513326041822noreply@blogger.comtag:blogger.com,1999:blog-6555947.post-1129742097959410912005-10-19T11:14:00.000-06:002005-10-19T11:14:00.000-06:00I should also mention that there is a library in C...I should also mention that there is a library in C++, on www.boost.org, which provides various distributions and random generators, including the uniform distribution on sphere, but not the uniform distribution on the standard simplex. That would be a worthwhile addition, I'll see if I can make a suggestion.<BR/>The url is http://boost.org/libs/random/index.html<BR/><BR/>And while you're there, check out the other libraries in Math/Numerics and Algorithms.<BR/><BR/>It's really a great piece of work, and very useful. Many, including the Mersenne Twister is a bit expensive but provides much truer randomness than a linear congruential generator. Much of the knowledge is taken from Knuth TAOCP Vol. 2. <BR/><BR/><A></A><A></A>Posted by<A><B> </B></A><A HREF="http://photon.poly.edu/~hbr/" REL="nofollow" TITLE="hbr at poly dot edu">Herve Bronnimann</A>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6555947.post-1129565141538534582005-10-17T10:05:00.000-06:002005-10-17T10:05:00.000-06:00Also see:Rubin, DB (1981) The Bayesian bootstrap. ...Also see:<BR/><BR/>Rubin, DB (1981) The Bayesian bootstrap. Ann. Statist. 9, 130-134.<BR/><BR/>The problem is how to generate samples from the Dirichlet(1,...,1) distribution (which is a kind of a simplex). The paper recommends to generate (n-1) random numbers from the uniform distribution on [0,1], sort them, and take the differences between the subsequent ones (and zero and one). This guarantees that they all sum up to 1. <BR/><BR/><A></A><A></A>Posted by<A><B> </B></A><A HREF="http://kt.ijs.si/aleks" REL="nofollow" TITLE="">Aleks</A>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6555947.post-1129535716424551262005-10-17T01:55:00.000-06:002005-10-17T01:55:00.000-06:00FYI,See the paper "Mean and variance CFAR performa...FYI,<BR/><BR/>See the paper "<A HREF="http://ieeexplore.ieee.org/iel5/8521/26928/01197279.pdf?arnumber=1197279" REL="nofollow">Mean and variance CFAR performance via fiber integration</A> " for an application of this idea.<BR/><BR/>Personally, I like the QR decomposition of a Gaussian matrix to get a uniform sample of the unitary/orthogonal group.<BR/> <BR/><BR/><A></A><A></A>Posted by<A><B> </B></A><A HREF="http://geomblog.blogspot.com/2005/10/sampling-from-simplex.html" REL="nofollow" TITLE="stsmith at ll dot mit dot edu">Steven Thomas Smith</A>Anonymousnoreply@blogger.com