Conditional Expectation of joint pdf

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
3
down vote

favorite












Wish to identify what I'm doing wrong when finding the E(X|Y=5) of the following:
$$f(x, y)=begincases
1/6 & textif 0<x<2, 0<y<6-3x \ 0 & textotherwise
&
endcases.$$



My working:
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16f(y),mathsf d xendalign$$
where
$$beginalignmathsf f(y)~&=~displaystyleint_0^frac-y+63 frac16 ,mathsf d x = frac6-y18endalign$$



Therefore,
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16frac6-y18,mathsf d x mathsf ~&=~displaystyleint_0^2 x fracfrac16frac6-518,mathsf d x~&=~displaystyleint_0^2 3x ,mathsf d x endalign = 6$$



But then when I compute Var(X|Y=5), the answer is getting negative, which is impossible. So I think that I might have done something wrong when calculating the expectation.



My working for Variance:
$$Var(X|Y=5) = E(X^2|Y=5) - (E(X|Y=5) )^2 = 8 - 6^2 = -28$$



I appreciate any help.










share|cite|improve this question























  • you forgot the constraint on the support of $X$ given $Y=y.$
    – Xi'an
    35 mins ago
















up vote
3
down vote

favorite












Wish to identify what I'm doing wrong when finding the E(X|Y=5) of the following:
$$f(x, y)=begincases
1/6 & textif 0<x<2, 0<y<6-3x \ 0 & textotherwise
&
endcases.$$



My working:
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16f(y),mathsf d xendalign$$
where
$$beginalignmathsf f(y)~&=~displaystyleint_0^frac-y+63 frac16 ,mathsf d x = frac6-y18endalign$$



Therefore,
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16frac6-y18,mathsf d x mathsf ~&=~displaystyleint_0^2 x fracfrac16frac6-518,mathsf d x~&=~displaystyleint_0^2 3x ,mathsf d x endalign = 6$$



But then when I compute Var(X|Y=5), the answer is getting negative, which is impossible. So I think that I might have done something wrong when calculating the expectation.



My working for Variance:
$$Var(X|Y=5) = E(X^2|Y=5) - (E(X|Y=5) )^2 = 8 - 6^2 = -28$$



I appreciate any help.










share|cite|improve this question























  • you forgot the constraint on the support of $X$ given $Y=y.$
    – Xi'an
    35 mins ago












up vote
3
down vote

favorite









up vote
3
down vote

favorite











Wish to identify what I'm doing wrong when finding the E(X|Y=5) of the following:
$$f(x, y)=begincases
1/6 & textif 0<x<2, 0<y<6-3x \ 0 & textotherwise
&
endcases.$$



My working:
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16f(y),mathsf d xendalign$$
where
$$beginalignmathsf f(y)~&=~displaystyleint_0^frac-y+63 frac16 ,mathsf d x = frac6-y18endalign$$



Therefore,
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16frac6-y18,mathsf d x mathsf ~&=~displaystyleint_0^2 x fracfrac16frac6-518,mathsf d x~&=~displaystyleint_0^2 3x ,mathsf d x endalign = 6$$



But then when I compute Var(X|Y=5), the answer is getting negative, which is impossible. So I think that I might have done something wrong when calculating the expectation.



My working for Variance:
$$Var(X|Y=5) = E(X^2|Y=5) - (E(X|Y=5) )^2 = 8 - 6^2 = -28$$



I appreciate any help.










share|cite|improve this question















Wish to identify what I'm doing wrong when finding the E(X|Y=5) of the following:
$$f(x, y)=begincases
1/6 & textif 0<x<2, 0<y<6-3x \ 0 & textotherwise
&
endcases.$$



My working:
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16f(y),mathsf d xendalign$$
where
$$beginalignmathsf f(y)~&=~displaystyleint_0^frac-y+63 frac16 ,mathsf d x = frac6-y18endalign$$



Therefore,
$$beginalignmathsf E(Xmid Y=5)~&=~displaystyleint_0^2 x fracfrac16frac6-y18,mathsf d x mathsf ~&=~displaystyleint_0^2 x fracfrac16frac6-518,mathsf d x~&=~displaystyleint_0^2 3x ,mathsf d x endalign = 6$$



But then when I compute Var(X|Y=5), the answer is getting negative, which is impossible. So I think that I might have done something wrong when calculating the expectation.



My working for Variance:
$$Var(X|Y=5) = E(X^2|Y=5) - (E(X|Y=5) )^2 = 8 - 6^2 = -28$$



I appreciate any help.







self-study pdf joint-distribution conditional-expectation






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 1 hour ago









Ferdi

3,65542152




3,65542152










asked 1 hour ago









vic12

374




374











  • you forgot the constraint on the support of $X$ given $Y=y.$
    – Xi'an
    35 mins ago
















  • you forgot the constraint on the support of $X$ given $Y=y.$
    – Xi'an
    35 mins ago















you forgot the constraint on the support of $X$ given $Y=y.$
– Xi'an
35 mins ago




you forgot the constraint on the support of $X$ given $Y=y.$
– Xi'an
35 mins ago










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










Think about this geometrically: we've got $(X,Y)$ uniformly distributed over the right triangle with vertices at $(0,0)$, $(2,0)$, and $(0,6)$.



If we imagine sampling over and over from this region uniformly, we can picture $E(X|Y=5)$ as the average $x$ coordinate of the points that end up on the horizontal line $y=5$. All of these points will necessarily have $0 < x < 1/3$, since if $x geq 1/3$ then $y = 5$ can't happen, and since the points are uniform over this line, this image suggests $E(X|Y=5) stackrel ?= 1/6$ (this is the midpoint of the range of $x$ points that can end up on this line).



