How to derive the form of the posterior for regression?












1














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



























    1














    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

























      1












      1








      1


      1





      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













      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 1 hour ago









      basicidea

      212




      212






















          1 Answer
          1






          active

          oldest

          votes


















          2














          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





















            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

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            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


























              2














              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
























                2












                2








                2






                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












                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 1 hour ago









                Taylor

                11.6k11745




                11.6k11745






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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.


                    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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido