Announcement

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

  • #16
    Dan:
    welcome to the list.
    Set aside that I know nothing about the topic you're interested in, I would recommend you to start a new thread, so that some expert my chime in without sorting it out from other posts.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #17
      @ #14: I may or may not be able to figure out what went wrong here, but at the very least I would need to see the exact command you used and the complete exact response you got from Stata (not just the error message but the complete output). As the problem often lies in little details, it is crucial that what you show be exactly what happened. So you should have your computer copy the command and output directly from Stata's Results window or your output log, and paste it into a code block here on the forum and post it without editing it in any way. We'll see if there are clues to the problem.

      Comment


      • #18
        Dear Clyde.. Thank you for your instruction as I did not know how to post the codes in the right way. Please find the below the command and the results. In fact, I would to get the Robust P values corrected for country level clustering please. If I remove L., the results will come through but in this case, it is telling me that calculation of robust standard errors failed. Thank you




        Code:
         xtprobit IsBoardBusy L.( IO_Domestic LogTotalAsset SalesGrowthRate), vce (cluster CountryID)
        
        Fitting comparison model:
        
        Iteration 0:   log pseudolikelihood = -1210.6626 
        Iteration 1:   log pseudolikelihood = -1171.5292 
        Iteration 2:   log pseudolikelihood = -1171.4702 
        Iteration 3:   log pseudolikelihood = -1171.4702 
        
        Fitting full model:
        
        rho =  0.0     log pseudolikelihood = -1171.4702
        rho =  0.1     log pseudolikelihood = -1059.9241
        rho =  0.2     log pseudolikelihood = -987.40649
        rho =  0.3     log pseudolikelihood = -935.58979
        rho =  0.4     log pseudolikelihood = -896.73467
        rho =  0.5     log pseudolikelihood = -867.04383
        rho =  0.6     log pseudolikelihood = -844.55899
        rho =  0.7     log pseudolikelihood = -828.47452
        rho =  0.8     log pseudolikelihood = -820.82793
        
        Iteration 0:   log pseudolikelihood = -828.96656 
        Iteration 1:   log pseudolikelihood = -795.56996 
        Iteration 2:   log pseudolikelihood = -795.07298 
        Iteration 3:   log pseudolikelihood = -795.07298  (backed up)
        Iteration 4:   log pseudolikelihood = -795.05097 
        Iteration 5:   log pseudolikelihood = -795.05097 
        
        Calculating robust standard errors:
        calculation of robust standard errors failed
        r(198);

        Comment


        • #19
          Badar:
          might the -xtprobit, re and the robust VCE estimator-
          tech note under -xtprobit- entry, page 379 of Stata .pdf manual shed some light on the clustered SE issue?
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #20
            Well, in this case the output really offers no clue to the problem (or at least none that I recognize). I don't know what the problem is here. Here are a couple of suggestions you might try, though I don't know if they will turn up anything.

            1. Does the same thing happen if you use -xtlogit- instead of -xtprobit-?

            2. Run something simple like -regress IsBoardBusy L.(IO_Domestic LogTotalAsset SalesGrowthRate), vce(cluster CountryID)-. If that produces results, then look at -tab CountryID if e(sample)- to see if there is something odd about the clustering, perhaps some clusters with only 1 observation, or CountryIDs that don't show up at all that should. I'm kind of grasping at straws here, but the idea is to look at the clusters themselves in the estimation sample.

            3. Although robust standard error calculation should, according to the manuals, work just fine when there are time series operators, you could also try
            Code:
            foreach v  of varlist IO_domestic LogTotalAsset SalesGrowthRate {
                 gen l_`v' = L.`v'
            }
            xtprobit IsBoardBusy l_*, vce(cluster CountryID)
            That should produce the same problem, but you never know until you try. If this works where your original version with L.(varlist) didn't, you should contact Technical Support about a possible bug.

            Not sure what else to suggest. Sorry I can't be more helpful here. Maybe somebody else has an idea and will chime in.

            Comment


            • #21
              Thank you Carlo and Clyde for all your valuable advices.

              Clyde:
              I have tried your suggestions and it gave me the same outcomes when I use xtlogit instead. However, when I use regress command, it works fine and it gave me the result. please see below. I have also tab Country ID and it seems fine (please see the results below). If you have any more suggestions please let me know. Thank you all

              Code:
              reg IsBoardBusy L.( IO_Domestic LogTotalAsset SalesGrowthRate), vce (cluster CountryID)
              
              Linear regression                               Number of obs     =      2,016
                                                              F(3, 15)          =      17.27
                                                              Prob > F          =     0.0000
                                                              R-squared         =     0.0387
                                                              Root MSE          =     .44452
              
                                              (Std. Err. adjusted for 16 clusters in CountryID)
              ---------------------------------------------------------------------------------
                              |               Robust
                  IsBoardBusy |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ----------------+----------------------------------------------------------------
                  IO_Domestic |
                          L1. |  -.0008557   .0018286    -0.47   0.647    -.0047534    .0030419
                              |
                LogTotalAsset |
                          L1. |   .1565307    .026615     5.88   0.000      .099802    .2132593
                              |
              SalesGrowthRate |
                          L1. |   .0007614   .0370207     0.02   0.984    -.0781464    .0796692
                              |
                        _cons |  -.8027099   .1959062    -4.10   0.001    -1.220274   -.3851457
              ---------------------------------------------------------------------------------
              
              . tab CountryID
              
               Country ID |      Freq.     Percent        Cum.
              ------------+-----------------------------------
                        1 |        196        7.56        7.56
                        2 |         86        3.32       10.88
                        3 |        315       12.16       23.04
                        4 |         87        3.36       26.40
                        5 |        145        5.60       32.00
                        6 |        222        8.57       40.56
                        7 |         55        2.12       42.69
                        8 |        127        4.90       47.59
                        9 |         89        3.43       51.02
                       10 |        133        5.13       56.16
                       11 |        130        5.02       61.17
                       12 |        137        5.29       66.46
                       13 |        166        6.41       72.87
                       14 |        147        5.67       78.54
                       15 |         95        3.67       82.21
                       16 |        461       17.79      100.00
              ------------+-----------------------------------
                    Total |      2,591      100.00

              Comment


              • #22
                Well, assuming there are just those 16 CountryIDs in your data, that distribution of observations among clusters looks fine to me.

                Here's a thought: in earlier posts you -xtset- your data using CompanyID as the panel variable. Now you are asking for VCE clustered on CountryID. This is OK, provided that your CompanyIDs are nested in CountryID, i.e., no Company has observations involving more than one country. You can check that quickly:

                Code:
                by CompanyID (CountryID), sort: assert CountryID[1] == CountryID[_N]
                But I don't think that's the problem, because if I recall, Stata would give a specific error message referring to the need for the panel variable to be nested in the cluster variable.

                You might also look at the numbers of companies (your -xtset- panel variable) in each country: -tab CompanyID CountryID if e(sample)-. Maybe there is something odd going on there?

                I don't have any other ideas for troubleshooting this problem. Perhaps others do?

                Let me just add one final comment. Perhaps you are better off abandoning vce(cluster CountryID) anyway. You only have 16 countries. The cluster robust VCE is really not helpful unless the number of clusters is large. (And, in fact, it can actually produce worse results if the number of clusters is too small.) Experts disagree on how large is large enough, and there have been some theoretical and simulation based inquiries into the question of how many clusters you need. (You can find references on Google.) Since this isn't something I do very often, I don't remember much detail, and the references are not among those I keep handy. But I think you could make a credible case that with only 16 countries the use of the cluster robust VCE is not appropriate anyway. (Just to be clear, the number of clusters is not the reason you are encountering this Stata error message: I've seen Stata calculate cluster robust standard errors with just two clusters, even though pretty much everyone would agree that doing so makes no sense.

                Comment


                • #23
                  Dear Clyde- Thank you for your reply..I have checked the code you mentioned above and it seemed that data are ordered correctly. In fact, I am following another study where they use the same number of clusters.Actually this problem arise when I lag the explanatory variables, but when I remove (L.) from the command, Stata gave me normal results (please see below). Is there any other method I can lag my explanatory variables to overcome this issue please?. Thank you

                  Code:
                  . xtprobit IsBoardBusy ( IO_Domestic LogTotalAsset SalesGrowthRate), vce (cluster CountryID)
                  
                  Fitting comparison model:
                  
                  Iteration 0:   log pseudolikelihood = -1549.8546
                  Iteration 1:   log pseudolikelihood = -1495.3985
                  Iteration 2:   log pseudolikelihood = -1495.2946
                  Iteration 3:   log pseudolikelihood = -1495.2946
                  
                  Fitting full model:
                  
                  rho =  0.0     log pseudolikelihood = -1495.2946
                  rho =  0.1     log pseudolikelihood = -1330.7111
                  rho =  0.2     log pseudolikelihood = -1229.1386
                  rho =  0.3     log pseudolikelihood = -1158.4958
                  rho =  0.4     log pseudolikelihood = -1106.2864
                  rho =  0.5     log pseudolikelihood = -1066.6121
                  rho =  0.6     log pseudolikelihood = -1036.6159
                  rho =  0.7     log pseudolikelihood = -1015.5362
                  rho =  0.8     log pseudolikelihood = -1006.6245
                  
                  Iteration 0:   log pseudolikelihood = -1015.1227
                  Iteration 1:   log pseudolikelihood = -967.04715
                  Iteration 2:   log pseudolikelihood = -966.32236
                  Iteration 3:   log pseudolikelihood = -966.32236  (backed up)
                  Iteration 4:   log pseudolikelihood =   -966.203
                  Iteration 5:   log pseudolikelihood = -966.20299
                  
                  Calculating robust standard errors:
                  
                  Random-effects probit regression                Number of obs     =      2,591
                  Group variable: CompanyID                       Number of groups  =        523
                  
                  Random effects u_i ~ Gaussian                   Obs per group:
                                                                                min =          1
                                                                                avg =        5.0
                                                                                max =          7
                  
                  Integration method: mvaghermite                 Integration pts.  =         12
                  
                                                                  Wald chi2(3)      =      24.02
                  Log pseudolikelihood  = -966.20299              Prob > chi2       =     0.0000
                  
                                                  (Std. Err. adjusted for 16 clusters in CountryID)
                  ---------------------------------------------------------------------------------
                                  |               Robust
                      IsBoardBusy |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                  ----------------+----------------------------------------------------------------
                      IO_Domestic |  -.0022585     .00979    -0.23   0.818    -.0214466    .0169295
                    LogTotalAsset |   1.140965   .2435339     4.69   0.000     .6636478    1.618283
                  SalesGrowthRate |   .3757412   .2185285     1.72   0.086    -.0525668    .8040492
                            _cons |  -9.737505    1.80764    -5.39   0.000    -13.28041   -6.194596
                  ----------------+----------------------------------------------------------------
                         /lnsig2u |   1.843794   .2694345                      1.315712    2.371876
                  ----------------+----------------------------------------------------------------
                          sigma_u |   2.514055   .3386866                      1.930649    3.273756
                              rho |   .8633968   .0317778                      .7884675    .9146574
                  ---------------------------------------------------------------------------------
                  
                  .
                  Last edited by Badar Khalid; 09 Mar 2016, 14:40.

                  Comment


                  • #24
                    The code block in #20 does exactly that: it creates new variables that are equal to the lags of the originals and runs the analysis that way. Try it and see what happens. If everything goes through with that, then there is some kind of bug in the handling of the version with L.(...). If you get the same problem as before, then there is something about this data configuration that Stata isn't able to handle.

                    Comment


                    • #25
                      Thank you Clyde.. I have run the code in in #20 . However, I got the following result,
                      Code:
                       program error:  code follows on the same line as open brace
                      Can you please advice me how I can improve the code?. Thank you

                      Comment


                      • #26
                        Badar, this message is self explanatory. But I don't know why you're getting it. When I copy that code and paste it into the do-file editor, it comes out properly lined up, and when I run it on a made-up data set containing variables with that name, it works just fine. Perhaps you just typed all the code in without paying attention to spacing and line breaks. Those details matter a great deal in Stata, and when you are using code from others on this Forum (or, for that matter from any source) you should always copy/paste it rather than retyping it, to make sure you get all the details exactly the same as the original.

                        So, do what I did: copy the contents of the code block onto your computer's clipboard and paste it into Stat's do-file editor. Then inspect the code. The first line should begin with foreach and end with {. If there is something after the {, then position the cursor there and hit Enter to force a new line. The next line should contain the -gen- command and nothing else. The third line should consist of a } and nothing else. The fourth and final line should be the -xtprobit- command. (If it doesn't look like that either you did something wrong or your computer's copy/paste mechanism is not functioning properly.) That will run fine except for possibly producing the "calculation of robust standard errors failed" problem again. Whether it produces that problem again is, of course, what we are trying to find out with this little experiment.

                        Comment


                        • #27
                          Dear Clyde.. Thank you so much for your advice and for the code, I have tried the code in #20 and it worked fine now. I really appreciate all your follow up of my query.

                          Do you think then it is bug which prevent the old command with (L.)?.

                          Can you also advice me wether I need to write 1_ in front of each explanatory variable or just before the first one as follwos?. Thank you

                          Code:
                          xtprobit IsBoardBusy l_IO_Total LogTotalAsset SalesGrowthRate, vce (cluster CountryID)
                          Last edited by Badar Khalid; 09 Mar 2016, 16:05.

                          Comment


                          • #28
                            Can you also advice me wether I need to write 1_ in front of each explanatory variable or just before the first one as follwos?.
                            Yes. (Except it's letter l, not number 1.) The l_ is part of the variable name. It's different from the L. operator.

                            Do you think then it is bug which prevent the old command with (L.)?.
                            With the code from #20 having run with your data and produced usable results, then, yes, I would say that there is some kind of bug affecting the L.() version of the command. Since the same problem arose with -xtlogit- as with -xtprobit-, it seems to be some problem arising specifically from the combination of panel-data models, the use of L.() notation and the use of cluster robust vce. If you have time to report all of this to Stata technical support, I would urge you to do so. In principle one should be able to use these things all together without a problem. My instinct is that the bug is somewhere in the implementation of -robust-, but that's just a guess on my part.

                            Comment


                            • #29
                              Thank you Clyde for your clarification. I shall contact the technical team and I will check with them about this issue.

                              I also want to ask you, if I want to get the marginal effect estimates (evaluated at sample mean) of the probit panel, is the following command is right:

                              Code:
                               margins, dydx (l_IO_Total l_LogTotalAsset l_SalesGrowthRate), atmeans

                              Comment


                              • #30
                                Almost. The comma before atmeans is a syntax error--remove it. Otherwise, it looks right to me.

                                Comment

                                Working...
                                X