Deriving the odds ratio of a 3-way interaction logistic regression model











up vote
2
down vote

favorite












Suppose a logistic regression model has three binary explanatory variables $x_1$, $x_2$ and $x_3$ used
to estimate the probability of success. This model includes all three main effects, the three $2$-
way interactions, and the one $3$-way interaction.



Derive the odds ratio to examine the odds of a success across two levels of one of the
explanatory variables, say $x_1$, and derive its variance.



I assume you start by:



$log(frac{pi}{1-pi}) = beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3$



and then taking exponetials on both sides:



$frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



However I am not sure how to proceed.










share|cite|improve this question




























    up vote
    2
    down vote

    favorite












    Suppose a logistic regression model has three binary explanatory variables $x_1$, $x_2$ and $x_3$ used
    to estimate the probability of success. This model includes all three main effects, the three $2$-
    way interactions, and the one $3$-way interaction.



    Derive the odds ratio to examine the odds of a success across two levels of one of the
    explanatory variables, say $x_1$, and derive its variance.



    I assume you start by:



    $log(frac{pi}{1-pi}) = beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3$



    and then taking exponetials on both sides:



    $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



    However I am not sure how to proceed.










    share|cite|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Suppose a logistic regression model has three binary explanatory variables $x_1$, $x_2$ and $x_3$ used
      to estimate the probability of success. This model includes all three main effects, the three $2$-
      way interactions, and the one $3$-way interaction.



      Derive the odds ratio to examine the odds of a success across two levels of one of the
      explanatory variables, say $x_1$, and derive its variance.



      I assume you start by:



      $log(frac{pi}{1-pi}) = beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3$



      and then taking exponetials on both sides:



      $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



      However I am not sure how to proceed.










      share|cite|improve this question















      Suppose a logistic regression model has three binary explanatory variables $x_1$, $x_2$ and $x_3$ used
      to estimate the probability of success. This model includes all three main effects, the three $2$-
      way interactions, and the one $3$-way interaction.



      Derive the odds ratio to examine the odds of a success across two levels of one of the
      explanatory variables, say $x_1$, and derive its variance.



      I assume you start by:



      $log(frac{pi}{1-pi}) = beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3$



      and then taking exponetials on both sides:



      $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



      However I am not sure how to proceed.







      probability statistics regression logistic-regression






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 24 at 6:49

























      asked Nov 21 at 3:24









      Alex Chavez

      440620




      440620






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.



          If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1



          from the step



          $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



          set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have



          $frac{pi}{1-pi} = e^{beta_1 + beta_2E(x_2) + beta_3E(x_3) +beta_4E(x_2) + beta_5E(x_3) + beta_6E(x_2)E(x_3) + beta_7E(x_2)E(x_3)}$



          when $x_1$ = 0



          $frac{pi}{1-pi} = e^{beta_2E(x_2) + beta_3E(x_3) + beta_6E(x_2)E(x_3) }$



          dividing the two, you get



          odds ratio = $ e^{beta_1 + beta_4E(x_2) + beta_5E(x_3) + beta_7E(x_2)E(x_3) }$



          As you can see, all the terms that don't contain the variable x1 simplifies.



          In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:



          odds ratio = $e^{(β_1)}$



          Keep in mind, this also ignores the interaction between variables.



          For the variance, you can derive it from the final equation using the variance of the coefficients



          Hope it helps



          Edit: edited for latex






          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%2f3007217%2fderiving-the-odds-ratio-of-a-3-way-interaction-logistic-regression-model%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








            up vote
            0
            down vote













            Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.



            If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1



            from the step



            $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



            set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have



            $frac{pi}{1-pi} = e^{beta_1 + beta_2E(x_2) + beta_3E(x_3) +beta_4E(x_2) + beta_5E(x_3) + beta_6E(x_2)E(x_3) + beta_7E(x_2)E(x_3)}$



            when $x_1$ = 0



            $frac{pi}{1-pi} = e^{beta_2E(x_2) + beta_3E(x_3) + beta_6E(x_2)E(x_3) }$



            dividing the two, you get



            odds ratio = $ e^{beta_1 + beta_4E(x_2) + beta_5E(x_3) + beta_7E(x_2)E(x_3) }$



            As you can see, all the terms that don't contain the variable x1 simplifies.



            In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:



            odds ratio = $e^{(β_1)}$



            Keep in mind, this also ignores the interaction between variables.



            For the variance, you can derive it from the final equation using the variance of the coefficients



            Hope it helps



            Edit: edited for latex






            share|cite|improve this answer



























              up vote
              0
              down vote













              Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.



              If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1



              from the step



              $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



              set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have



              $frac{pi}{1-pi} = e^{beta_1 + beta_2E(x_2) + beta_3E(x_3) +beta_4E(x_2) + beta_5E(x_3) + beta_6E(x_2)E(x_3) + beta_7E(x_2)E(x_3)}$



              when $x_1$ = 0



              $frac{pi}{1-pi} = e^{beta_2E(x_2) + beta_3E(x_3) + beta_6E(x_2)E(x_3) }$



              dividing the two, you get



              odds ratio = $ e^{beta_1 + beta_4E(x_2) + beta_5E(x_3) + beta_7E(x_2)E(x_3) }$



              As you can see, all the terms that don't contain the variable x1 simplifies.



              In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:



              odds ratio = $e^{(β_1)}$



              Keep in mind, this also ignores the interaction between variables.



              For the variance, you can derive it from the final equation using the variance of the coefficients



              Hope it helps



              Edit: edited for latex






              share|cite|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.



                If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1



                from the step



                $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



                set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have



                $frac{pi}{1-pi} = e^{beta_1 + beta_2E(x_2) + beta_3E(x_3) +beta_4E(x_2) + beta_5E(x_3) + beta_6E(x_2)E(x_3) + beta_7E(x_2)E(x_3)}$



                when $x_1$ = 0



                $frac{pi}{1-pi} = e^{beta_2E(x_2) + beta_3E(x_3) + beta_6E(x_2)E(x_3) }$



                dividing the two, you get



                odds ratio = $ e^{beta_1 + beta_4E(x_2) + beta_5E(x_3) + beta_7E(x_2)E(x_3) }$



                As you can see, all the terms that don't contain the variable x1 simplifies.



                In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:



                odds ratio = $e^{(β_1)}$



                Keep in mind, this also ignores the interaction between variables.



                For the variance, you can derive it from the final equation using the variance of the coefficients



                Hope it helps



                Edit: edited for latex






                share|cite|improve this answer














                Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.



                If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1



                from the step



                $frac{pi}{1-pi} = e^{beta_1x_1 + beta_2x_2 + beta_3x_3 +beta_4x_1x_2 + beta_5x_1x_3 + beta_6x_2x_3 + beta_7x_1x_2x_3}$



                set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have



                $frac{pi}{1-pi} = e^{beta_1 + beta_2E(x_2) + beta_3E(x_3) +beta_4E(x_2) + beta_5E(x_3) + beta_6E(x_2)E(x_3) + beta_7E(x_2)E(x_3)}$



                when $x_1$ = 0



                $frac{pi}{1-pi} = e^{beta_2E(x_2) + beta_3E(x_3) + beta_6E(x_2)E(x_3) }$



                dividing the two, you get



                odds ratio = $ e^{beta_1 + beta_4E(x_2) + beta_5E(x_3) + beta_7E(x_2)E(x_3) }$



                As you can see, all the terms that don't contain the variable x1 simplifies.



                In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:



                odds ratio = $e^{(β_1)}$



                Keep in mind, this also ignores the interaction between variables.



                For the variance, you can derive it from the final equation using the variance of the coefficients



                Hope it helps



                Edit: edited for latex







                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Nov 28 at 15:25

























                answered Nov 27 at 23:08









                Ofya

                4948




                4948






























                    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%2f3007217%2fderiving-the-odds-ratio-of-a-3-way-interaction-logistic-regression-model%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

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...