Thread: Uniform distribution on a triangle

1. Uniform distribution on a triangle

Hi All! So happy to find this site!

If (x,y) is the value of the random vector (X,Y) and is uniformly distributed over the triangle with vertices (0,0), (0,1), (1,0) how do I calculate the correlation between X and Y??????

thanks!,

2. Re: Uniform distribution on a triangle

This is such a cute little problem that I would love to just solve it for you. But you are supposed to be learning this stuff, not me. So let's use the socratic method.

Can you write down an expression for COV(X,Y)? It doesn't matter if you don't know how to evaluate the expression yet. Just start with the definition.

3. Re: Uniform distribution on a triangle

I think that I have it figured out, mostly

EX=EY=1/2

EX^2=EY^2=1/3

VarX=VarY=1/12

CovXY=EXY-(EX)(EY)

I was getting -1/12 for the covariance and -1 for the correlation. Although I was having issues with my bounds for integration- I was going 0 to 1 for X and 1-x to 1 for Y. That does not make sense to me. Any help on the bounds? I was using xy dx dy as the integrand

4. Re: Uniform distribution on a triangle

I was going 0 to 1 for X and 1-x to 1 for Y. That does not make sense to me. Any help on the bounds? I was using xy dx dy as the integrand
If you're using a variable in your limits of integration for Y then you need to do the integration for Y first. Also: Clearly 1-x is one of the limits for Y. But consider a fixed point x and then figure out the region you're integrating for Y. Does that seem right? The appropriate change should hopefully be clear.

5. Re: Uniform distribution on a triangle

My initial bounds were 0 (lower bound) and 1-x (upper bound).
Then EXY=1/12 and my correlation is -2, which is clearly wrong. I must be missing something.
thanks again!

oh and my integrand is (2 xy dx dy). Maybe I have this wrong.

6. Re: Uniform distribution on a triangle

I think that I have it figured out, mostly

EX=EY=1/2

7. Re: Uniform distribution on a triangle

Aha! I think.

I was not computing the marginals correctly.
EX=EY=1/3

EX^2=EY^2=1/6

Var X=Var Y= 1/6

EXY=1/12

correlation= -1/2

Seal of approval?

8. Re: Uniform distribution on a triangle

Yes. I worked the problem and agree with all of those results.

9. Re: Uniform distribution on a triangle

EX=EY=1/3

EX^2=EY^2=1/6

Var X=Var Y= 1/6
Your end product of the correlation is fine. But what you're getting for the variance doesn't add up to me. I think it should actually be 3/54.

I'm not recommending simulation as a way to get past theory. But I will recommend it as a way to check answers. For example in R you could simulate data from this distribution through a relatively simple rejection sampling algorithm. Then you could calculate the sample means, variances, covariance, and correlation and see if they are close to what you get theoretically. For example:
Code:
> # Simulate a single value
> gen <- function(){
+ 	repeat{
+ 		x <- runif(1)
+ 		y <- runif(1)
+ 		if(y <= 1-x){
+ 			return(c(x,y))
+ 		}
+ 	}
+ }
>
> # Get a large sample from the distribution
> tmp <- replicate(100000, gen())
>
> # I like the data to be stacked nice
> tmp <- t(tmp)
>
> #Get the sample means
> mean(tmp[,1])
[1] 0.3337302
> mean(tmp[,2])
[1] 0.3338301
>
> # Get the variances and covariances
> var(tmp)
[,1]        [,2]
[1,]  0.05555359 -0.02784043
[2,] -0.02784043  0.05543795
>
> # Get the correlation
> cor(tmp)
[,1]       [,2]
[1,]  1.0000000 -0.5016679
[2,] -0.5016679  1.0000000

10. Re: Uniform distribution on a triangle

Originally Posted by Dason

I'm not recommending simulation as a way to get past theory.
Dason: You have just made one of the shortest and most (excellent) concise statements that I have seen in some time.

11. Re: Uniform distribution on a triangle

So to sum up:

Given

Similarly, by symmetry,

and also by symmetry,

Finally,

 Tweet

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts