marginal density of $|X|$











up vote
1
down vote

favorite












I have a continuous random variable $X$ whose distribution is conditioned on another discrete random variable $S$. The conditional density function of $X$ is




  • $f_{X|S}(x|1) = alpha e^{-alpha x}, x geq 0$

  • $f_{X|S}(x|-1) = beta e^{beta x}, x leq 0$


I can see that when $S=1$, $X sim Exp(alpha)$ with $alpha >0$ and when $S=-1$, $-X sim Exp(beta)$ with $beta >0$. That is, $S$ is the sign of $X$.



I then define $Z = |X|$ and I have to calculate $mathbb{P}(S=1|Z=z)$. I know that this is the posterior probability of $S$ and I can use the Bayes rule for the case of a discrete unknown and continuous observation. The chosen formula is:
$$p_{S|Z}(1|z)= frac{p_S(1)f_{Z|S}(z|1)}{f_Z(z)}$$
and I know from the prior of $S$ that $p_S(1) = p$.



My approach to calculate $f_{Z|S}(z|1)$ would be to consider that, if I know that $S=1$ therefore $Z = X$ and $f_{Z|S}(z|1) = f_{X|S}(x|1)$. What I don't understand is how to come out with the marginal of $Z$. The marginal of $X$ is:





  • $p cdot alpha e^{-alpha x}$ when $x geq 0$


  • $(1-p) cdot beta e^{beta x}$ when $x leq 0$


and my idea here is that the marginal of $Z$ is $p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{beta z}$ since the $|X|$ mirrors $-X$ for the negative part, but I get a bit lost at this point.



EDIT: I also thought that, since $f_{X|S}(x|-1) = beta e^{beta x}$ then $f_{Z|S}(z|-1) = beta e^{-beta x}$, therefore
$$f_Z(z) = p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{-beta z}$$
but I don't know whether this is correct.










