Announcement

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

  • McFadden R2

    Dears,
    I want to find the McFadden R2 for Mixed logit model, any help?
    One more question, why do I have McFadden R2 much lower than McFadden when I use R software (multinomial logit model)?
    Thanks

  • #2
    You are mixing two things. Mixed effects logit (melogit command in Stata) is random-effects logit whereas mlogit is multinomial logit. If your interest is in the latter, use the right estimator which reports McFadden's Pseudo R2.

    Comment


    • #3
      Thanks Andrew Musau for your reply. Could you please give me more details about what you mean.

      Comment


      • #4
        Unless I misunderstand your question, are you asking how to obtain McFadden's Pseudo R2 after estimating a multinomial logit model? If so, my suggestion is to use mlogit not melogit.


        [ME] melogit -- Multilevel mixed-effects logistic regression
        (View complete PDF manual entry)


        Syntax

        melogit depvar fe_equation [|| re_equation] [|| re_equation ...] [, options]

        where the syntax of fe_equation is

        [indepvars] [if] [in] [weight] [, fe_options]

        and the syntax of re_equation is one of the following:

        for random coefficients and intercepts

        levelvar: [varlist] [, re_options]

        for random effects among the values of a factor variable in a crossed-effects model
        [R] mlogit -- Multinomial (polytomous) logistic regression
        (View complete PDF manual entry)


        Syntax

        mlogit depvar [indepvars] [if] [in] [weight] [, options]

        options Description
        ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        Main
        noconstant suppress constant term
        baseoutcome(#) value of depvar that will be the base outcome
        constraints(constraints) apply specified linear constraints

        SE/Robust
        vce(vcetype) vcetype may be oim, robust, cluster clustvar, bootstrap, or jackknife

        Reporting
        level(#) set confidence level; default is level(95)
        rrr report relative-risk ratios
        nocnsreport do not display constraints
        display_options control columns and column formats, row spacing, line width, display of omitted variables and base and empty cells, and factor-variable labeling

        Maximization
        maximize_options control the maximization process; seldom used

        collinear keep collinear variables
        coeflegend display legend instead of statistics
        ----------------------------------------------------------------------------------------------------------
        See

        Code:
        help mlogit
        help melogit

        Comment


        • #5
          Thanks for your clarification. why should I use the base outcome in Stata (i.e. both constant and coefficients are set to zero of the base outcome). I want to find the parameters of all alternatives. The results should be alternative specific and one of the outcome has zero intercept (only the intercept), am I right?
          More question, how can I obtain the McFadden's Pseudo R2 for Mixed Logit model? I obtained it in R, but how can I find it in Stata?

          Comment


          • #6
            why should I use the base outcome in Stata (i.e. both constant and coefficients are set to zero of the base outcome). I want to find the parameters of all alternatives. The results should be alternative specific and one of the outcome has zero intercept (only the intercept), am I right?
            Maybe you are thinking about the marginal effects which do not depend on the base category. See

            Code:
            help mlogit_postestimation
            More question, how can I obtain the McFadden's Pseudo R2 for Mixed Logit model? I obtained it in R, but how can I find it in Stata?
            The concept of R2 is difficult for mixed effects models. If they are implementations in R, then they are not universally accepted and are just suggestions from one or two people. See #6 of the following thread where I provide a link that discusses the matter https://www.statalist.org/forums/for...unning-xtmixed. I see that I also need to make a correction.
            Last edited by Andrew Musau; 04 May 2020, 18:35.

            Comment


            • #7
              Thank you very much. You mean I can use the margins instead, very interesting!.

              Should I include the unchosen alternatives in the analysis, like in the panel-data when I run multinomial logit model?
              and what should I do if I have very low Mcfadden R2 like 0.02 and 0.06?

              Comment


              • #8
                Thank you very much. You mean I can use the margins instead, very interesting!.
                Here is an example where the base category is rep78=3, but I can subsequently use margins to compute the average marginal effect of each regressor on the probability of each of the outcomes (including the base).

                Code:
                sysuse auto, clear
                mlogit rep78 mpg displ
                margins, dydx(*) predict(outcome(1)) predict(outcome(2)) ///
                predict(outcome(3)) predict(outcome(4)) predict(outcome(5))
                Res.:

                Code:
                . mlogit rep78 mpg displ
                
                Iteration 0:   log likelihood = -93.692061  
                Iteration 1:   log likelihood = -84.527865  
                Iteration 2:   log likelihood = -82.573765  
                Iteration 3:   log likelihood = -82.282101  
                Iteration 4:   log likelihood = -82.278743  
                Iteration 5:   log likelihood =  -82.27874  
                
                Multinomial logistic regression                 Number of obs     =         69
                                                                LR chi2(8)        =      22.83
                                                                Prob > chi2       =     0.0036
                Log likelihood =  -82.27874                     Pseudo R2         =     0.1218
                
                ------------------------------------------------------------------------------
                       rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                1            |
                         mpg |  -.0021573   .2104309    -0.01   0.992    -.4145942    .4102797
                displacement |  -.0052312   .0126927    -0.41   0.680    -.0301085    .0196461
                       _cons |  -1.566574   6.429681    -0.24   0.808    -14.16852    11.03537
                -------------+----------------------------------------------------------------
                2            |
                         mpg |   .0150954   .1235325     0.12   0.903    -.2270239    .2572147
                displacement |   .0020254   .0063719     0.32   0.751    -.0104634    .0145142
                       _cons |   -2.09099   3.664348    -0.57   0.568    -9.272981    5.091001
                -------------+----------------------------------------------------------------
                3            |  (base outcome)
                -------------+----------------------------------------------------------------
                4            |
                         mpg |   .0070871   .0883698     0.08   0.936    -.1661146    .1802888
                displacement |  -.0066993   .0053435    -1.25   0.210    -.0171723    .0037737
                       _cons |    .704788   2.704785     0.26   0.794    -4.596493    6.006069
                -------------+----------------------------------------------------------------
                5            |
                         mpg |   .0808328   .0983973     0.82   0.411    -.1120224    .2736879
                displacement |  -.0231922   .0119692    -1.94   0.053    -.0466514    .0002671
                       _cons |   .6527964   3.545047     0.18   0.854    -6.295367     7.60096
                ------------------------------------------------------------------------------
                
                .
                . margins, dydx(*) predict(outcome(1)) predict(outcome(2)) predict(outcome(3)) predict(outcome(4)) predict(outcome(5))
                
                Average marginal effects                        Number of obs     =         69
                Model VCE    : OIM
                
                dy/dx w.r.t. : mpg displacement
                1._predict   : Pr(rep78==1), predict(outcome(1))
                2._predict   : Pr(rep78==2), predict(outcome(2))
                3._predict   : Pr(rep78==3), predict(outcome(3))
                4._predict   : Pr(rep78==4), predict(outcome(4))
                5._predict   : Pr(rep78==5), predict(outcome(5))
                
                ------------------------------------------------------------------------------
                             |            Delta-method
                             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                mpg          |
                    _predict |
                          1  |  -.0005117   .0056718    -0.09   0.928    -.0116282    .0106049
                          2  |   .0005468   .0115176     0.05   0.962    -.0220273    .0231209
                          3  |   -.004905   .0163699    -0.30   0.764    -.0369894    .0271794
                          4  |  -.0026643   .0141136    -0.19   0.850    -.0303265    .0249978
                          5  |   .0075342   .0079805     0.94   0.345    -.0081074    .0231758
                -------------+----------------------------------------------------------------
                displacement |
                    _predict |
                          1  |  -1.28e-06   .0003301    -0.00   0.997    -.0006483    .0006457
                          2  |   .0006224   .0006012     1.04   0.301     -.000556    .0018007
                          3  |   .0016077   .0009552     1.68   0.092    -.0002645    .0034798
                          4  |  -.0002394    .000956    -0.25   0.802    -.0021131    .0016343
                          5  |  -.0019893   .0010984    -1.81   0.070    -.0041421    .0001635
                ------------------------------------------------------------------------------
                Should I include the unchosen alternatives in the analysis, like in the panel-data when I run multinomial logit model?
                and what should I do if I have very low Mcfadden R2 like 0.02 and 0.06?
                If an alternative is not chosen, then it means that it drops out of your model. Don't bother about the Pseudo R2, low values are very common.

                Comment


                • #9
                  Thank you very much. if I have insignificant variables in any alternative, should I keep them in the model or remove them because the model will give low accuracy in predication (p>>0.05)?

                  Comment


                  • #10
                    That is nothing that I would recommend. You choose your variables based on theory (or past studies) and live with the results. Some people use significance, but I am not one of them.

                    Comment


                    • #11
                      Thank you very much for your answers

                      Comment

                      Working...
                      X