Checking this with calculus, the issue with what you did is the limits of integration for $x$ also depend on $y$. If $y = 5$ is observed then the biggest that $x$ can be is $1/3$, so really
$$
E(X|Y=5) = int_0^1/3x frac36-y,text dx = 3 cdot frac 12 x^2bigg|_x=0^x=1/3 = frac 16.
$$




Another quick sanity check is that $E(X|Y)$ has to be within the range of $X$, so $E(X|Y=5)neq 6$ can be recognized as incorrect before the negative variance shows up.






share|cite|improve this answer






















    Your Answer





    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "65"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f374882%2fconditional-expectation-of-joint-pdf%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    Think about this geometrically: we've got $(X,Y)$ uniformly distributed over the right triangle with vertices at $(0,0)$, $(2,0)$, and $(0,6)$.



    If we imagine sampling over and over from this region uniformly, we can picture $E(X|Y=5)$ as the average $x$ coordinate of the points that end up on the horizontal line $y=5$. All of these points will necessarily have $0 < x < 1/3$, since if $x geq 1/3$ then $y = 5$ can't happen, and since the points are uniform over this line, this image suggests $E(X|Y=5) stackrel ?= 1/6$ (this is the midpoint of the range of $x$ points that can end up on this line).



    Checking this with calculus, the issue with what you did is the limits of integration for $x$ also depend on $y$. If $y = 5$ is observed then the biggest that $x$ can be is $1/3$, so really
    $$
    E(X|Y=5) = int_0^1/3x frac36-y,text dx = 3 cdot frac 12 x^2bigg|_x=0^x=1/3 = frac 16.
    $$




    Another quick sanity check is that $E(X|Y)$ has to be within the range of $X$, so $E(X|Y=5)neq 6$ can be recognized as incorrect before the negative variance shows up.






    share|cite|improve this answer


























      up vote
      3
      down vote



      accepted










      Think about this geometrically: we've got $(X,Y)$ uniformly distributed over the right triangle with vertices at $(0,0)$, $(2,0)$, and $(0,6)$.



      If we imagine sampling over and over from this region uniformly, we can picture $E(X|Y=5)$ as the average $x$ coordinate of the points that end up on the horizontal line $y=5$. All of these points will necessarily have $0 < x < 1/3$, since if $x geq 1/3$ then $y = 5$ can't happen, and since the points are uniform over this line, this image suggests $E(X|Y=5) stackrel ?= 1/6$ (this is the midpoint of the range of $x$ points that can end up on this line).



      Checking this with calculus, the issue with what you did is the limits of integration for $x$ also depend on $y$. If $y = 5$ is observed then the biggest that $x$ can be is $1/3$, so really
      $$
      E(X|Y=5) = int_0^1/3x frac36-y,text dx = 3 cdot frac 12 x^2bigg|_x=0^x=1/3 = frac 16.
      $$




      Another quick sanity check is that $E(X|Y)$ has to be within the range of $X$, so $E(X|Y=5)neq 6$ can be recognized as incorrect before the negative variance shows up.






      share|cite|improve this answer
























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        Think about this geometrically: we've got $(X,Y)$ uniformly distributed over the right triangle with vertices at $(0,0)$, $(2,0)$, and $(0,6)$.



        If we imagine sampling over and over from this region uniformly, we can picture $E(X|Y=5)$ as the average $x$ coordinate of the points that end up on the horizontal line $y=5$. All of these points will necessarily have $0 < x < 1/3$, since if $x geq 1/3$ then $y = 5$ can't happen, and since the points are uniform over this line, this image suggests $E(X|Y=5) stackrel ?= 1/6$ (this is the midpoint of the range of $x$ points that can end up on this line).



        Checking this with calculus, the issue with what you did is the limits of integration for $x$ also depend on $y$. If $y = 5$ is observed then the biggest that $x$ can be is $1/3$, so really
        $$
        E(X|Y=5) = int_0^1/3x frac36-y,text dx = 3 cdot frac 12 x^2bigg|_x=0^x=1/3 = frac 16.
        $$




        Another quick sanity check is that $E(X|Y)$ has to be within the range of $X$, so $E(X|Y=5)neq 6$ can be recognized as incorrect before the negative variance shows up.






        share|cite|improve this answer














        Think about this geometrically: we've got $(X,Y)$ uniformly distributed over the right triangle with vertices at $(0,0)$, $(2,0)$, and $(0,6)$.



        If we imagine sampling over and over from this region uniformly, we can picture $E(X|Y=5)$ as the average $x$ coordinate of the points that end up on the horizontal line $y=5$. All of these points will necessarily have $0 < x < 1/3$, since if $x geq 1/3$ then $y = 5$ can't happen, and since the points are uniform over this line, this image suggests $E(X|Y=5) stackrel ?= 1/6$ (this is the midpoint of the range of $x$ points that can end up on this line).



        Checking this with calculus, the issue with what you did is the limits of integration for $x$ also depend on $y$. If $y = 5$ is observed then the biggest that $x$ can be is $1/3$, so really
        $$
        E(X|Y=5) = int_0^1/3x frac36-y,text dx = 3 cdot frac 12 x^2bigg|_x=0^x=1/3 = frac 16.
        $$




        Another quick sanity check is that $E(X|Y)$ has to be within the range of $X$, so $E(X|Y=5)neq 6$ can be recognized as incorrect before the negative variance shows up.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited 1 hour ago

























        answered 1 hour ago









        jld

        11.5k23149




        11.5k23149



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f374882%2fconditional-expectation-of-joint-pdf%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke