Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Generate random matrix with constraints
Date: Tue, 16 Nov 2010 20:30:06 +0000 (UTC)
Organization: The Mitre Corp
Lines: 29
Message-ID: <ibupke$hgu$1@fred.mathworks.com>
References: <ibu6dc$elk$1@fred.mathworks.com> <ibui0l$50m$1@fred.mathworks.com> <ibup5c$hmr$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1289939406 17950 172.30.248.35 (16 Nov 2010 20:30:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 16 Nov 2010 20:30:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:687397

"Ryan " <rtang@axiomvaluation.com> wrote in message <ibup5c$hmr$1@fred.mathworks.com>...
> "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <ibui0l$50m$1@fred.mathworks.com>...
> > "Ryan " <rtang@axiomvaluation.com> wrote in message <ibu6dc$elk$1@fred.mathworks.com>...
> > > .......
> > > I want to generate a random, let's say, 5 by 5 matrix, with one constraint that the sum of each row of the matrix is 1.
> > > ..,....
> > - - - - - - - - - - -
> >   To merely place a constraint on random variables leaves much unsaid.  There needs to be specified some underlying statistical distribution to the random variables and then the constraint imposed on this distribution as a conditional probability.  For example you might have said that the elements of your matrix are to be independent normal with some mean and variance but then the constraint of a fixed row sum imposed as conditional probability.  Or you could say that each element is to be uniformly distributed between -10 and +10 but with the condition of row sums fixed at 0 (in which case you might make use of my 'randfixedsum'.)  Or you might say they are each uniformly distributed between 0 and 1 but that you will always normalize by dividing by their sum so as to obtain a sum of 1.  In this case there will be a skewing towards the center which becomes increasingly evident as the 

> > number of elements in the row increases. 
> > 
> > Roger Stafford
> 
> Roger,
> 
> Thanks for getting back!
> 
> I should have asked the question better. 
> 
> In this matrix that I mentioned above, I need each element varies from -1 to 1. I don't care about what kind of distribution are these elements from. The only constraint here for each row is that they need to sum up to 1.
> 
> What's the best way to structure that?

OK, so what was wrong with Steven Lord's previous reply?

> 
> Thanks
> 
> Ryan