Likelihood modification in Metropolis Hastings ratio for transformed parameter












5












$begingroup$


I want to use MH to get samples from $p(theta mid y) approx p(y mid theta) p(theta)$. Let's assume $theta$ is heavily constrained and I transform $theta$ to $f(theta)$ so I can sample from an unconstrained space.



The new posterior becomes $p(f(theta) mid y) approx p(y mid f(theta) ) p(f(theta)) ,times, |det(J_{f^{-1}}(y)) |$. Note that I only changed the prior term (Pushforward measure) and left the likelihood term unchanged as it is a probability distribution on $y$, not on $theta$.



(1) My question now is: can I - in the Metropolis Hastings acceptance ratio - just evaluate



$$frac{p(y mid theta^star) }{ p(y mid theta) } ,times, frac{p(f(theta^star)) mid det{ J_{f^{-1}}( theta^star)} mid }{ p(f(theta)) mid det{ J_{f^{-1}}( theta )} mid }$$



? This term makes me nervous, because I transformed theta, evaluate the pdf of the transformed prior, but then transform it back and evaluate the likelihood of the parameter in the original space. However, I cannot evaluate the first term of this equation:



$$frac{p(y mid f(theta^star)) }{ p(y mid f(theta)) } ,times, frac{p(f(theta^star)) leftlvert det{ J_{f^{-1}}( theta^star)} rightrvert }{ p(f(theta)) leftlvert det{ J_{f^{-1}}( theta )} rightrvert }.$$



I could somehow reverse engineer this problem, i.e. define priors on $f(theta)$ and then map $f(theta)$ to $theta$. The Jacobian of the inverse transform then becomes the Jacobian of the transform of my original problem. That way I could evaluate all terms. However, I originally wanted to give some meaning to my priors for $theta$, not for some unconstrained $f(theta)$.




EDIT: Problem solved and clarified - thank you, I should have seen this myself! Please also see
linked stackexchange thread to this post for further
clarification.











share|cite|improve this question











