Analytical value of multivariate normal posterior












1












$begingroup$


Suppose I have the following Bayesian Network:



enter image description here



It's given by the following relations:
$$begin{aligned}X_1&sim mathcal N(mu, 1/sigma^2)\
forall k, 2leq kleq n: X_k|X_{k-1}&sim mathcal N(x_{k-1}, 1/lambda^2)\
forall i, 1leq ileq n: Z_i|X_i&simmathcal N(x_{i}, text I_i/delta^2)
end{aligned}$$



It is possible to find the expected value of $boldsymbol X|boldsymbol Z$ by minimising the following error function:



$$sum_{i=1}^ntext I_i(x_i-z_i)^2 + frac{delta^2}{lambda^2}sum_{i=2}^n(x_i-x_{i-1})^2 + frac{delta^2}{sigma^2}(x_1-mu)^2$$



(You can find the proof here.)



The solutions will necessarily follow these equalities:



$$begin{aligned}
hat x_1 &= frac{frac{delta^2}{lambda^2}hat x_2 + text I_1z_1 + frac{delta^2}{sigma^2}mu}{frac{delta^2}{lambda^2} + text I_1 + frac{delta^2}{sigma^2}} \
hat x_n &= frac{text I_nz_n + frac{delta^2}{sigma^2}x_{n-1}}{text I_n + frac{delta^2}{sigma^2}} \
forall i in {2, 3, ..., n-1}: hat x_i &= frac{frac{delta^2}{lambda^2}(hat x_{i + 1} + hat x_{i - 1}) + text I_iz_i}{2frac{delta^2}{lambda^2} + text I_i }
end{aligned}$$



It's possible to find $hat x_n$ by replacing $hat x_1$ in $hat x_2$ (and then $hat x_2$ will only depend on $hat x_3$), then replacing $hat x_2$ in $hat x_3$, and so on, until we reach $hat x_n$, at which point it's numbers all the way down and we have an actual value.



Is there an easier way to solve this, though? Or an implementation of this algorithm in R or something? I've been trying to think of an R implementation of this that doesn't consist of fully solving the optimisation problem and then taking the last component of the resulting vector, since that takes longer than I'd wish, and given that there's an "analytical" solution to the problem I'd hope to be able to figure out how to implement it.










share|cite|improve this question









$endgroup$

















    1












    $begingroup$


    Suppose I have the following Bayesian Network:



    enter image description here



    It's given by the following relations:
    $$begin{aligned}X_1&sim mathcal N(mu, 1/sigma^2)\
    forall k, 2leq kleq n: X_k|X_{k-1}&sim mathcal N(x_{k-1}, 1/lambda^2)\
    forall i, 1leq ileq n: Z_i|X_i&simmathcal N(x_{i}, text I_i/delta^2)
    end{aligned}$$



    It is possible to find the expected value of $boldsymbol X|boldsymbol Z$ by minimising the following error function:



    $$sum_{i=1}^ntext I_i(x_i-z_i)^2 + frac{delta^2}{lambda^2}sum_{i=2}^n(x_i-x_{i-1})^2 + frac{delta^2}{sigma^2}(x_1-mu)^2$$



    (You can find the proof here.)



    The solutions will necessarily follow these equalities:



    $$begin{aligned}
    hat x_1 &= frac{frac{delta^2}{lambda^2}hat x_2 + text I_1z_1 + frac{delta^2}{sigma^2}mu}{frac{delta^2}{lambda^2} + text I_1 + frac{delta^2}{sigma^2}} \
    hat x_n &= frac{text I_nz_n + frac{delta^2}{sigma^2}x_{n-1}}{text I_n + frac{delta^2}{sigma^2}} \
    forall i in {2, 3, ..., n-1}: hat x_i &= frac{frac{delta^2}{lambda^2}(hat x_{i + 1} + hat x_{i - 1}) + text I_iz_i}{2frac{delta^2}{lambda^2} + text I_i }
    end{aligned}$$



    It's possible to find $hat x_n$ by replacing $hat x_1$ in $hat x_2$ (and then $hat x_2$ will only depend on $hat x_3$), then replacing $hat x_2$ in $hat x_3$, and so on, until we reach $hat x_n$, at which point it's numbers all the way down and we have an actual value.



    Is there an easier way to solve this, though? Or an implementation of this algorithm in R or something? I've been trying to think of an R implementation of this that doesn't consist of fully solving the optimisation problem and then taking the last component of the resulting vector, since that takes longer than I'd wish, and given that there's an "analytical" solution to the problem I'd hope to be able to figure out how to implement it.










    share|cite|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      Suppose I have the following Bayesian Network:



      enter image description here



      It's given by the following relations:
      $$begin{aligned}X_1&sim mathcal N(mu, 1/sigma^2)\
      forall k, 2leq kleq n: X_k|X_{k-1}&sim mathcal N(x_{k-1}, 1/lambda^2)\
      forall i, 1leq ileq n: Z_i|X_i&simmathcal N(x_{i}, text I_i/delta^2)
      end{aligned}$$



      It is possible to find the expected value of $boldsymbol X|boldsymbol Z$ by minimising the following error function:



      $$sum_{i=1}^ntext I_i(x_i-z_i)^2 + frac{delta^2}{lambda^2}sum_{i=2}^n(x_i-x_{i-1})^2 + frac{delta^2}{sigma^2}(x_1-mu)^2$$



      (You can find the proof here.)



      The solutions will necessarily follow these equalities:



      $$begin{aligned}
      hat x_1 &= frac{frac{delta^2}{lambda^2}hat x_2 + text I_1z_1 + frac{delta^2}{sigma^2}mu}{frac{delta^2}{lambda^2} + text I_1 + frac{delta^2}{sigma^2}} \
      hat x_n &= frac{text I_nz_n + frac{delta^2}{sigma^2}x_{n-1}}{text I_n + frac{delta^2}{sigma^2}} \
      forall i in {2, 3, ..., n-1}: hat x_i &= frac{frac{delta^2}{lambda^2}(hat x_{i + 1} + hat x_{i - 1}) + text I_iz_i}{2frac{delta^2}{lambda^2} + text I_i }
      end{aligned}$$



      It's possible to find $hat x_n$ by replacing $hat x_1$ in $hat x_2$ (and then $hat x_2$ will only depend on $hat x_3$), then replacing $hat x_2$ in $hat x_3$, and so on, until we reach $hat x_n$, at which point it's numbers all the way down and we have an actual value.



      Is there an easier way to solve this, though? Or an implementation of this algorithm in R or something? I've been trying to think of an R implementation of this that doesn't consist of fully solving the optimisation problem and then taking the last component of the resulting vector, since that takes longer than I'd wish, and given that there's an "analytical" solution to the problem I'd hope to be able to figure out how to implement it.










      share|cite|improve this question









      $endgroup$




      Suppose I have the following Bayesian Network:



      enter image description here



      It's given by the following relations:
      $$begin{aligned}X_1&sim mathcal N(mu, 1/sigma^2)\
      forall k, 2leq kleq n: X_k|X_{k-1}&sim mathcal N(x_{k-1}, 1/lambda^2)\
      forall i, 1leq ileq n: Z_i|X_i&simmathcal N(x_{i}, text I_i/delta^2)
      end{aligned}$$



      It is possible to find the expected value of $boldsymbol X|boldsymbol Z$ by minimising the following error function:



      $$sum_{i=1}^ntext I_i(x_i-z_i)^2 + frac{delta^2}{lambda^2}sum_{i=2}^n(x_i-x_{i-1})^2 + frac{delta^2}{sigma^2}(x_1-mu)^2$$



      (You can find the proof here.)



      The solutions will necessarily follow these equalities:



      $$begin{aligned}
      hat x_1 &= frac{frac{delta^2}{lambda^2}hat x_2 + text I_1z_1 + frac{delta^2}{sigma^2}mu}{frac{delta^2}{lambda^2} + text I_1 + frac{delta^2}{sigma^2}} \
      hat x_n &= frac{text I_nz_n + frac{delta^2}{sigma^2}x_{n-1}}{text I_n + frac{delta^2}{sigma^2}} \
      forall i in {2, 3, ..., n-1}: hat x_i &= frac{frac{delta^2}{lambda^2}(hat x_{i + 1} + hat x_{i - 1}) + text I_iz_i}{2frac{delta^2}{lambda^2} + text I_i }
      end{aligned}$$



      It's possible to find $hat x_n$ by replacing $hat x_1$ in $hat x_2$ (and then $hat x_2$ will only depend on $hat x_3$), then replacing $hat x_2$ in $hat x_3$, and so on, until we reach $hat x_n$, at which point it's numbers all the way down and we have an actual value.



      Is there an easier way to solve this, though? Or an implementation of this algorithm in R or something? I've been trying to think of an R implementation of this that doesn't consist of fully solving the optimisation problem and then taking the last component of the resulting vector, since that takes longer than I'd wish, and given that there's an "analytical" solution to the problem I'd hope to be able to figure out how to implement it.







      probability-theory optimization kalman-filter






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 11 '18 at 20:33









      Pedro CarvalhoPedro Carvalho

      399215




      399215






















          0






          active

          oldest

          votes












          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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
          },
          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%2f3035779%2fanalytical-value-of-multivariate-normal-posterior%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • 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%2fmath.stackexchange.com%2fquestions%2f3035779%2fanalytical-value-of-multivariate-normal-posterior%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 to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents