Announcement

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

  • Beta Regression, Restricting Observations

    Hello All,

    I am performing a beta regression using the betareg function and comparing their information criteria. I do not have paired data. I want to restrict observations based on a variable not included within the model so that I have the same number of observations when comparing AIC between models. Is this possible? I decided to post after reading this post (excluding observations using restrict observation command - Statalist).

    Here is an example of my code, which does not restrict observations based on "Wildlife_ESBL" for the first model, but it does for the second. I presume this is because Wildlife_ESBL is not in the first model.

    Code:
     betareg Adult_Res_ESBL SomeAccess MaxAccess FarmLivestock Import_YN Herd_Size if County != "A" & Wildlife_ESBL != 0
    Code:
    betareg Adult_Res_ESBL Herd_Size H_CDL DairyKernMEAN BeefKernMEAN Wildlife_ESBL if County != "A" & Wildlife_ESBL != 0
    Please let me know if this is unclear and I will try to explain further. Best Regards, Macon

    Last edited by Macon Overcast; 15 Mar 2022, 21:52. Reason: Edit: code correction

  • #2
    The difference between those two commands has to do with how estimation commands deal with observations containing missing values. When the value of the dependent or any of the independent variables in a regression is a missing value, that observation is omitted from the estimation. In your first -betareg- command, Wildlife_ESBL is not one of the regression variables, and while you have restricted it to situations where Wildlife_ESBL != 0, you must note that missing value != 0, so observations with a missing value for Wildlife_ESBL will be included in the first regression. By contrast, in the second regression, because Wildlife_ESBL is included among the regressor variables, any observation where Wildlife_ESBL has a missing value is excluded. And then the -if- clause further restricts to those where it is not 0.

    If you wanted to make the inclusion criteria for the first -betareg- command match that of the second, you would have to rewrite it as:
    Code:
    betareg Adult_Res_ESBL SomeAccess MaxAccess FarmLivestock Import_YN Herd_Size if County != "A" & Wildlife_ESBL != 0 & !missing(Wildlife_ESBL)
    Last edited by Clyde Schechter; 15 Mar 2022, 21:59.

    Comment


    • #3
      Clyde - thank you so much for explaining this logic. The code worked! Thank you again.

      Comment

      Working...
      X