Expectation from Joint Distribution

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











up vote
3
down vote

favorite












We have



$$f_X,Y(x,y) =
begincases
1 & 0 < x < 1, x < y < x+1; \
0 & textotherwise
endcases
$$



and we're looking for $operatornameVarY$.



I got two different answers with two different methods and I'm not sure which one is correct.




Method 1:



$$operatorname E(Y) = int_0^1 int_x^x+1yf_X,Y(x,y),dy,dx = int_0^1 left(x+frac12right) , dx = 1$$



$$operatorname E(Y^2) = int_0^1 int_x^x+1y^2f_X,Y(x,y) , dy , dx = int_0^1 left(x^2 + x + frac13right) , dx = frac76$$



So $operatornameVar(Y) = frac16$




Method 2:



Marginal distribution $f_Y(y) =1$



$$operatorname E(Y) = int_x^x+1yf_Y(y),dy = x+frac12$$



$$operatorname E(Y^2) = int_x^x+1y^2f_Y(y) , dy = x^2 + x +frac13$$



So $operatornameVar(Y) = left(x^2 + x +frac13right) - left(x+frac12 right)^2 = frac112$




One of these solutions is probably wrong, but I can't really identify the error.










share|cite|improve this question























  • You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
    – joriki
    Sep 6 at 11:20










  • Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
    – Graham Kemp
    Sep 6 at 11:55














up vote
3
down vote

favorite












We have



$$f_X,Y(x,y) =
begincases
1 & 0 < x < 1, x < y < x+1; \
0 & textotherwise
endcases
$$



and we're looking for $operatornameVarY$.



I got two different answers with two different methods and I'm not sure which one is correct.




Method 1:



$$operatorname E(Y) = int_0^1 int_x^x+1yf_X,Y(x,y),dy,dx = int_0^1 left(x+frac12right) , dx = 1$$



$$operatorname E(Y^2) = int_0^1 int_x^x+1y^2f_X,Y(x,y) , dy , dx = int_0^1 left(x^2 + x + frac13right) , dx = frac76$$



So $operatornameVar(Y) = frac16$




Method 2:



Marginal distribution $f_Y(y) =1$



$$operatorname E(Y) = int_x^x+1yf_Y(y),dy = x+frac12$$



$$operatorname E(Y^2) = int_x^x+1y^2f_Y(y) , dy = x^2 + x +frac13$$



So $operatornameVar(Y) = left(x^2 + x +frac13right) - left(x+frac12 right)^2 = frac112$




One of these solutions is probably wrong, but I can't really identify the error.










share|cite|improve this question























  • You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
    – joriki
    Sep 6 at 11:20










  • Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
    – Graham Kemp
    Sep 6 at 11:55












up vote
3
down vote

favorite









up vote
3
down vote

favorite











We have



$$f_X,Y(x,y) =
begincases
1 & 0 < x < 1, x < y < x+1; \
0 & textotherwise
endcases
$$



and we're looking for $operatornameVarY$.



I got two different answers with two different methods and I'm not sure which one is correct.




Method 1:



$$operatorname E(Y) = int_0^1 int_x^x+1yf_X,Y(x,y),dy,dx = int_0^1 left(x+frac12right) , dx = 1$$



$$operatorname E(Y^2) = int_0^1 int_x^x+1y^2f_X,Y(x,y) , dy , dx = int_0^1 left(x^2 + x + frac13right) , dx = frac76$$



So $operatornameVar(Y) = frac16$




Method 2:



Marginal distribution $f_Y(y) =1$



$$operatorname E(Y) = int_x^x+1yf_Y(y),dy = x+frac12$$



$$operatorname E(Y^2) = int_x^x+1y^2f_Y(y) , dy = x^2 + x +frac13$$



So $operatornameVar(Y) = left(x^2 + x +frac13right) - left(x+frac12 right)^2 = frac112$




One of these solutions is probably wrong, but I can't really identify the error.










share|cite|improve this question















We have



$$f_X,Y(x,y) =
begincases
1 & 0 < x < 1, x < y < x+1; \
0 & textotherwise
endcases
$$



and we're looking for $operatornameVarY$.



I got two different answers with two different methods and I'm not sure which one is correct.




Method 1:



$$operatorname E(Y) = int_0^1 int_x^x+1yf_X,Y(x,y),dy,dx = int_0^1 left(x+frac12right) , dx = 1$$



$$operatorname E(Y^2) = int_0^1 int_x^x+1y^2f_X,Y(x,y) , dy , dx = int_0^1 left(x^2 + x + frac13right) , dx = frac76$$



So $operatornameVar(Y) = frac16$




Method 2:



