[R] runif with condition

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jan 11 13:49:26 CET 2012


On 12-01-11 5:12 AM, peter dalgaard wrote:
>
> On Jan 10, 2012, at 18:11 , AlanM wrote:
>
>> I have to disagree with what's been posted, but I think some very interesting
>> points have been addressed.  I'd like to add my two cents.
>>
>> Consider the pair {X, 1-X} where X is sampled from a uniform(0,1)
>> distribution.  The quantity 1- X also comes from a uniform(0,1) distribution
>> and therefore is probabilistic and not deterministic.
>>
>> The sum of independent random variables is itself a random variable.
>
> Also of non-independent ones, provided you allow the possibility of a degenerate distribution, as in the case above.
>
>> If X1,
>> X2&  X3 are
>
> independent and
>
>> uniformly distributed, then the distribution of Y = X1 + X2 + X3
>> can be determined (i.e. Y is probabilistic and NOT deterministic).  Y is a
>> random variable, but it is correlated with X1, X2 and X3.  The set {X1, X2,
>> X3, 100 - (X1 + X2 + X3) } contains 4 random variables, however they are
>> neither independent or identically distributed.
>
>
> Yes. You can achieve various properties like X1+X2+X3+X4=100, X1,...,X4 identically distributed, but not independent and not uniform. (Generate 4 independent variables from some distribution on the positive axis and rescale to the required sum.)
>
> You can't have X1,...,X4 all uniform on (0,100), even if non-independent, with a sum of 100, because the mean of the sum would be the sum of the means, i.e., 200!
>
> Whether you can have X1,...,X4, exchangeable and uniform on (0,50) is, er, an interesting question. (I would say probably not, but I can't think of an argument.)

I think it probably is possible -- it's basically a 4 dimensional 
copula, and those are pretty flexible.  We have a construction for 2D, 
and I think I have one in 3D.  (In 3D, the intersection of the plane 
X+Y+Z=100 with the cube [0,50]^3 is a regular hexagon; you just need to 
spread the mass over the hexagon in the right way to get uniform marginals.)

I think the shape W+X+Y+Z=100 makes when it intersects with the 4-cube 
is a regular octahedron in some projection, but I don't know how to 
distribute mass over it for uniform marginals.

Duncan Murdoch

>
>
>>
>> If you are curious, check this out.
>>
>> Deriving the Probability Density for Sums of Uniform Random Variables
>> Edward J. Lusk and Haviland Wright
>> The American Statistician
>> Vol. 36, No. 2 (May, 1982), pp. 128-130
>>
>> Thanks to the OP.  This has become an interesting thread.
>>
>> -Alan Mitchell
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/runif-with-condition-tp4278704p4282600.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list