Announcement

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

  • No Observations during Beta Regression

    Hi I have a relatively similar question as posted here (no observations in stata - Statalist), but I am hoping someone can explain to me why this error is occurring with my situation. I have a dataset with approximately 69 observations (below).

    When I attempt to perform a reverse selection for my beta regression model with "Adult_Res_ESBL" as outcome and other variables as predictors using "stepwise, pr(0.1): betareg Adult_Res_ESBL h_stand dairykern_stand beefkern_stand wildlife_res_stand if County == "B" & !missing(wildlife_res_stand) & !missing(SomeAccess) & !missing(MaxAccess) & !missing(FarmLivestock) & !missing(Import_YN) & !missing(Herd_Size) & !missing(H_CDL) & !missing(DairyKernMEAN) & !missing(BeefKernMEAN) & !missing(WWTPNEAR_DIST) & !missing(HospNEAR_DIST)", there is an output (output 1 below).

    However, when I remove "wildlife_res_stand" and "!missing(wildlife_res_stand), which should increase the number of observations because that is a relatively sparse field, I receive the error "no observations". Does anyone have any suggestions for how to handle this error?

    I spoke with my advisor who suggested investigating the estimation procedure for the betareg function but I have not found a great source to elucidate further.


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str1 County double Adult_Res_ESBL float(h_stand dairykern_stand beefkern_stand wildlife_res_stand)
    "A"    .010413787697006028  .56159365  -.18140635   -.9818244           .
    "A"    .005974910611648814 -.09779117   -.3410016  -.45496625 -.005848474
    ""                       .          .           .           .           .
    "A" .000057822612747190216   -.470439  -.07183883   -.0418575 -.006885073
    "A"   .0036042094159723773 -.28406972    .3102941    3.075861           .
    "B"                      .   .7205552  -.11922163    -.986141           .
    "B"  .00022276432368234018   .9445554    .8574577   -.6137585 -.006889232
    "B"              1.000e-08   .6004553   1.0196443   -.5914747           .
    "B"  3.708982802780827e-07  1.1435293    .7869495   -.6849468           .
    "B"    .007135803354753441   .6296864    .8292803   -.3441681           .
    "B"             .062500005  -.1996507    .9389117   -.7636957 -.006802789
    "B"              1.000e-08   .5087349    .9819379   -.5968383           .
    "B" 3.7890136054421768e-06   .4611996    .9197039   -.7507252 -.006872643
    "B"              1.000e-08 -.22933945    .6628096   2.2968295           .
    "B"   .0003074566310949159 -.09487648   1.1809835     3.21312  -.00464945
    "B"   .0029887946434567704   .4888917   1.3176657   -.8110185 -.004751146
    "B"   .0005411305411255411   .8257725    .5392841   1.3801568           .
    "B"    .014782311519594655   .5035158   1.1024483   -.4689167 -.006848556
    "B"    .017737082948682398  1.1652253   1.0457335  .028338427  -.00681396
    "B"    .004580790590548549   .9927385     .984697  -1.0385243 -.006602556
    "B" 1.8344914013904134e-06   .9777048    .7167819   -.5984433 -.004751146
    "B"    .005235043861799425    .960099    .9950309   -.3905323  .001405997
    "B"     .24620535714285713  1.3246374    .7331297   -.4059121           .
    "B"    .005636110188343995          .     .980153   -.3846744 -.006889236
    "B"    .033619452779111644          .   1.0396208   -.3802326           .
    "B"   .0007093311942153359   .6751089     .848569     .597278 -.006803065
    "B"    .004018496454552835   .6125379    1.055388   .25478962           .
    "B"     .01097638671973824   .6959932    .7467434   .22562805           .
    "B"    .014144964143657637          . -.013478243    -.167303 -.004751146
    "B"    .010644404460188935   .9238241     1.07795    -.722593    .0001037
    "B"    .005476997987663372   .7467261   1.1286021   -.7439111 -.004751146
    "B" .000024207154434712574  1.0240388    .4248944   -.6927644           .
    "B"  .00010984765253057938   1.012859    .7794555  -.02379079 -.004289746
    "B"  .00011574574074074074   .7049913    1.315886  -.19396158   .21196434
    "B"              1.000e-08   .9203275   1.0082839  -.26147956 -.006794166
    "B"   .0008313447129186602 -.14565544    .9048413   -.4282168           .
    "B"              1.000e-08   .3205093  -1.1409297  -.49929845           .
    "B"   .0015396875396825396   .9011276  -1.1414543  -.29631478 -.006875886
    "C"              1.000e-08  -.7825692  -1.1531996  -.26652265 -.006889232
    "C"    .019924242424242424  -.8993682  -1.1467012   -.3536408 -.003846266
    "C"    .026587301587301587  -.5596062  -1.1592528  -.18730263 -.006889232
    "C"              1.000e-08  -.5414124  -1.1442583   -.1663779 -.006889232
    "C"    .015000000000000001 -.47717065   -1.157569   -.3133174 -.006637148
    "C"    .006222222222222223  -.7813948  -1.1556836    .1185969 -.006889232
    "C"   .0004292929292929293 -.20039025   -1.152707  -.41068435 -.006881791
    "C"              1.000e-08  -.5994968  -1.1610153     .818488 -.006889232
    "C"     .02167674731182796 -1.1172055  -1.1540314    .7337947 -.006659773
    "C"              1.000e-08 -1.7957867  -1.1656958    .9133849 -.006889232
    "C"    .014798072660345524  -1.458521  -1.1176392      3.9049 -.006889232
    "C"    .000289669005556336  .04956792   -1.189643   -.3848584           .
    "C"              1.000e-08  .19768025   -1.187266    .6926791  .004169557
    "C"              1.000e-08 -2.3342626   -1.208055 -.001191989 -.005824755
    "C"    .005542388107088989  -1.506056  -1.1557913  -.20597467 -.005915749
    "C"    .031157191887083217  -2.842635  -1.1225733  -.18730263  .002405899
    "C"              1.000e-08 .017108921  -1.1408812   -.1663779 -.006848267
    "C"              1.000e-08          .  -1.1441882   -.3536408 -.006760196
    "C"              1.000e-08 -.17321014  -1.1225733    .7337947 -.006888193
    "C"   .0002470405731225297 -2.3817506  -1.1408812  -.26147956 -.006817623
    "C"  4.171666666666668e-06 -1.6386383   -1.144188  -.41068435 -.006764919
                           .          .           .           .           .
    end

  • #2
    Can you show the full code you used in the context of the dataex example you gave?

    Comment


    • #3
      Can you show the full code you used in the context of the dataex example you gave?

      Comment


      • #4
        Thanks for the data example.

        Your full code is not testable as it refers to variables not in your data example, but a simpler

        Code:
        betareg Adult_Res_ESBL h_stand dairykern_stand beefkern_stand wildlife_res_stand if County == "B"
        finds 17 observations and fits 6 parameters. I have to call that a real stretch. There's no magic number for how many data points are enough, but one rule of thumb says at least 10 data points for each parameter fitted.

        The extra condition

        Code:
        !missing(wildlife_res_stand) & !missing(SomeAccess) & !missing(MaxAccess) & !missing(FarmLivestock) & !missing(Import_YN) & !missing(Herd_Size) & !missing(H_CDL) & !missing(DairyKernMEAN) & !missing(BeefKernMEAN) & !missing(WWTPNEAR_DIST) & !missing(HospNEAR_DIST)
        won't make the data subset used any bigger and it appears to be making it smaller.

        I see no reason to doubt the betareg command (not function) here. The bad news is too few data chasing a complicated model.

        What's up with all those 1e-08, which look like a fudge to avoid observed zeros?

        Comment


        • #5
          I'm sorry all, I included variables in my code not pertinent to the data example. Please see below. Nick - your code was correct:

          Code:
           
           betareg Adult_Res_ESBL h_stand dairykern_stand beefkern_stand wildlife_res_stand if County == "B" & !missing(wildlife_res_stand) & !missing(SomeAccess) & !missing(MaxAccess) & !missing(FarmLivestock) & !missing(Import_YN) & !missing(Herd_Size) & !missing(H_CDL) & !missing(DairyKernMEAN) & !missing(BeefKernMEAN) & !missing(WWTPNEAR_DIST) & !missing(HospNEAR_DIST)
          The issue occurs when I remove "wildlife_res_stand" and "!missing(wildlife_res_stand)" from the model. The error is "no observations" when this happens. Nick, I understand your comment about too few data, but based on your comment would you agree that removing the "!missing(wildlife_res_stand)" condition and the wildlife variable should expand my observations? I do not understand why the 17 observations do not grow to what should be around n=26 (I believe) in this situation. If anything, shouldn't fewer data and fewer conditions result in "no observations" rather than the opposite? The reason maintaining observations is important to me is because I want to compare different models using bayesian information criteria.

          Lastly, yes, the very low proportions are to fudge zeros. I discussed this with a few folks in my department and they said it should be fine for these purposes, but I am happy to hear your input about handling 0s and 1s in beta regression.

          Comment


          • #6
            If wildlife_res_stand is a predictor in your model, then the observations used will be those with non-missing values on that variable (other constraints aside).
            Removing that predictor from the model but insisting if !missing(wildlife_res_stand) shouldselect precisely the same observations (same comment). I don't understand the "no observations" report:: unfortunately, you have, if I understand correctly, yet to give a combination of code and data that we can see leading to that report. Fudges of zero always leave me queasy, but one answer is some kind of sensitivity analysis in which you show that it doesn't matter what replacement value you use. Candidate replacements must be positive and less than the smallest positive amount observed.

            Comment


            • #7
              Hi Nick, thank you for the response. Regarding the restriction command, I actually do remove it from the code and that is when I receive the "no observations report". The full code in which I encounter an error is below:

              Code:
               
                betareg Adult_Res_ESBL h_stand dairykern_stand beefkern_stand if County == "B" & !missing(SomeAccess) & !missing(MaxAccess) & !missing(FarmLivestock) & !missing(Import_YN) & !missing(Herd_Size) & !missing(H_CDL) & !missing(DairyKernMEAN) & !missing(BeefKernMEAN) & !missing(WWTPNEAR_DIST) & !missing(HospNEAR_DIST)
              If folks are able to run the above code and not returned the "no observations" report, but I do, maybe this is a software issue. If this is the case, do you have any suggestions for where to find resources to learn how to trouble-shoot? Thank you for your patience.

              Comment


              • #8
                I doubt this is a software issue. The point is to see what data you are left with after applying all those restrictions, which Stata is saying to be none that you can use.


                Code:
                 
                 list Adult_Res_ESBL h_stand dairykern_stand beefkern_stand if County == "B" & !missing(SomeAccess, MaxAccess, FarmLivestock, Import_YN, Herd_Size, H_CDL, DairyKernMEAN, BeefKernMEAN, WWTPNEAR_DIST, HospNEAR_DIST)

                Comment

                Working...
                X