Announcement

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

  • GEE Number of Observations

    Hello

    I use Stata 13 and Windows 10.
    I used GEE estimations: xtgee y L. (x z xz c1 c2 c3 c4)

    I dropped all observations with missing data on any of my model variables. My sample size is about 9400. However, the GEE results show Number of obs = 7655.

    Is there any interpretation for this difference? Is that because my lagged variables?

    Thank you very much for your help.

  • #2
    Yes. For the first observation in each of your xtset groups, the lagged value is, necessarily, missing. So the first observation in each group is unable to participate in the estimation sample. Also, if you had, for example, a certain observation in year 2015, but you had to drop the same group's observation in 2014 because it was missing one of the variables, then the lagged values for 2015 are missing, and the 2015 observation does not participate in the estimation sample.

    In fact, you probably should not have dropped the observations with missing values on x z xz c1 c2 c3 or c4, because those observations might well be able to participate in the estimation. They could do so if y is not missing in that observation, and if the immediately preceding observation for that group had no missing values for x z xz c1 c2 c3 or c4.

    Comment


    • #3
      Thank you very much for your recommendation.

      I followed your suggestion and did not drop observations with missing values and it did increase my observations that participated in the estimation.

      I use the “margins” command as you kindly advised me before to estimate the marginal effects of X on Y at different values of Z. The sign of the marginal effects of X changed over the observed values of Z. Now I am required to calculate the percentage of observations of Z for positive effects and for negative effects .

      I need to count the number of observations with Z value less than .2 AND participated in the estimation.

      The problem is if use this code (count if Z<.2), it will count Z observations less than .2 whether or not they participated in the estimation.

      Is there any way to count these observations please?

      Thank you very much for your help.

      Comment


      • #4
        Hello Kethan,

        If I understood your question you want to know the number of observations with z value less than 0.2 AND participated in the estimation. After you run your model you can use the below code to flag everyone that participated in the estimation (1= was used in the estimation, 0= was not used in the estimation). Then you can use that variable to restrict for whom you count z values.
        Code:
         
         gen byte inuse = e(sample)

        Best wishes,
        Patrick

        Comment


        • #5
          Thank you very much Patrick
          Yes this is what exactly I meant and your code worked fine.
          regards

          Comment

          Working...
          X