Marginal distribution $f_Y(y) =1$



$$operatorname E(Y) = int_x^x+1yf_Y(y),dy = x+frac12$$



$$operatorname E(Y^2) = int_x^x+1y^2f_Y(y) , dy = x^2 + x +frac13$$



So $operatornameVar(Y) = left(x^2 + x +frac13right) - left(x+frac12 right)^2 = frac112$




One of these solutions is probably wrong, but I can't really identify the error.







probability






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Sep 6 at 16:18









Michael Hardy

206k23187466




206k23187466










asked Sep 6 at 10:55









sedrick

40611




40611











  • You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
    – joriki
    Sep 6 at 11:20










  • Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
    – Graham Kemp
    Sep 6 at 11:55
















  • You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
    – joriki
    Sep 6 at 11:20










  • Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
    – Graham Kemp
    Sep 6 at 11:55















You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
– joriki
Sep 6 at 11:20




You can get displayed equations (which are less cramped and easier to read) by surrounding them with double instead of single dollar signs.
– joriki
Sep 6 at 11:20












Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
– Graham Kemp
Sep 6 at 11:55




Hint: $mathsf E(Y)$ should be a constant, not a function of $x$.
– Graham Kemp
Sep 6 at 11:55










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










The first method is correct.



The second method uses the wrong marginal distribution.   It appears to be a joint



Notice that the joint distribution is uniform over a rhombus. Plot this and notice the lengths of the horizontal cross section for various $y$ values from $0$ to $2$.



It should be as follows.



$$beginsplitf_Y(y) &=int_0^1 mathbf 1_xleq yleq x+1mathrm d x\&= int_max(0,y-1)^min(1,y)mathbf 1_0leq yleq 2mathrm d x \ & = ymathbf 1_0leq ylt 1+(2-y)mathbf 1_1leq yleq 2\&=begincasesy &:& 0leq ylt 1\2-y&:&1leq yleq 2\0&:&textelseendcases endsplit$$



As a reality check, a marginal distribution's support should not include other variables, and the interval must contain all realisable values for the variable.



$$beginsplit1 &=int_0^1 ymathrm d y+int_1^2 (2-y)mathrm d yendsplit$$



Then the expectations shall be in agreement with the first method. $$beginsplitmathsf E(Y) &=int_0^1 y^2mathrm d y+int_1^2y(2-y)mathrm d y \ &= 1\mathsf E(Y^2) &=int_0^1 y^3mathrm d y+int_1^2y^2(2-y)mathrm d y \ &= dfrac 76endsplit$$






