How to derive the form of the posterior for regression?












2












$begingroup$


I have seen the general form of posterior for a regression $y = f(x)$ defined as
$$
P(theta|y,x) = frac{ P(y | x, theta) P(theta) }{ P(y|x) }
$$



I would like to know how to arrive at this form, starting from Bayes rule and the laws of probability.



The approach I tried is to write Bayes theorem notated as $p(theta|v) = frac{ p(v|theta) p(theta) }{ p(v) }$ and then try subsituting something for $v$.



Approach A. With $v rightarrow y|x$, this gives
$$
" P(theta|y|x) = frac{ P(y|x | theta) P(theta) }{ P(y|x) } "
$$

and then if there is a rule that $a|b|c rightarrow a|b,c$ it gives the result.
However I have not seen such a rule. Does it exist?



Approach B. Start with $v rightarrow y$ giving
$$
P(theta|y) = frac{ P(y | theta) P(theta) }{ P(y) }
$$

and then assume there is a rule that you can condition every factor on some other variable $x$ (see rule below),
giving
$$
P(theta|y,x) = frac{ P(y | theta,x) P(theta|x) }{ P(y|x) }
$$

and lastly assume that $P(theta|x) = P(theta)$.
But here I have not seen a rule that allows
$$
text{if} quad p(A) = P(B)P(C)cdots quadtext{then}quad p(A|X) = P(B|X)P(C|X)cdots
$$

Does such a rule exist?



What is the right approach?










share|cite|improve this question









$endgroup$








  • 3




    $begingroup$
    To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
    $endgroup$
    – Xi'an
    Jan 2 at 7:53
















2












$begingroup$


I have seen the general form of posterior for a regression $y = f(x)$ defined as
$$
P(theta|y,x) = frac{ P(y | x, theta) P(theta) }{ P(y|x) }
$$



I would like to know how to arrive at this form, starting from Bayes rule and the laws of probability.



The approach I tried is to write Bayes theorem notated as $p(theta|v) = frac{ p(v|theta) p(theta) }{ p(v) }$ and then try subsituting something for $v$.



Approach A. With $v rightarrow y|x$, this gives
$$
" P(theta|y|x) = frac{ P(y|x | theta) P(theta) }{ P(y|x) } "
$$

and then if there is a rule that $a|b|c rightarrow a|b,c$ it gives the result.
However I have not seen such a rule. Does it exist?



Approach B. Start with $v rightarrow y$ giving
$$
P(theta|y) = frac{ P(y | theta) P(theta) }{ P(y) }
$$

and then assume there is a rule that you can condition every factor on some other variable $x$ (see rule below),
giving
$$
P(theta|y,x) = frac{ P(y | theta,x) P(theta|x) }{ P(y|x) }
$$

and lastly assume that $P(theta|x) = P(theta)$.
But here I have not seen a rule that allows
$$
text{if} quad p(A) = P(B)P(C)cdots quadtext{then}quad p(A|X) = P(B|X)P(C|X)cdots
$$

Does such a rule exist?



What is the right approach?










share|cite|improve this question









$endgroup$








  • 3




    $begingroup$
    To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
    $endgroup$
    – Xi'an
    Jan 2 at 7:53














2












2








2


3



$begingroup$


I have seen the general form of posterior for a regression $y = f(x)$ defined as
$$
P(theta|y,x) = frac{ P(y | x, theta) P(theta) }{ P(y|x) }
$$



I would like to know how to arrive at this form, starting from Bayes rule and the laws of probability.



The approach I tried is to write Bayes theorem notated as $p(theta|v) = frac{ p(v|theta) p(theta) }{ p(v) }$ and then try subsituting something for $v$.



Approach A. With $v rightarrow y|x$, this gives
$$
" P(theta|y|x) = frac{ P(y|x | theta) P(theta) }{ P(y|x) } "
$$

and then if there is a rule that $a|b|c rightarrow a|b,c$ it gives the result.
However I have not seen such a rule. Does it exist?



Approach B. Start with $v rightarrow y$ giving
$$
P(theta|y) = frac{ P(y | theta) P(theta) }{ P(y) }
$$

and then assume there is a rule that you can condition every factor on some other variable $x$ (see rule below),
giving
$$
P(theta|y,x) = frac{ P(y | theta,x) P(theta|x) }{ P(y|x) }
$$

and lastly assume that $P(theta|x) = P(theta)$.
But here I have not seen a rule that allows
$$
text{if} quad p(A) = P(B)P(C)cdots quadtext{then}quad p(A|X) = P(B|X)P(C|X)cdots
$$

