+ Reply to Thread
Results 1 to 11 of 11

Thread: Uniform distribution on a triangle

  1. #1
    Points: 1,346, Level: 20
    Level completed: 46%, Points required for next Level: 54

    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!,
    lady

  2. #2
    Points: 2,513, Level: 30
    Level completed: 43%, Points required for next Level: 87

    Posts
    194
    Thanks
    1
    Thanked 14 Times in 13 Posts

    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. #3
    Points: 1,346, Level: 20
    Level completed: 46%, Points required for next Level: 54

    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #4
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Uniform distribution on a triangle

    Quote Originally Posted by ladyluck View Post
    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. #5
    Points: 1,346, Level: 20
    Level completed: 46%, Points required for next Level: 54

    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #6
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Uniform distribution on a triangle

    Quote Originally Posted by ladyluck View Post
    I think that I have it figured out, mostly

    EX=EY=1/2
    Are you sure about that?

  7. #7
    Points: 1,346, Level: 20
    Level completed: 46%, Points required for next Level: 54

    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #8
    Points: 2,513, Level: 30
    Level completed: 43%, Points required for next Level: 87

    Posts
    194
    Thanks
    1
    Thanked 14 Times in 13 Posts

    Re: Uniform distribution on a triangle

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

  9. #9
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Uniform distribution on a triangle

    Quote Originally Posted by ladyluck View Post
    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. #10
    Super Moderator
    Points: 13,151, Level: 74
    Level completed: 76%, Points required for next Level: 99
    Dragan's Avatar
    Location
    Illinois, US
    Posts
    2,014
    Thanks
    0
    Thanked 223 Times in 192 Posts

    Re: Uniform distribution on a triangle

    Quote Originally Posted by Dason View Post

    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. #11
    TS Contributor
    Points: 22,410, Level: 93
    Level completed: 6%, Points required for next Level: 940

    Posts
    3,020
    Thanks
    12
    Thanked 565 Times in 537 Posts

    Re: Uniform distribution on a triangle


    So to sum up:

    Given f_{X, Y}(x, y) = 2 , x > 0, y > 0, x + y < 1

    E[X] = \int_0^1 \int_0^{1-y} 2x dx dy
= \int_0^1 (1 - y)^2 dy = \frac {1} {3}

    Similarly, by symmetry, E[Y] = \frac {1} {3}

    E[X^2] = \int_0^1 \int_0^{1-y} 2x^2 dxdy
= \int_0^1 \frac {2} {3} (1 - y)^3 dy = \frac {1} {6}

    \Rightarrow Var[X] = E[X^2] - E[X]^2 
= \frac {1} {6} - \frac {1} {3^2} = \frac {1} {18}

    and also by symmetry, Var[Y] = \frac {1} {18}

    Finally, E[XY] = \int_0^1 \int_0^{1-y} 2xy dxdy
= \int_0^1 y(1 - y)^2 dy = \int_0^1 (y - 2y^2 + y^3) dy
= \frac {1} {2} - \frac {2} {3} + \frac {1} {4}
= \frac {1} {12}

    \Rightarrow Cov[X, Y] = E[XY] - E[X]E[Y] 
= \frac {1} {12} - \frac {1} {3^2} = -\frac {1} {36}

    \Rightarrow Corr[X, Y] = \frac {Cov[X, Y]} {SD[X]SD[Y]}
= -\frac {1} {36} \times 18 = -\frac {1} {2}

+ Reply to Thread

           




Similar Threads

  1. Sum of uniform distribution
    By daniel23 in forum Probability
    Replies: 5
    Last Post: 04-07-2011, 01:07 PM
  2. uniform distribution
    By xixihaha in forum Probability
    Replies: 5
    Last Post: 11-26-2008, 09:27 AM
  3. Uniform distribution
    By thessdd in forum Probability
    Replies: 6
    Last Post: 06-23-2008, 08:24 AM
  4. Uniform Distribution
    By wrohrer in forum Probability
    Replies: 1
    Last Post: 04-05-2006, 02:48 PM
  5. uniform distribution
    By megs915 in forum Probability
    Replies: 5
    Last Post: 10-24-2005, 12:04 PM

Posting Permissions

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






Advertise on Talk Stats