Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multinomial Logistic Regression using Stata 12

    Hi,
    I am doing a mlogit regression in stata 12. After running the regression, i continued with relative risk ratio followed by margins. The margins command is giving me the following results. Also when i plot graphs using the margins plot command, I am not getting good results. Whats wrong with my regression? Please help. Many TIA.



    Click image for larger version

Name:	Picture1.png
Views:	1
Size:	113.5 KB
ID:	1529219
    Click image for larger version

Name:	Below_20_000 graph.png
Views:	2
Size:	26.7 KB
ID:	1529220

    Last edited by Rohini Pillai; 18 Dec 2019, 12:56.

  • #2
    Welcome to Statalist.

    You've left out several details, including the mlogit command and output and the marginsplot command. I'd particularly like to see the latter, as your graph makes no sense to me. I wonder if there were intervening commands you are not showing us.

    When showing code and output, use code tags. See pt. 12 of the Statalist FAQ.

    When working with multiple outcome commands, I find the mtable command (part of spost13) helps immensely. This is especially true for people condemned to using older versions of Stata which did not handle multiple outcomes as well. See

    https://www3.nd.edu/~rwilliam/stats3/Margins05.pdf

    Do -findit spost13_ado- to find and install the programs.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thank you so much sir. Below I copy all the commands in the order in which I have run. I am using a MacBook air and hence couldn't upgrade to a newer version of stata due to unavailability in my research institute. Marginsplot command I gave was
      marginsplot, name(Below_20_000)
      after the margins command referred in the first post. This was when i got the graph.
      Attached Files

      Comment


      • #4
        I am repeating the margins command and the margins plot graph as to see it in the same order in which I performed operations. Looking forward to your valuable comments.
        Attached Files

        Comment


        • #5
          You still aren’t showing the command that created the graph. And now the graph seems to be unrelated to the margins command immediately before it.

          You should show the margins command, its output, the graphing command, and the graph itself. Everything should be run in the correct order, don’t cut and paste between different sections.

          My guess is that either the graphing command is wrong or there is some intermediate step you are failing to show us.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          Stata Version: 17.0 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Marginsplot command I gave was
            marginsplot, name(Below_20_000)

            Comment


            • #7
              Sorry, the graph makes no sense to me. Why would the y access range from 4 to -4? It should range from 0 to 1. Further I don't understand why you are basically getting a flat line.

              Maybe there is some bug in Stata 12. Make sure your version is up to date, Try running

              update all

              Whenever somebody has a problem running an ancient version of Stata the first thing I like to do is run the code on a newer version of Stata. I don't want to spend hours on a problem that Stata fixed years ago.

              If that doesn't help see if you can run this in a later version of Stata.

              You could also use dataex to create an extract of your data. Make sure the extract replicates your problem. Do -findit dataex-. If you can provide a suitable extract along with your exact code maybe others can find the problem.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              Stata Version: 17.0 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Thank you so much sir. These are the commands in the order i ran and the plots i got. If its a problem with the version of stata, i will try uploading the newer version but if its anything related to my regression, please help.
                Attached Files

                Comment


                • #9
                  my version of stata is stata 14 and not 12. Sorry about the mis info.

                  Comment


                  • #10
                    This seems fine now. The marginsplots match up with the margins commands. The plot for outcome 3 looks weird because all the adjusted predictions are nearly 0. Hence it looks like a flat line but it really isn't.

                    I don't know why the original marginsplot for occupation looked so weird but my guess is there was a mistake in the commands somewhere.
                    -------------------------------------------
                    Richard Williams, Notre Dame Dept of Sociology
                    Stata Version: 17.0 MP (2 processor)

                    EMAIL: [email protected]
                    WWW: https://www3.nd.edu/~rwilliam

                    Comment


                    • #11
                      Thank you so much Sir. If there is any other alternate command i can use for outcome 3 or to extrapolate the margins plot so that its not a straight-line please do let me know. Many thanks for your time.

                      Comment


                      • #12
                        I don't think you can do much for outcome 3 because it basically is a straight line. You can narrow the y axis and make it not look so straight, but the results will be the same.
                        -------------------------------------------
                        Richard Williams, Notre Dame Dept of Sociology
                        Stata Version: 17.0 MP (2 processor)

                        EMAIL: [email protected]
                        WWW: https://www3.nd.edu/~rwilliam

                        Comment


                        • #13
                          Also, I repeat my advice to check out https://www3.nd.edu/~rwilliam/stats3/Margins05.pdf. Especially with multiple outcome commands, spost13 can make things easier to do and look nicer.
                          -------------------------------------------
                          Richard Williams, Notre Dame Dept of Sociology
                          Stata Version: 17.0 MP (2 processor)

                          EMAIL: [email protected]
                          WWW: https://www3.nd.edu/~rwilliam

                          Comment


                          • #14
                            Richard Williams it personally worries me that margins produces estimates of the confidence intervals that are outside the [0,1] range. I understand this is because they are done under the normality assumption, but given that the explained variable is not normal, but rather multinomial, maybe she's better off bootstrapping the predictions, and using confidence intervals based on the quantiles.
                            Alfonso Sanchez-Penalver

                            Comment


                            • #15
                              Alfonso Sánchez-Peñalver , your CI concern may be addressed with Jeff Pittblado's transform_margins command:

                              https://stats.stackexchange.com/ques...rgins-in-stata

                              It works after logit. I don't know about mlogit.
                              -------------------------------------------
                              Richard Williams, Notre Dame Dept of Sociology
                              Stata Version: 17.0 MP (2 processor)

                              EMAIL: [email protected]
                              WWW: https://www3.nd.edu/~rwilliam

                              Comment

                              Working...
                              X