Announcement

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

  • Stata exclude values in a glm regression

    Hello. I have a problem where stata excludes values.

    I am running the following code:

    glm positiv_pleural_sample ib0.d_d_inden_for_90_dage i.COPD i.CKD i.IHD_CHF i.DM i.age_group i.respirator_support i.circulatory_support i.renal_support i.gender_num i.ab_spektrum i.bloddyrkning i.luftvejssekret, link(log) family(poisson) vce(robust) eform

    The result for age_group is missing age_group 1. The result i post is only showing age_group.

    ----------------------------------------------------------------------------------------
    | Robust
    positiv_pleural_sample | IRR std. err. z P>|z| [95% conf. interval]
    -----------------------+----------------------------------------------------------------

    |
    age_group |

    2 | .5104993 .3450695 -0.99 0.320 .1357156 1.920262
    3 | .2002841 .1243218 -2.59 0.010 .0593311 .676099
    4 | .1381519 .0931424 -2.94 0.003 .0368531 .5178923


    ----------------------------------------------------------------------------------------

    age_group is coded as such:
    replace age_group = 1 if alder_ved_dræn >= 18 & alder_ved_dræn <= 25
    replace age_group = 2 if alder_ved_dræn >= 26 & alder_ved_dræn <= 50
    replace age_group = 3 if alder_ved_dræn >= 51 & alder_ved_dræn <= 75
    replace age_group = 4 if alder_ved_dræn >= 76 & alder_ved_dræn <= 100

    I dont have any missing values in age_group. I got a total of 13 sampels in the age_group 1.

    What can i do so age_group 1 is not excluded.

    Thanks in advance.
    Last edited by Soren Frambo; 14 Dec 2023, 01:50.

  • #2
    Originally posted by Soren Frambo View Post
    What can i do so age_group 1 is not excluded.
    If there weren't any warning messages at the beginning of iterations that the first category of the age group variable is omitted for some reason, then something like the following should work.
    Code:
    glm positiv_pleural_sample . . . ibn.age_group . . . , noconstant link(log) family(poisson) vce(robust) eform

    Comment


    • #3
      You will notice that is true for all categorical variables (indicated as "i.catvar" using factor variable notation). You can make one exception, as Joseph shows in #2, but that is at the expense of excluding the intercept. See the discussion pertaining to the dummy variable trap in https://en.wikipedia.org/wiki/Dummy_...e_(statistics).
      Last edited by Andrew Musau; 14 Dec 2023, 02:16.

      Comment


      • #4
        That is as it should be. 1 is the reference category for age group. So the coefficients are a comparison of its age-group and the reference age group. So 2.age_group compares the 26 to 50 year olds with the 18 to 25 year olds, and 3.age compares the 51 till 75 year olds to the 18 to 25 year olds. Now it does not make sense to include 1.age: that would compare the 18 till 25 year olds with the 18 till 25 year olds. We don't need to estimate that difference: it is 0 by definition.
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Thank you all.

          I will analyse the above recommendations.
          Last edited by Soren Frambo; 14 Dec 2023, 02:50.

          Comment

          Working...
          X