share|cite|improve this answer





























    up vote
    1
    down vote













    Your first method is correct, but your second message can be salvaged. What you calculate in the second method are the conditional expectation and the conditional variance, conditional on the value of $X$:



    begineqnarray*
    mathsf E[Ymid X=x]&=&int_x^x+1y,f_X,Y(x,y),mathrm dy=x+frac12;,\
    mathsf E[Y^2mid X=x]&=&int_x^x+1y^2,f_X,Y(x,y),mathrm dy=x^2+x+frac13;,\
    mathsfVar(Ymid X=x)&=&mathsf E[Y^2mid X=x]-mathsf E[Ymid X=x]^2=left(x^2+x+frac13right)-left(x+frac12right)^2=frac112;.
    endeqnarray*



    You can get the unconditional variance of $Y$ from these results by applying the law of total variance:



    $$
    mathsfVar(Y)=mathsf E[mathsfVar(Ymid X)]+mathsfVar(mathsf E[Ymid X])=frac112+mathsfVarleft(X+frac12right)=frac112+mathsfVar(X)=frac112+frac112=frac16;.
    $$






    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: "69"
      ;
      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: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2907332%2fexpectation-from-joint-distribution%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      The first method is correct.



      The second method uses the wrong marginal distribution.   It appears to be a joint



      Notice that the joint distribution is uniform over a rhombus. Plot this and notice the lengths of the horizontal cross section for various $y$ values from $0$ to $2$.



      It should be as follows.



      $$beginsplitf_Y(y) &=int_0^1 mathbf 1_xleq yleq x+1mathrm d x\&= int_max(0,y-1)^min(1,y)mathbf 1_0leq yleq 2mathrm d x \ & = ymathbf 1_0leq ylt 1+(2-y)mathbf 1_1leq yleq 2\&=begincasesy &:& 0leq ylt 1\2-y&:&1leq yleq 2\0&:&textelseendcases endsplit$$



      As a reality check, a marginal distribution's support should not include other variables, and the interval must contain all realisable values for the variable.



      $$beginsplit1 &=int_0^1 ymathrm d y+int_1^2 (2-y)mathrm d yendsplit$$



      Then the expectations shall be in agreement with the first method. $$beginsplitmathsf E(Y) &=int_0^1 y^2mathrm d y+int_1^2y(2-y)mathrm d y \ &= 1\mathsf E(Y^2) &=int_0^1 y^3mathrm d y+int_1^2y^2(2-y)mathrm d y \ &= dfrac 76endsplit$$






      share|cite|improve this answer


























        up vote
        1
        down vote



        accepted










        The first method is correct.



        The second method uses the wrong marginal distribution.   It appears to be a joint



        Notice that the joint distribution is uniform over a rhombus. Plot this and notice the lengths of the horizontal cross section for various $y$ values from $0$ to $2$.



        It should be as follows.



        $$beginsplitf_Y(y) &=int_0^1 mathbf 1_xleq yleq x+1mathrm d x\&= int_max(0,y-1)^min(1,y)mathbf 1_0leq yleq 2mathrm d x \ & = ymathbf 1_0leq ylt 1+(2-y)mathbf 1_1leq yleq 2\&=begincasesy &:& 0leq ylt 1\2-y&:&1leq yleq 2\0&:&textelseendcases endsplit$$



        As a reality check, a marginal distribution's support should not include other variables, and the interval must contain all realisable values for the variable.



        $$beginsplit1 &=int_0^1 ymathrm d y+int_1^2 (2-y)mathrm d yendsplit$$



        Then the expectations shall be in agreement with the first method. $$beginsplitmathsf E(Y) &=int_0^1 y^2mathrm d y+int_1^2y(2-y)mathrm d y \ &= 1\mathsf E(Y^2) &=int_0^1 y^3mathrm d y+int_1^2y^2(2-y)mathrm d y \ &= dfrac 76endsplit$$






        share|cite|improve this answer
























          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          The first method is correct.



          The second method uses the wrong marginal distribution.   It appears to be a joint



          Notice that the joint distribution is uniform over a rhombus. Plot this and notice the lengths of the horizontal cross section for various $y$ values from $0$ to $2$.



          It should be as follows.



          $$beginsplitf_Y(y) &=int_0^1 mathbf 1_xleq yleq x+1mathrm d x\&= int_max(0,y-1)^min(1,y)mathbf 1_0leq yleq 2mathrm d x \ & = ymathbf 1_0leq ylt 1+(2-y)mathbf 1_1leq yleq 2\&=begincasesy &:& 0leq ylt 1\2-y&:&1leq yleq 2\0&:&textelseendcases endsplit$$



          As a reality check, a marginal distribution's support should not include other variables, and the interval must contain all realisable values for the variable.



          $$beginsplit1 &=int_0^1 ymathrm d y+int_1^2 (2-y)mathrm d yendsplit$$



          Then the expectations shall be in agreement with the first method. $$beginsplitmathsf E(Y) &=int_0^1 y^2mathrm d y+int_1^2y(2-y)mathrm d y \ &= 1\mathsf E(Y^2) &=int_0^1 y^3mathrm d y+int_1^2y^2(2-y)mathrm d y \ &= dfrac 76endsplit$$






          share|cite|improve this answer














          The first method is correct.



          The second method uses the wrong marginal distribution.   It appears to be a joint



          Notice that the joint distribution is uniform over a rhombus. Plot this and notice the lengths of the horizontal cross section for various $y$ values from $0$ to $2$.



          It should be as follows.



          $$beginsplitf_Y(y) &=int_0^1 mathbf 1_xleq yleq x+1mathrm d x\&= int_max(0,y-1)^min(1,y)mathbf 1_0leq yleq 2mathrm d x \ & = ymathbf 1_0leq ylt 1+(2-y)mathbf 1_1leq yleq 2\&=begincasesy &:& 0leq ylt 1\2-y&:&1leq yleq 2\0&:&textelseendcases endsplit$$



          As a reality check, a marginal distribution's support should not include other variables, and the interval must contain all realisable values for the variable.



          $$beginsplit1 &=int_0^1 ymathrm d y+int_1^2 (2-y)mathrm d yendsplit$$



          Then the expectations shall be in agreement with the first method. $$beginsplitmathsf E(Y) &=int_0^1 y^2mathrm d y+int_1^2y(2-y)mathrm d y \ &= 1\mathsf E(Y^2) &=int_0^1 y^3mathrm d y+int_1^2y^2(2-y)mathrm d y \ &= dfrac 76endsplit$$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Sep 6 at 11:58

























          answered Sep 6 at 11:29









          Graham Kemp

          81.5k43275




          81.5k43275




















              up vote
              1
              down vote













              Your first method is correct, but your second message can be salvaged. What you calculate in the second method are the conditional expectation and the conditional variance, conditional on the value of $X$:



              begineqnarray*
              mathsf E[Ymid X=x]&=&int_x^x+1y,f_X,Y(x,y),mathrm dy=x+frac12;,\
              mathsf E[Y^2mid X=x]&=&int_x^x+1y^2,f_X,Y(x,y),mathrm dy=x^2+x+frac13;,\
              mathsfVar(Ymid X=x)&=&mathsf E[Y^2mid X=x]-mathsf E[Ymid X=x]^2=left(x^2+x+frac13right)-left(x+frac12right)^2=frac112;.
              endeqnarray*



              You can get the unconditional variance of $Y$ from these results by applying the law of total variance:



              $$
              mathsfVar(Y)=mathsf E[mathsfVar(Ymid X)]+mathsfVar(mathsf E[Ymid X])=frac112+mathsfVarleft(X+frac12right)=frac112+mathsfVar(X)=frac112+frac112=frac16;.
              $$






              share|cite|improve this answer
























                up vote
                1
                down vote













                Your first method is correct, but your second message can be salvaged. What you calculate in the second method are the conditional expectation and the conditional variance, conditional on the value of $X$:



                begineqnarray*
                mathsf E[Ymid X=x]&=&int_x^x+1y,f_X,Y(x,y),mathrm dy=x+frac12;,\
                mathsf E[Y^2mid X=x]&=&int_x^x+1y^2,f_X,Y(x,y),mathrm dy=x^2+x+frac13;,\
                mathsfVar(Ymid X=x)&=&mathsf E[Y^2mid X=x]-mathsf E[Ymid X=x]^2=left(x^2+x+frac13right)-left(x+frac12right)^2=frac112;.
                endeqnarray*



                You can get the unconditional variance of $Y$ from these results by applying the law of total variance:



                $$
                mathsfVar(Y)=mathsf E[mathsfVar(Ymid X)]+mathsfVar(mathsf E[Ymid X])=frac112+mathsfVarleft(X+frac12right)=frac112+mathsfVar(X)=frac112+frac112=frac16;.
                $$






                share|cite|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Your first method is correct, but your second message can be salvaged. What you calculate in the second method are the conditional expectation and the conditional variance, conditional on the value of $X$:



                  begineqnarray*
                  mathsf E[Ymid X=x]&=&int_x^x+1y,f_X,Y(x,y),mathrm dy=x+frac12;,\
                  mathsf E[Y^2mid X=x]&=&int_x^x+1y^2,f_X,Y(x,y),mathrm dy=x^2+x+frac13;,\
                  mathsfVar(Ymid X=x)&=&mathsf E[Y^2mid X=x]-mathsf E[Ymid X=x]^2=left(x^2+x+frac13right)-left(x+frac12right)^2=frac112;.
                  endeqnarray*



                  You can get the unconditional variance of $Y$ from these results by applying the law of total variance:



                  $$
                  mathsfVar(Y)=mathsf E[mathsfVar(Ymid X)]+mathsfVar(mathsf E[Ymid X])=frac112+mathsfVarleft(X+frac12right)=frac112+mathsfVar(X)=frac112+frac112=frac16;.
                  $$






                  share|cite|improve this answer












                  Your first method is correct, but your second message can be salvaged. What you calculate in the second method are the conditional expectation and the conditional variance, conditional on the value of $X$:



                  begineqnarray*
                  mathsf E[Ymid X=x]&=&int_x^x+1y,f_X,Y(x,y),mathrm dy=x+frac12;,\
                  mathsf E[Y^2mid X=x]&=&int_x^x+1y^2,f_X,Y(x,y),mathrm dy=x^2+x+frac13;,\
                  mathsfVar(Ymid X=x)&=&mathsf E[Y^2mid X=x]-mathsf E[Ymid X=x]^2=left(x^2+x+frac13right)-left(x+frac12right)^2=frac112;.
                  endeqnarray*



                  You can get the unconditional variance of $Y$ from these results by applying the law of total variance:



                  $$
                  mathsfVar(Y)=mathsf E[mathsfVar(Ymid X)]+mathsfVar(mathsf E[Ymid X])=frac112+mathsfVarleft(X+frac12right)=frac112+mathsfVar(X)=frac112+frac112=frac16;.
                  $$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Sep 6 at 12:31









                  joriki

                  168k10181336




                  168k10181336



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2907332%2fexpectation-from-joint-distribution%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      這個網誌中的熱門文章

                      How to combine Bézier curves to a surface?

                      Carbon dioxide

                      Why am i infinitely getting the same tweet with the Twitter Search API?