$endgroup$

















    5












    $begingroup$


    I want to use MH to get samples from $p(theta mid y) approx p(y mid theta) p(theta)$. Let's assume $theta$ is heavily constrained and I transform $theta$ to $f(theta)$ so I can sample from an unconstrained space.



    The new posterior becomes $p(f(theta) mid y) approx p(y mid f(theta) ) p(f(theta)) ,times, |det(J_{f^{-1}}(y)) |$. Note that I only changed the prior term (Pushforward measure) and left the likelihood term unchanged as it is a probability distribution on $y$, not on $theta$.



    (1) My question now is: can I - in the Metropolis Hastings acceptance ratio - just evaluate



    $$frac{p(y mid theta^star) }{ p(y mid theta) } ,times, frac{p(f(theta^star)) mid det{ J_{f^{-1}}( theta^star)} mid }{ p(f(theta)) mid det{ J_{f^{-1}}( theta )} mid }$$



    ? This term makes me nervous, because I transformed theta, evaluate the pdf of the transformed prior, but then transform it back and evaluate the likelihood of the parameter in the original space. However, I cannot evaluate the first term of this equation:



    $$frac{p(y mid f(theta^star)) }{ p(y mid f(theta)) } ,times, frac{p(f(theta^star)) leftlvert det{ J_{f^{-1}}( theta^star)} rightrvert }{ p(f(theta)) leftlvert det{ J_{f^{-1}}( theta )} rightrvert }.$$



    I could somehow reverse engineer this problem, i.e. define priors on $f(theta)$ and then map $f(theta)$ to $theta$. The Jacobian of the inverse transform then becomes the Jacobian of the transform of my original problem. That way I could evaluate all terms. However, I originally wanted to give some meaning to my priors for $theta$, not for some unconstrained $f(theta)$.




    EDIT: Problem solved and clarified - thank you, I should have seen this myself! Please also see
    linked stackexchange thread to this post for further
    clarification.











    share|cite|improve this question











    $endgroup$















      5












      5








      5


      3



      $begingroup$


      I want to use MH to get samples from $p(theta mid y) approx p(y mid theta) p(theta)$. Let's assume $theta$ is heavily constrained and I transform $theta$ to $f(theta)$ so I can sample from an unconstrained space.



      The new posterior becomes $p(f(theta) mid y) approx p(y mid f(theta) ) p(f(theta)) ,times, |det(J_{f^{-1}}(y)) |$. Note that I only changed the prior term (Pushforward measure) and left the likelihood term unchanged as it is a probability distribution on $y$, not on $theta$.



      (1) My question now is: can I - in the Metropolis Hastings acceptance ratio - just evaluate



      $$frac{p(y mid theta^star) }{ p(y mid theta) } ,times, frac{p(f(theta^star)) mid det{ J_{f^{-1}}( theta^star)} mid }{ p(f(theta)) mid det{ J_{f^{-1}}( theta )} mid }$$



      ? This term makes me nervous, because I transformed theta, evaluate the pdf of the transformed prior, but then transform it back and evaluate the likelihood of the parameter in the original space. However, I cannot evaluate the first term of this equation:



      $$frac{p(y mid f(theta^star)) }{ p(y mid f(theta)) } ,times, frac{p(f(theta^star)) leftlvert det{ J_{f^{-1}}( theta^star)} rightrvert }{ p(f(theta)) leftlvert det{ J_{f^{-1}}( theta )} rightrvert }.$$



      I could somehow reverse engineer this problem, i.e. define priors on $f(theta)$ and then map $f(theta)$ to $theta$. The Jacobian of the inverse transform then becomes the Jacobian of the transform of my original problem. That way I could evaluate all terms. However, I originally wanted to give some meaning to my priors for $theta$, not for some unconstrained $f(theta)$.




      EDIT: Problem solved and clarified - thank you, I should have seen this myself! Please also see
      linked stackexchange thread to this post for further
      clarification.











      share|cite|improve this question











      $endgroup$




      I want to use MH to get samples from $p(theta mid y) approx p(y mid theta) p(theta)$. Let's assume $theta$ is heavily constrained and I transform $theta$ to $f(theta)$ so I can sample from an unconstrained space.



      The new posterior becomes $p(f(theta) mid y) approx p(y mid f(theta) ) p(f(theta)) ,times, |det(J_{f^{-1}}(y)) |$. Note that I only changed the prior term (Pushforward measure) and left the likelihood term unchanged as it is a probability distribution on $y$, not on $theta$.



      (1) My question now is: can I - in the Metropolis Hastings acceptance ratio - just evaluate



      $$frac{p(y mid theta^star) }{ p(y mid theta) } ,times, frac{p(f(theta^star)) mid det{ J_{f^{-1}}( theta^star)} mid }{ p(f(theta)) mid det{ J_{f^{-1}}( theta )} mid }$$



      ? This term makes me nervous, because I transformed theta, evaluate the pdf of the transformed prior, but then transform it back and evaluate the likelihood of the parameter in the original space. However, I cannot evaluate the first term of this equation:



      $$frac{p(y mid f(theta^star)) }{ p(y mid f(theta)) } ,times, frac{p(f(theta^star)) leftlvert det{ J_{f^{-1}}( theta^star)} rightrvert }{ p(f(theta)) leftlvert det{ J_{f^{-1}}( theta )} rightrvert }.$$



      I could somehow reverse engineer this problem, i.e. define priors on $f(theta)$ and then map $f(theta)$ to $theta$. The Jacobian of the inverse transform then becomes the Jacobian of the transform of my original problem. That way I could evaluate all terms. However, I originally wanted to give some meaning to my priors for $theta$, not for some unconstrained $f(theta)$.




      EDIT: Problem solved and clarified - thank you, I should have seen this myself! Please also see
      linked stackexchange thread to this post for further
      clarification.








      sampling mcmc likelihood likelihood-ratio metropolis-hastings






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Feb 16 at 14:52









      Xi'an

      57.3k895360




      57.3k895360










      asked Feb 15 at 14:37









      MrVengeanZeMrVengeanZe

      285




      285






















          1 Answer
          1






          active

          oldest

          votes


















          5












          $begingroup$

          You should notice that what you denote $p(y|f(theta))$ is actually the same as $p(y|theta)$ [if you overlook the terrible abuse of notations]. As you mention, changing the parameterisation does not modify the density of the random variable at the observed value $y$ and there is no Jacobian associated with that part.



          With proper notations, if
          begin{align*}
          theta &sim pi(theta)qquadqquad&text{prior}\
          y|theta &sim f(y|theta)qquadqquad&text{sampling}\
          xi &= h(theta) qquadqquad&text{reparameterisation}\
          dfrac{text{d}theta}{text{d}xi}(xi) &= J(xi)qquadqquad&text{Jacobian}\
          y|xi &sim g(y|xi)qquadqquad&text{reparameterised density}\
          xi^{(t+1)}|xi^{(t)} &sim q(xi^{(t+1)}|xi^{(t)}) qquadqquad&text{proposal}
          end{align*}

          the Metropolis-Hastings ratio associated with the proposal $xi'sim q(xi'|xi)$ in the $xi$ parameterisation is
          $$
          underbrace{dfrac{pi(theta(xi'))J(xi')}{pi(theta(xi))J(xi)}}_text{ratio of priors}times
          underbrace{dfrac{f(y|theta(xi')}{f(y|theta(xi))}}_text{likelihood ratio}times
          underbrace{dfrac{q(xi|xi')}{q(xi'|xi)}}_text{proposal ratio}
          $$

          which also writes as
          $$dfrac{pi(h^{-1}(xi'))J(xi')}{pi(h^{-1}(xi))J(xi)}times
          dfrac{g(y|xi')}{g(y|xi)}times
          dfrac{q(xi|xi')}{q(xi'|xi)}
          $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            Dear Xi'an, thank you for your answer! I will mark it as solved!
            $endgroup$
            – MrVengeanZe
            Feb 15 at 16:12











          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%2f392687%2flikelihood-modification-in-metropolis-hastings-ratio-for-transformed-parameter%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









          5












          $begingroup$

          You should notice that what you denote $p(y|f(theta))$ is actually the same as $p(y|theta)$ [if you overlook the terrible abuse of notations]. As you mention, changing the parameterisation does not modify the density of the random variable at the observed value $y$ and there is no Jacobian associated with that part.



          With proper notations, if
          begin{align*}
          theta &sim pi(theta)qquadqquad&text{prior}\
          y|theta &sim f(y|theta)qquadqquad&text{sampling}\
          xi &= h(theta) qquadqquad&text{reparameterisation}\
          dfrac{text{d}theta}{text{d}xi}(xi) &= J(xi)qquadqquad&text{Jacobian}\
          y|xi &sim g(y|xi)qquadqquad&text{reparameterised density}\
          xi^{(t+1)}|xi^{(t)} &sim q(xi^{(t+1)}|xi^{(t)}) qquadqquad&text{proposal}
          end{align*}

          the Metropolis-Hastings ratio associated with the proposal $xi'sim q(xi'|xi)$ in the $xi$ parameterisation is
          $$
          underbrace{dfrac{pi(theta(xi'))J(xi')}{pi(theta(xi))J(xi)}}_text{ratio of priors}times
          underbrace{dfrac{f(y|theta(xi')}{f(y|theta(xi))}}_text{likelihood ratio}times
          underbrace{dfrac{q(xi|xi')}{q(xi'|xi)}}_text{proposal ratio}
          $$

          which also writes as
          $$dfrac{pi(h^{-1}(xi'))J(xi')}{pi(h^{-1}(xi))J(xi)}times
          dfrac{g(y|xi')}{g(y|xi)}times
          dfrac{q(xi|xi')}{q(xi'|xi)}
          $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            Dear Xi'an, thank you for your answer! I will mark it as solved!
            $endgroup$
            – MrVengeanZe
            Feb 15 at 16:12
















          5












          $begingroup$

          You should notice that what you denote $p(y|f(theta))$ is actually the same as $p(y|theta)$ [if you overlook the terrible abuse of notations]. As you mention, changing the parameterisation does not modify the density of the random variable at the observed value $y$ and there is no Jacobian associated with that part.



          With proper notations, if
          begin{align*}
          theta &sim pi(theta)qquadqquad&text{prior}\
          y|theta &sim f(y|theta)qquadqquad&text{sampling}\
          xi &= h(theta) qquadqquad&text{reparameterisation}\
          dfrac{text{d}theta}{text{d}xi}(xi) &= J(xi)qquadqquad&text{Jacobian}\
          y|xi &sim g(y|xi)qquadqquad&text{reparameterised density}\
          xi^{(t+1)}|xi^{(t)} &sim q(xi^{(t+1)}|xi^{(t)}) qquadqquad&text{proposal}
          end{align*}

          the Metropolis-Hastings ratio associated with the proposal $xi'sim q(xi'|xi)$ in the $xi$ parameterisation is
          $$
          underbrace{dfrac{pi(theta(xi'))J(xi')}{pi(theta(xi))J(xi)}}_text{ratio of priors}times
          underbrace{dfrac{f(y|theta(xi')}{f(y|theta(xi))}}_text{likelihood ratio}times
          underbrace{dfrac{q(xi|xi')}{q(xi'|xi)}}_text{proposal ratio}
          $$

          which also writes as
          $$dfrac{pi(h^{-1}(xi'))J(xi')}{pi(h^{-1}(xi))J(xi)}times
          dfrac{g(y|xi')}{g(y|xi)}times
          dfrac{q(xi|xi')}{q(xi'|xi)}
          $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            Dear Xi'an, thank you for your answer! I will mark it as solved!
            $endgroup$
            – MrVengeanZe
            Feb 15 at 16:12














          5












          5








          5





          $begingroup$

          You should notice that what you denote $p(y|f(theta))$ is actually the same as $p(y|theta)$ [if you overlook the terrible abuse of notations]. As you mention, changing the parameterisation does not modify the density of the random variable at the observed value $y$ and there is no Jacobian associated with that part.



          With proper notations, if
          begin{align*}
          theta &sim pi(theta)qquadqquad&text{prior}\
          y|theta &sim f(y|theta)qquadqquad&text{sampling}\
          xi &= h(theta) qquadqquad&text{reparameterisation}\
          dfrac{text{d}theta}{text{d}xi}(xi) &= J(xi)qquadqquad&text{Jacobian}\
          y|xi &sim g(y|xi)qquadqquad&text{reparameterised density}\
          xi^{(t+1)}|xi^{(t)} &sim q(xi^{(t+1)}|xi^{(t)}) qquadqquad&text{proposal}
          end{align*}

          the Metropolis-Hastings ratio associated with the proposal $xi'sim q(xi'|xi)$ in the $xi$ parameterisation is
          $$
          underbrace{dfrac{pi(theta(xi'))J(xi')}{pi(theta(xi))J(xi)}}_text{ratio of priors}times
          underbrace{dfrac{f(y|theta(xi')}{f(y|theta(xi))}}_text{likelihood ratio}times
          underbrace{dfrac{q(xi|xi')}{q(xi'|xi)}}_text{proposal ratio}
          $$

          which also writes as
          $$dfrac{pi(h^{-1}(xi'))J(xi')}{pi(h^{-1}(xi))J(xi)}times
          dfrac{g(y|xi')}{g(y|xi)}times
          dfrac{q(xi|xi')}{q(xi'|xi)}
          $$






          share|cite|improve this answer











          $endgroup$



          You should notice that what you denote $p(y|f(theta))$ is actually the same as $p(y|theta)$ [if you overlook the terrible abuse of notations]. As you mention, changing the parameterisation does not modify the density of the random variable at the observed value $y$ and there is no Jacobian associated with that part.



          With proper notations, if
          begin{align*}
          theta &sim pi(theta)qquadqquad&text{prior}\
          y|theta &sim f(y|theta)qquadqquad&text{sampling}\
          xi &= h(theta) qquadqquad&text{reparameterisation}\
          dfrac{text{d}theta}{text{d}xi}(xi) &= J(xi)qquadqquad&text{Jacobian}\
          y|xi &sim g(y|xi)qquadqquad&text{reparameterised density}\
          xi^{(t+1)}|xi^{(t)} &sim q(xi^{(t+1)}|xi^{(t)}) qquadqquad&text{proposal}
          end{align*}

          the Metropolis-Hastings ratio associated with the proposal $xi'sim q(xi'|xi)$ in the $xi$ parameterisation is
          $$
          underbrace{dfrac{pi(theta(xi'))J(xi')}{pi(theta(xi))J(xi)}}_text{ratio of priors}times
          underbrace{dfrac{f(y|theta(xi')}{f(y|theta(xi))}}_text{likelihood ratio}times
          underbrace{dfrac{q(xi|xi')}{q(xi'|xi)}}_text{proposal ratio}
          $$

          which also writes as
          $$dfrac{pi(h^{-1}(xi'))J(xi')}{pi(h^{-1}(xi))J(xi)}times
          dfrac{g(y|xi')}{g(y|xi)}times
          dfrac{q(xi|xi')}{q(xi'|xi)}
          $$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Feb 15 at 15:52

























          answered Feb 15 at 14:52









          Xi'anXi'an

          57.3k895360




          57.3k895360








          • 1




            $begingroup$
            Dear Xi'an, thank you for your answer! I will mark it as solved!
            $endgroup$
            – MrVengeanZe
            Feb 15 at 16:12














          • 1




            $begingroup$
            Dear Xi'an, thank you for your answer! I will mark it as solved!
            $endgroup$
            – MrVengeanZe
            Feb 15 at 16:12








          1




          1




          $begingroup$
          Dear Xi'an, thank you for your answer! I will mark it as solved!
          $endgroup$
          – MrVengeanZe
          Feb 15 at 16:12




          $begingroup$
          Dear Xi'an, thank you for your answer! I will mark it as solved!
          $endgroup$
          – MrVengeanZe
          Feb 15 at 16:12


















          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%2f392687%2flikelihood-modification-in-metropolis-hastings-ratio-for-transformed-parameter%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

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?