share|cite|improve this question




























    up vote
    1
    down vote

    favorite












    I have a continuous random variable $X$ whose distribution is conditioned on another discrete random variable $S$. The conditional density function of $X$ is




    • $f_{X|S}(x|1) = alpha e^{-alpha x}, x geq 0$

    • $f_{X|S}(x|-1) = beta e^{beta x}, x leq 0$


    I can see that when $S=1$, $X sim Exp(alpha)$ with $alpha >0$ and when $S=-1$, $-X sim Exp(beta)$ with $beta >0$. That is, $S$ is the sign of $X$.



    I then define $Z = |X|$ and I have to calculate $mathbb{P}(S=1|Z=z)$. I know that this is the posterior probability of $S$ and I can use the Bayes rule for the case of a discrete unknown and continuous observation. The chosen formula is:
    $$p_{S|Z}(1|z)= frac{p_S(1)f_{Z|S}(z|1)}{f_Z(z)}$$
    and I know from the prior of $S$ that $p_S(1) = p$.



    My approach to calculate $f_{Z|S}(z|1)$ would be to consider that, if I know that $S=1$ therefore $Z = X$ and $f_{Z|S}(z|1) = f_{X|S}(x|1)$. What I don't understand is how to come out with the marginal of $Z$. The marginal of $X$ is:





    • $p cdot alpha e^{-alpha x}$ when $x geq 0$


    • $(1-p) cdot beta e^{beta x}$ when $x leq 0$


    and my idea here is that the marginal of $Z$ is $p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{beta z}$ since the $|X|$ mirrors $-X$ for the negative part, but I get a bit lost at this point.



    EDIT: I also thought that, since $f_{X|S}(x|-1) = beta e^{beta x}$ then $f_{Z|S}(z|-1) = beta e^{-beta x}$, therefore
    $$f_Z(z) = p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{-beta z}$$
    but I don't know whether this is correct.










    share|cite|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a continuous random variable $X$ whose distribution is conditioned on another discrete random variable $S$. The conditional density function of $X$ is




      • $f_{X|S}(x|1) = alpha e^{-alpha x}, x geq 0$

      • $f_{X|S}(x|-1) = beta e^{beta x}, x leq 0$


      I can see that when $S=1$, $X sim Exp(alpha)$ with $alpha >0$ and when $S=-1$, $-X sim Exp(beta)$ with $beta >0$. That is, $S$ is the sign of $X$.



      I then define $Z = |X|$ and I have to calculate $mathbb{P}(S=1|Z=z)$. I know that this is the posterior probability of $S$ and I can use the Bayes rule for the case of a discrete unknown and continuous observation. The chosen formula is:
      $$p_{S|Z}(1|z)= frac{p_S(1)f_{Z|S}(z|1)}{f_Z(z)}$$
      and I know from the prior of $S$ that $p_S(1) = p$.



      My approach to calculate $f_{Z|S}(z|1)$ would be to consider that, if I know that $S=1$ therefore $Z = X$ and $f_{Z|S}(z|1) = f_{X|S}(x|1)$. What I don't understand is how to come out with the marginal of $Z$. The marginal of $X$ is:





      • $p cdot alpha e^{-alpha x}$ when $x geq 0$


      • $(1-p) cdot beta e^{beta x}$ when $x leq 0$


      and my idea here is that the marginal of $Z$ is $p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{beta z}$ since the $|X|$ mirrors $-X$ for the negative part, but I get a bit lost at this point.



      EDIT: I also thought that, since $f_{X|S}(x|-1) = beta e^{beta x}$ then $f_{Z|S}(z|-1) = beta e^{-beta x}$, therefore
      $$f_Z(z) = p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{-beta z}$$
      but I don't know whether this is correct.










      share|cite|improve this question















      I have a continuous random variable $X$ whose distribution is conditioned on another discrete random variable $S$. The conditional density function of $X$ is




      • $f_{X|S}(x|1) = alpha e^{-alpha x}, x geq 0$

      • $f_{X|S}(x|-1) = beta e^{beta x}, x leq 0$


      I can see that when $S=1$, $X sim Exp(alpha)$ with $alpha >0$ and when $S=-1$, $-X sim Exp(beta)$ with $beta >0$. That is, $S$ is the sign of $X$.



      I then define $Z = |X|$ and I have to calculate $mathbb{P}(S=1|Z=z)$. I know that this is the posterior probability of $S$ and I can use the Bayes rule for the case of a discrete unknown and continuous observation. The chosen formula is:
      $$p_{S|Z}(1|z)= frac{p_S(1)f_{Z|S}(z|1)}{f_Z(z)}$$
      and I know from the prior of $S$ that $p_S(1) = p$.



      My approach to calculate $f_{Z|S}(z|1)$ would be to consider that, if I know that $S=1$ therefore $Z = X$ and $f_{Z|S}(z|1) = f_{X|S}(x|1)$. What I don't understand is how to come out with the marginal of $Z$. The marginal of $X$ is:





      • $p cdot alpha e^{-alpha x}$ when $x geq 0$


      • $(1-p) cdot beta e^{beta x}$ when $x leq 0$


      and my idea here is that the marginal of $Z$ is $p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{beta z}$ since the $|X|$ mirrors $-X$ for the negative part, but I get a bit lost at this point.



      EDIT: I also thought that, since $f_{X|S}(x|-1) = beta e^{beta x}$ then $f_{Z|S}(z|-1) = beta e^{-beta x}$, therefore
      $$f_Z(z) = p cdot alpha e^{-alpha z} + (1-p) cdot beta e^{-beta z}$$
      but I don't know whether this is correct.







      probability-distributions bayes-theorem






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 18 at 10:38

























      asked Nov 18 at 10:31









      Mattia Paterna

      1086




      1086






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          For $z ge 0,$
          $$begin{align*}
          Pr[Z le z] &= Pr[-z le X le z] \
          &= Pr[-z le X < 0 mid S = -1]Pr[S = -1] + Pr[0 le X le z mid S = 1]Pr[S = 1] \
          &= (1 - e^{beta (-z)})(1-p) + (1 - e^{-alpha z})p.
          end{align*}$$



          Therefore,
          $$f_Z(z) = p alpha e^{-alpha z} + (1-p) beta e^{-beta z}.$$






          share|cite|improve this answer




























            up vote
            1
            down vote













            Yes your thoughts are correct.



            Assuming $P(S=1)=p=1-P(S=-1)$,



            we have for all $zge 0$,



            begin{align}
            P(Zle z)=P(|X|le z)&=P(|X|le zmid S=1)P(S=1)+P(|X|le zmid S=-1)P(S=-1)
            \&=P(Xle zmid S=1)p+P(-Xle zmid S=-1)(1-p)
            \&=pF_{Xmid S=1}(z)+(1-p)F_{-Xmid S=-1}(z)
            end{align}



            , where $F$ is the distribution function.



            So the density of $Z$ is



            begin{align}
            f_Z(z)&=pf_{Xmid S=1}(z)+(1-p)f_{-Xmid S=-1}(z)
            \&=palpha e^{-alpha z}mathbf1_{zge0}+(1-p)beta e^{-beta z}mathbf1_{zge0}
            \&=left[palpha e^{-alpha z}+(1-p)beta e^{-beta z}right]mathbf1_{zge0}
            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: "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: 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%2f3003359%2fmarginal-density-of-x%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








              up vote
              1
              down vote



              accepted










              For $z ge 0,$
              $$begin{align*}
              Pr[Z le z] &= Pr[-z le X le z] \
              &= Pr[-z le X < 0 mid S = -1]Pr[S = -1] + Pr[0 le X le z mid S = 1]Pr[S = 1] \
              &= (1 - e^{beta (-z)})(1-p) + (1 - e^{-alpha z})p.
              end{align*}$$



              Therefore,
              $$f_Z(z) = p alpha e^{-alpha z} + (1-p) beta e^{-beta z}.$$






              share|cite|improve this answer

























                up vote
                1
                down vote



                accepted










                For $z ge 0,$
                $$begin{align*}
                Pr[Z le z] &= Pr[-z le X le z] \
                &= Pr[-z le X < 0 mid S = -1]Pr[S = -1] + Pr[0 le X le z mid S = 1]Pr[S = 1] \
                &= (1 - e^{beta (-z)})(1-p) + (1 - e^{-alpha z})p.
                end{align*}$$



                Therefore,
                $$f_Z(z) = p alpha e^{-alpha z} + (1-p) beta e^{-beta z}.$$






                share|cite|improve this answer























                  up vote
                  1
                  down vote



                  accepted







                  up vote
                  1
                  down vote



                  accepted






                  For $z ge 0,$
                  $$begin{align*}
                  Pr[Z le z] &= Pr[-z le X le z] \
                  &= Pr[-z le X < 0 mid S = -1]Pr[S = -1] + Pr[0 le X le z mid S = 1]Pr[S = 1] \
                  &= (1 - e^{beta (-z)})(1-p) + (1 - e^{-alpha z})p.
                  end{align*}$$



                  Therefore,
                  $$f_Z(z) = p alpha e^{-alpha z} + (1-p) beta e^{-beta z}.$$






                  share|cite|improve this answer












                  For $z ge 0,$
                  $$begin{align*}
                  Pr[Z le z] &= Pr[-z le X le z] \
                  &= Pr[-z le X < 0 mid S = -1]Pr[S = -1] + Pr[0 le X le z mid S = 1]Pr[S = 1] \
                  &= (1 - e^{beta (-z)})(1-p) + (1 - e^{-alpha z})p.
                  end{align*}$$



                  Therefore,
                  $$f_Z(z) = p alpha e^{-alpha z} + (1-p) beta e^{-beta z}.$$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Nov 18 at 11:05









                  heropup

                  62.1k65998




                  62.1k65998






















                      up vote
                      1
                      down vote













                      Yes your thoughts are correct.



                      Assuming $P(S=1)=p=1-P(S=-1)$,



                      we have for all $zge 0$,



                      begin{align}
                      P(Zle z)=P(|X|le z)&=P(|X|le zmid S=1)P(S=1)+P(|X|le zmid S=-1)P(S=-1)
                      \&=P(Xle zmid S=1)p+P(-Xle zmid S=-1)(1-p)
                      \&=pF_{Xmid S=1}(z)+(1-p)F_{-Xmid S=-1}(z)
                      end{align}



                      , where $F$ is the distribution function.



                      So the density of $Z$ is



                      begin{align}
                      f_Z(z)&=pf_{Xmid S=1}(z)+(1-p)f_{-Xmid S=-1}(z)
                      \&=palpha e^{-alpha z}mathbf1_{zge0}+(1-p)beta e^{-beta z}mathbf1_{zge0}
                      \&=left[palpha e^{-alpha z}+(1-p)beta e^{-beta z}right]mathbf1_{zge0}
                      end{align}






                      share|cite|improve this answer

























                        up vote
                        1
                        down vote













                        Yes your thoughts are correct.



                        Assuming $P(S=1)=p=1-P(S=-1)$,



                        we have for all $zge 0$,



                        begin{align}
                        P(Zle z)=P(|X|le z)&=P(|X|le zmid S=1)P(S=1)+P(|X|le zmid S=-1)P(S=-1)
                        \&=P(Xle zmid S=1)p+P(-Xle zmid S=-1)(1-p)
                        \&=pF_{Xmid S=1}(z)+(1-p)F_{-Xmid S=-1}(z)
                        end{align}



                        , where $F$ is the distribution function.



                        So the density of $Z$ is



                        begin{align}
                        f_Z(z)&=pf_{Xmid S=1}(z)+(1-p)f_{-Xmid S=-1}(z)
                        \&=palpha e^{-alpha z}mathbf1_{zge0}+(1-p)beta e^{-beta z}mathbf1_{zge0}
                        \&=left[palpha e^{-alpha z}+(1-p)beta e^{-beta z}right]mathbf1_{zge0}
                        end{align}






                        share|cite|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          Yes your thoughts are correct.



                          Assuming $P(S=1)=p=1-P(S=-1)$,



                          we have for all $zge 0$,



                          begin{align}
                          P(Zle z)=P(|X|le z)&=P(|X|le zmid S=1)P(S=1)+P(|X|le zmid S=-1)P(S=-1)
                          \&=P(Xle zmid S=1)p+P(-Xle zmid S=-1)(1-p)
                          \&=pF_{Xmid S=1}(z)+(1-p)F_{-Xmid S=-1}(z)
                          end{align}



                          , where $F$ is the distribution function.



                          So the density of $Z$ is



                          begin{align}
                          f_Z(z)&=pf_{Xmid S=1}(z)+(1-p)f_{-Xmid S=-1}(z)
                          \&=palpha e^{-alpha z}mathbf1_{zge0}+(1-p)beta e^{-beta z}mathbf1_{zge0}
                          \&=left[palpha e^{-alpha z}+(1-p)beta e^{-beta z}right]mathbf1_{zge0}
                          end{align}






                          share|cite|improve this answer












                          Yes your thoughts are correct.



                          Assuming $P(S=1)=p=1-P(S=-1)$,



                          we have for all $zge 0$,



                          begin{align}
                          P(Zle z)=P(|X|le z)&=P(|X|le zmid S=1)P(S=1)+P(|X|le zmid S=-1)P(S=-1)
                          \&=P(Xle zmid S=1)p+P(-Xle zmid S=-1)(1-p)
                          \&=pF_{Xmid S=1}(z)+(1-p)F_{-Xmid S=-1}(z)
                          end{align}



                          , where $F$ is the distribution function.



                          So the density of $Z$ is



                          begin{align}
                          f_Z(z)&=pf_{Xmid S=1}(z)+(1-p)f_{-Xmid S=-1}(z)
                          \&=palpha e^{-alpha z}mathbf1_{zge0}+(1-p)beta e^{-beta z}mathbf1_{zge0}
                          \&=left[palpha e^{-alpha z}+(1-p)beta e^{-beta z}right]mathbf1_{zge0}
                          end{align}







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Nov 18 at 11:04









                          StubbornAtom

                          4,92411137




                          4,92411137






























                              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.





                              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%2fmath.stackexchange.com%2fquestions%2f3003359%2fmarginal-density-of-x%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

                              QoS: MAC-Priority for clients behind a repeater

                              Ивакино (Тотемский район)

                              Can't locate Autom4te/ChannelDefs.pm in @INC (when it definitely is there)