Does such a rule exist?



What is the right approach?










share|cite|improve this question









$endgroup$




I have seen the general form of posterior for a regression $y = f(x)$ defined as
$$
P(theta|y,x) = frac{ P(y | x, theta) P(theta) }{ P(y|x) }
$$



I would like to know how to arrive at this form, starting from Bayes rule and the laws of probability.



The approach I tried is to write Bayes theorem notated as $p(theta|v) = frac{ p(v|theta) p(theta) }{ p(v) }$ and then try subsituting something for $v$.



Approach A. With $v rightarrow y|x$, this gives
$$
" P(theta|y|x) = frac{ P(y|x | theta) P(theta) }{ P(y|x) } "
$$

and then if there is a rule that $a|b|c rightarrow a|b,c$ it gives the result.
However I have not seen such a rule. Does it exist?



Approach B. Start with $v rightarrow y$ giving
$$
P(theta|y) = frac{ P(y | theta) P(theta) }{ P(y) }
$$

and then assume there is a rule that you can condition every factor on some other variable $x$ (see rule below),
giving
$$
P(theta|y,x) = frac{ P(y | theta,x) P(theta|x) }{ P(y|x) }
$$

and lastly assume that $P(theta|x) = P(theta)$.
But here I have not seen a rule that allows
$$
text{if} quad p(A) = P(B)P(C)cdots quadtext{then}quad p(A|X) = P(B|X)P(C|X)cdots
$$

Does such a rule exist?



What is the right approach?







probability bayesian






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 2 at 5:30









basicideabasicidea

383




383








  • 3




    $begingroup$
    To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
    $endgroup$
    – Xi'an
    Jan 2 at 7:53














  • 3




    $begingroup$
    To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
    $endgroup$
    – Xi'an
    Jan 2 at 7:53








3




3




$begingroup$
To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
$endgroup$
– Xi'an
Jan 2 at 7:53




$begingroup$
To write that $nu=y|x$ does not make sense: $y$ is a random variable that has both a marginal distribution (if irrelevant here) and a conditional distribution given the random variable $x$. The notation $P(y|x|theta)$ does not make sense either.
$endgroup$
– Xi'an
Jan 2 at 7:53










2 Answers
2






active

oldest

votes


















6












$begingroup$

begin{align*}
P(theta mid y,x) &= frac{P(theta, y,x)}{P(y,x)} tag{defn. condtl. prob} \
&= frac{P(y mid theta, x)P(theta mid x)P(x)}{P(y mid x)P(x)} tag{defn. condtl. prob}\
&= frac{P(y mid theta, x)P(theta mid x)}{P(y mid x)} tag{cancellation}\
&= frac{ P(y | x, theta) P(theta) }{ P(y|x) } tag{indep.}
end{align*}






share|cite|improve this answer









$endgroup$





















    3












    $begingroup$

    Your initial idea is correct, but you should have used $x,y$ as $v$. Then $p(v)=p(x,y)=p(y|x)p(x)$, and:



    $$
    p(thetavert v)=p(thetavert x,y)
    =frac{p(vverttheta)p(theta)}{p(v)}
    =frac{p(yvert x,theta)p(xverttheta)p(theta)}{p(yvert x)p(x)}=frac{p(yvert x,theta)p(theta)}{p(yvert x)}
    $$



    Where we used the fact that $p(xverttheta)=p(x)$






    share|cite|improve this answer











    $endgroup$













      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',
      autoActivateHeartbeat: false,
      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%2f385239%2fhow-to-derive-the-form-of-the-posterior-for-regression%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6












      $begingroup$

      begin{align*}
      P(theta mid y,x) &= frac{P(theta, y,x)}{P(y,x)} tag{defn. condtl. prob} \
      &= frac{P(y mid theta, x)P(theta mid x)P(x)}{P(y mid x)P(x)} tag{defn. condtl. prob}\
      &= frac{P(y mid theta, x)P(theta mid x)}{P(y mid x)} tag{cancellation}\
      &= frac{ P(y | x, theta) P(theta) }{ P(y|x) } tag{indep.}
      end{align*}






      share|cite|improve this answer









      $endgroup$


















        6












        $begingroup$

        begin{align*}
        P(theta mid y,x) &= frac{P(theta, y,x)}{P(y,x)} tag{defn. condtl. prob} \
        &= frac{P(y mid theta, x)P(theta mid x)P(x)}{P(y mid x)P(x)} tag{defn. condtl. prob}\
        &= frac{P(y mid theta, x)P(theta mid x)}{P(y mid x)} tag{cancellation}\
        &= frac{ P(y | x, theta) P(theta) }{ P(y|x) } tag{indep.}
        end{align*}






        share|cite|improve this answer









        $endgroup$
















          6












          6








          6





          $begingroup$

          begin{align*}
          P(theta mid y,x) &= frac{P(theta, y,x)}{P(y,x)} tag{defn. condtl. prob} \
          &= frac{P(y mid theta, x)P(theta mid x)P(x)}{P(y mid x)P(x)} tag{defn. condtl. prob}\
          &= frac{P(y mid theta, x)P(theta mid x)}{P(y mid x)} tag{cancellation}\
          &= frac{ P(y | x, theta) P(theta) }{ P(y|x) } tag{indep.}
          end{align*}






          share|cite|improve this answer









          $endgroup$



          begin{align*}
          P(theta mid y,x) &= frac{P(theta, y,x)}{P(y,x)} tag{defn. condtl. prob} \
          &= frac{P(y mid theta, x)P(theta mid x)P(x)}{P(y mid x)P(x)} tag{defn. condtl. prob}\
          &= frac{P(y mid theta, x)P(theta mid x)}{P(y mid x)} tag{cancellation}\
          &= frac{ P(y | x, theta) P(theta) }{ P(y|x) } tag{indep.}
          end{align*}







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Jan 2 at 5:37









          TaylorTaylor

          11.8k11945




          11.8k11945

























              3












              $begingroup$

              Your initial idea is correct, but you should have used $x,y$ as $v$. Then $p(v)=p(x,y)=p(y|x)p(x)$, and:



              $$
              p(thetavert v)=p(thetavert x,y)
              =frac{p(vverttheta)p(theta)}{p(v)}
              =frac{p(yvert x,theta)p(xverttheta)p(theta)}{p(yvert x)p(x)}=frac{p(yvert x,theta)p(theta)}{p(yvert x)}
              $$



              Where we used the fact that $p(xverttheta)=p(x)$






              share|cite|improve this answer











              $endgroup$


















                3












                $begingroup$

                Your initial idea is correct, but you should have used $x,y$ as $v$. Then $p(v)=p(x,y)=p(y|x)p(x)$, and:



                $$
                p(thetavert v)=p(thetavert x,y)
                =frac{p(vverttheta)p(theta)}{p(v)}
                =frac{p(yvert x,theta)p(xverttheta)p(theta)}{p(yvert x)p(x)}=frac{p(yvert x,theta)p(theta)}{p(yvert x)}
                $$



                Where we used the fact that $p(xverttheta)=p(x)$






                share|cite|improve this answer











                $endgroup$
















                  3












                  3








                  3





                  $begingroup$

                  Your initial idea is correct, but you should have used $x,y$ as $v$. Then $p(v)=p(x,y)=p(y|x)p(x)$, and:



                  $$
                  p(thetavert v)=p(thetavert x,y)
                  =frac{p(vverttheta)p(theta)}{p(v)}
                  =frac{p(yvert x,theta)p(xverttheta)p(theta)}{p(yvert x)p(x)}=frac{p(yvert x,theta)p(theta)}{p(yvert x)}
                  $$



                  Where we used the fact that $p(xverttheta)=p(x)$






                  share|cite|improve this answer











                  $endgroup$



                  Your initial idea is correct, but you should have used $x,y$ as $v$. Then $p(v)=p(x,y)=p(y|x)p(x)$, and:



                  $$
                  p(thetavert v)=p(thetavert x,y)
                  =frac{p(vverttheta)p(theta)}{p(v)}
                  =frac{p(yvert x,theta)p(xverttheta)p(theta)}{p(yvert x)p(x)}=frac{p(yvert x,theta)p(theta)}{p(yvert x)}
                  $$



                  Where we used the fact that $p(xverttheta)=p(x)$







                  share|cite|improve this answer














                  share|cite|improve this answer



                  share|cite|improve this answer








                  edited Jan 2 at 8:16

























                  answered Jan 2 at 8:04









                  BlackBearBlackBear

                  1616




                  1616






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Cross Validated!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f385239%2fhow-to-derive-the-form-of-the-posterior-for-regression%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How do I know what Microsoft account the skydrive app is syncing to?

                      Grease: Live!

                      When does type information flow backwards in C++?