Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Math Help - conditional expectation, covariance

  1. #1
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255

    conditional expectation, covariance

    Question. Let X and Y be random variables with joint density

    f_{X,Y}(x,y)=\left\{\begin{array}{cc}{ke^{-{\lambda}x},0<y<x<{\infty}\\0, &otherwise\end{array}\right.

    Derive the conditional density, f_{X|Y}(x|y), and the conditional expectation, E[X|Y]. Hence or otherwise, evaluate E(X) and Cov(X,Y).

    Answer.

    (I highlighted the questions that came up along the answer write up by ->>>>>)

    f_Y(y)=\int_{-\infty}^{\infty}f_{X,Y}(x,y)dx=\int_y^{\infty}ke^{-{\lambda}x}dx=k\int_y^{\infty}e^{-{\lambda}x}dx=k[(-\frac{1}{\lambda}e^{-{\lambda}x}]_y^{\infty}=\frac{k}{\lambda}e^{-{\lambda}y},
    0<y<{\infty}.

    ->>>>>>>Is this support right, or should I say 0<y<x<{\infty} (ie include x in it)

    f_{X|Y}(x|y)=\frac{f_{X,Y}(x|y)}{f_Y(y)}=\frac{ke^  {-{\lambda}x}}{\frac{k}{\lambda}e^{-{\lambda}y}}={\lambda}e^{\lambda(y-x)}

    Then expected value

    E(X|Y)=\int_{-infty}^{\infty}xf_{X|Y}(x|y)dx=\int_y^{\infty}x{\l  ambda}e^{({\lambda}y-{\lambda}x)}dx={\lambda}e^{{\lambda}y}\int_y^{\inf  ty}xe^{-{\lambda}x}dx=
    ={\lambda}e^{{\lambda}y}\frac{e^{-{\lambda}y}}{\lambda}(y-1)=y-1

    ( \int_y^{\infty}xe^{-{\lambda}x}=[x(-\frac{1}{\lambda}})e^{-{\lambda}x}]_y^{\infty}-\int_y^{\infty}e^{-{\lambda}x}dx=[\frac{-xe^{-{\lambda}x}}{\lambda}]_y^{\infty}-[-\frac{1}{\lambda}e^{-{\lambda}x}]_y^{\infty}=\frac{ye^{-{\lambda}y}}{\lambda}-\frac{e^{-{\lambda}y}}{\lambda}=\frac{e^{{-\lambda}y}}{\lambda}(y-1))

    Therefore E(X|Y)=Y-1

    "Hence" somehow hint on using E(X|Y) in evaluating E(X), and I try that:

    E(X)=E[E[X|Y]]=E[Y-1]=E(Y)-1

    ->>>>>>So still need to do the integration to find E(X) directly from the integral, or E(Y) first and then deduct 1 to get E(X). Right?

    I find E(Y) since the integration is slightly easier.

    \int_{-\infty}^{\infty}=\int_0^{\infty}y\frac{k}{\lambda}  e^{-{\lambda}y}dy=\frac{k}{\lambda}\int_0^{\infty}ye^{-{\lambda}y}dy=-k but I probably messed up signs somewhere and I feel it should be k... (no big deal, I'll recheck).

    ->>>>>The question is, do I need to take into account the bound on y which is y<x?

    Once I get E(Y), E(X)=E(Y)-1=k-1.

    Then Cov(X,Y)=E(XY)-E(X)E(Y) and again I need to integrate to find E(XY), right? Or there is an easy way...
    Last edited by Volga; February 2nd 2011 at 01:58 AM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor matheagle's Avatar
    Joined
    Feb 2009
    Posts
    2,763
    Thanks
    5
    The density of Y only depends on y.
    But the conditional will have 0<y<x

    You're missing the exponent in the first integration.
    And you should compute k immediately.
    you have lots of errors in your integration for E(X|Y) like the x.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Yes, sorry - the first integration and the E(X|Y) calculation wasn't properly 'latex'ed, I have corrected. I also added more explanation to E(X|Y) (intermediate integration).
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor matheagle's Avatar
    Joined
    Feb 2009
    Posts
    2,763
    Thanks
    5
    Logically I have a problem with E(X|Y)=Y-1.
    IF X>Y, how can it's expectation be less than it's lower bound?
    Again, you should solve for k immediately.
    If you compute the double integral of f(x,y) and set it equal to 1, that should tell you what k is.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    I agree. I need to recompute f_Y(y) because I took the bounds for x starting from y, not from 0 (ie as in conditional density bounds). So the y density is not right, therefore, the conditional x|y density above is not right.

    Updated: No, I think I was right in the first calculation, x is bounded by y from below and therefore it belongs there in the calculation of f_Y(y).

    By the way, why do you say calculate k (why not lambda, for example)? Updated - see k calculation below.
    Last edited by Volga; February 2nd 2011 at 02:21 AM.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor matheagle's Avatar
    Joined
    Feb 2009
    Posts
    2,763
    Thanks
    5
    sorry, it's almost 1:30 AM
    I need sleep
    Maybe someone else can help you tonight.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Calculation of k.

    \int_{x=0}^{\infty}\int_{y=0}^xke^{-{\lambda}x}dydx=\int_0^{\infty}ke^{-{\lambda}x}dx\int_0^xdy=\int_0^{\infty}ke^{-{\lambda}x}[y]_0^x=

    =\int_0^{\infty}ke^{-{\lambda}x}xdx=k\int_0^{\infty}xe^{-{\lambda}x}dx=k([x(\frac{-1}{\lambda}e^{-{\lambda}x}]_0^{\infty}-\int_0^{\infty}\frac{-1}{\lambda}e^{-{\lambda}x}dx)=k([-\frac{x}{\lambda}e^{-{\lambda}x}]_0^{\infty}-\frac{1}{{\lambda}^2}[e^{-{\lambda}x}]_0^{\infty}=

    =k(0-\frac{1}{{\lambda}^2}(0-e^0))=k\frac{1}{{\lambda}^2}=1

    therefore k={\lambda}^2
    Last edited by Volga; February 2nd 2011 at 02:18 AM.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Quote Originally Posted by matheagle View Post
    sorry, it's almost 1:30 AM
    I need sleep
    Maybe someone else can help you tonight.
    thanks, you've already helped a lot!
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Umm... After rechecking,I am kind of at the same point, E(X|Y)=Y-1 and it still does not make sense.
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor matheagle's Avatar
    Joined
    Feb 2009
    Posts
    2,763
    Thanks
    5
    Fine, I'll look at it.
    WE just had 20 inches of snow and my car is buried..........
    The street won't be cleared for days nor my parking lot.
    So clearing my car is not even the point.

    k=\lambda^2 and there's no reason to do parts on that.
    After the first integration you should let u=\lambda x and use the gamma function.

    Then f_Y(y)=\lambda e^{-\lambda y} when y>0.

    So Then f(x|y)=\lambda e^{-\lambda (x-y)} when x>y>0.

    My answer is {1\over \lambda}+y

    By the way I did this in about 2 minutes, here's my work.
    Watch how I do NOT integrate...

    E(X|Y=y)=\int_y^{\infty}x e^{-\lambda (x-y)} \lambda dx

    Let u=\lambda (x-y) making du=\lambda dx

    Thus E(X|Y=y)=\int_0^{\infty}\left( {u\over\lambda}+y\right) e^{-u} du

    = {1\over\lambda}\int_0^{\infty}ue^{-u} du +y\int_0^{\infty} e^{-u} du

    = {1\over\lambda}\Gamma (2) +y\Gamma (1)

    = {1\over\lambda}+y

    This answer makes sense, since it exceeds Y and it depends on lambda.
    Last edited by matheagle; February 3rd 2011 at 12:23 AM.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Well, what can I say, you are worth your name! I have never been friends with Gamma function, not since the calculus days. I will re-do the integration again, now that I know the right answer. Hope you recover your car. It's a glorious day here with +18C and sunny, and all I am jumping between distribution theory and linear algebra with no end in sight.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    MHF Contributor harish21's Avatar
    Joined
    Feb 2010
    From
    Dirty South
    Posts
    1,036
    Thanks
    10
    Quote Originally Posted by matheagle View Post
    Fine, I'll look at it.
    WE just had 20 inches of snow and my car is buried..........
    The street won't be cleared for days nor my parking lot.
    So clearing my car is not even the point.
    Are you in/from Chicago?
    Follow Math Help Forum on Facebook and Google+

  13. #13
    MHF Contributor matheagle's Avatar
    Joined
    Feb 2009
    Posts
    2,763
    Thanks
    5
    unfortunately so
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Quote Originally Posted by matheagle View Post
    By the way I did this in about 2 minutes, here's my work.
    Watch how I do NOT integrate...

    E(X|Y=y)=\int_y^{\infty}x e^{-\lambda (x-y)} \lambda dx

    Let u=\lambda (x-y) making du=\lambda dx

    Thus E(X|Y=y)=\int_0^{\infty}\left( {u\over\lambda}+y\right) e^{-u} du

    = {1\over\lambda}\int_0^{\infty}ue^{-u} du +y\int_0^{\infty} e^{-u} du

    = {1\over\lambda}\Gamma (2) +y\Gamma (1)

    = {1\over\lambda}+y

    This answer makes sense, since it exceeds Y and it depends on lambda.
    This is neat, I think I can learn this trick. Just one question, when you substituted y=u=\lambda (x-y) you didn't do anything to the lower bound of integral which was  y - instead, you put it zero. Is it legitimate? Since the lower bound was y, and the new variable of integration (u) still depends on y, why did you change it to zero just like that?

    (Also, isn't it strange that \Gamma(2) and \Gamma(1) both equal to the same number, 1? understand that this comes from \Gamma(n)=(n-1)! and that 0!=1 by convention, but I still find it very strange.)

    By the way, I did another (non-Gamma) integration but with some substition and I got to y-\frac{1}{\lambda} which is still not correct. But I'll rechecked my signs and I still cannot figure out where I make mistake. I'll keep trying, binomially, until success...
    Last edited by Volga; February 4th 2011 at 05:22 AM.
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Senior Member
    Joined
    Nov 2010
    From
    Hong Kong
    Posts
    255
    Now, taking E(X|Y)=y+\frac{1}{\lambda}...

    E(X)=E[E(X|Y)]=E(Y+\frac{1}{\lambda})=E(Y)+\frac{1}{\lambda}

    now trying out the Gamma integral and setting u={\lambda}y, then dy=\frac{du}{\lambda}

    E(Y)=\int_0^{\infty}y\frac{k}{\lambda}e^{-{\lambda}y}dy=\frac{k}{\lambda}\int_0^{\infty}({\l  ambda}y)e^{-{\lambda}y}\frac{1}{\lambda}dy=\frac{k}{\lambda}\i  nt_0^{\infty}ue^{-u}du\frac{1}{{\lambda}^2}=\frac{k}{{\lambda}^3}\in  t_0^{\infty}ue^{-u}du=\frac{k}{{\lambda}^3}{\Gamma}(2)=\frac{k}{{\l  ambda}^3}=\frac{{\lambda}^2}{{\lambda}^3}=\frac{1}  {\lambda}

    Does it make sense?

    Then E(X)=\frac{k}{{\lambda}^3}+\frac{1}{\lambda}=\frac  {{\lambda}^2}{{\lambda}^3}+\frac{1}{\lambda}=\frac  {2}{\lambda}

    To find Cov (X,Y), looks like I still need to integrate more, to find E(XY) or E(Y^2):

    Cov(X,Y)=E(XY)-E(X)E(Y)
    E(XY)=E(YX)=E[E(YX|Y)]=E[YE(X|Y)]=E(Y(Y+\frac{1}{\lambda}))=E(Y^2)+\frac{1}{\lambda  }E(Y)

    question - can I do that E(XY)=E(YX)?

    then,

    E(Y^2)=\int_0^{\infty}y^2\frac{k}{\lambda}e^{-{\lambda}y}dy can be dealt with again using Gamma function (y^(3-1))

    Thanks!!

    Saw the Chicago snowstorm news on TV today. How do you guys move around? the roads are just full of snow, looks like nothing moves.
    Last edited by Volga; February 4th 2011 at 03:13 PM.
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Questions about: conditional probability, covariance
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: December 16th 2011, 09:38 PM
  2. expectation, variance, covariance
    Posted in the Advanced Statistics Forum
    Replies: 3
    Last Post: July 30th 2011, 02:04 AM
  3. Replies: 0
    Last Post: July 22nd 2011, 02:39 AM
  4. Conditional covariance
    Posted in the Advanced Statistics Forum
    Replies: 4
    Last Post: May 15th 2011, 08:12 AM
  5. plz help in finding Expectation and Covariance
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: March 28th 2010, 12:55 AM

Search Tags


/mathhelpforum @mathhelpforum