Announcement

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

  • xtset and xtreg with all coefficients zero

    Hi everyone,

    I am new to using panel data on stata so I had a few questions.

    I am using the India birth recode module of the Demographic and Health Surveys (DHS). This basically acts as an unbalanced panel in that a mother has multiple entries based on the number of children she has. So basically, she enters the survey at the time of marriage and has data entries for each child and exits at the date of interview of the survey. Thus this unbalanced panel gives the retrospective birth history of each woman.

    I wanted to declare the dataset as a panel with a year variable corresponding to the id of the person (newid) and year of birth of each child (yobc) using xtset. But I kept getting the error that there are repeated time values, which is natural since mother can have multiple kids and multiple births. So I followed the advice given here and simply did

    Code:
    xtset newid
    And this worked. However, whenever I run the following command for a difference in difference model:


    Code:
    xtreg childhealth policy treatment did `controls0'
    I get that all coefficients are zero. Here policy is 1 for the years where it was in place and 0 otherwise, treatment is the cohort of mothers that were affected by this policy again a 0,1 dummy variable (did is policy*cohort). I am not entirely sure why the results showed that all coefficients were zero or if this was the right step forward.

    Code:
    reg childhealth policy treatment did `controls0'
    however this gets me results i.e. coefficients that are not zero and makes intuitive sense. Do let me know how to proceed on this front. Thank you.

    Best,
    Lori

  • #2
    Lorien:
    I find difficult to reply positively without reading what Stata gave you back.
    The only thing that strikes me even with no results available, is the way you -xtset- your data and the way you calculated -newid-.
    From your description, It seems that your -panelid- is actually a -timevar-.
    That said, an excerpt/example of your dataset provide with -dataex- could help interested listers to help yopurself in turn.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Thank you for your response. I have included below a dataex output for the variables I mentioned as well as a picture of the stata output

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float newid int year float(yobchild policy cohort)
      79351 1998 1991 0 0
      79351 1998 1988 0 0
      79351 1998 1982 0 0
      79351 1998 1991 0 0
          1 1992 1985 0 0
          1 1992 1988 0 0
          2 1992 1977 1 1
          2 1992 1985 0 0
          2 1992 1989 0 0
          2 1992 1992 0 0
      79352 1998 1989 0 0
      79352 1998 1983 0 0
          3 1992 1967 0 0
          3 1992 1977 1 1
          3 1992 1973 0 0
          4 1992 1989 0 0
      79353 1998 1992 0 0
      79353 1998 1991 0 0
      79353 1998 1987 0 0
      79353 1998 1988 0 0
      79353 1998 1990 0 0
          5 1992 1982 0 0
          5 1992 1986 0 0
          5 1992 1991 0 0
      79354 1998 1972 0 0
      79354 1998 1973 0 0
      79354 1998 1974 0 0
      79354 1998 1971 0 0
      79354 1998 1970 0 0
      79354 1998 1975 1 1
      79354 1998 1975 1 1
      79354 1998 1969 0 0
      79354 1998 1975 1 1
          6 1992 1958 0 0
          6 1992 1964 0 0
          6 1992 1962 0 0
          7 1992 1980 0 0
          7 1992 1984 0 0
          7 1992 1985 0 0
          7 1992 1988 0 0
          7 1992 1982 0 0
          8 1992 1991 0 0
          8 1992 1986 0 0
          8 1992 1985 0 0
      79355 1998 1974 0 0
      79355 1998 1973 0 0
      79355 1998 1978 0 0
      79355 1998 1975 1 1
      79356 1998 1994 0 0
      79356 1998 1997 0 0
      79356 1998 1994 0 0
      79357 1998 1990 0 0
      79357 1998 1994 0 0
      79357 1998 1991 0 0
      79357 1998 1998 0 0
      79358 1998 1994 0 0
          9 1992 1984 0 0
          9 1992 1986 0 0
          9 1992 1991 0 0
          9 1992 1989 0 0
      79359 1998 1992 0 0
      79359 1998 1993 0 0
      79359 1998 1994 0 0
      79360 1998 1969 0 0
      79360 1998 1984 0 0
      79360 1998 1975 1 1
      79360 1998 1973 0 0
      79360 1998 1977 1 1
      79360 1998 1971 0 0
      79361 1998 1993 0 0
      79361 1998 1994 0 0
         10 1992 1967 0 0
         10 1992 1961 0 0
         10 1992 1964 0 0
         10 1992 1970 0 0
         10 1992 1965 0 0
         10 1992 1971 0 0
         11 1992 1991 0 0
      79362 1998 1977 1 1
      79362 1998 1983 0 0
      79362 1998 1979 0 0
      79362 1998 1981 0 0
      79363 1998 1998 0 0
      79364 1998 1976 1 0
      79364 1998 1983 0 0
      79365 1998 1993 0 0
      79365 1998 1995 0 0
      79365 1998 1997 0 0
         12 1992 1982 0 0
         12 1992 1986 0 0
         12 1992 1985 0 0
      79366 1998 1981 0 0
      79366 1998 1978 0 0
      79366 1998 1993 0 0
      79366 1998 1986 0 0
         13 1992 1969 0 0
         13 1992 1967 0 0
         13 1992 1964 0 0
         13 1992 1976 1 1
         13 1992 1971 0 0
      end
      label values year v007

      Code:
      xtreg childhealth policy treatment did `controls0'
      Random-effects GLS regression Number of obs = 544,051
      Group variable: newid Number of groups = 160,222
      R-sq: Obs per group:
      within = 0.0000 min = 1
      between = 0.0000 avg = 3.4
      overall = 0.0000 max = 18
      Wald chi2(0) = .
      corr(u_i, X) = 0 (assumed) Prob > chi2 = .
      childhealth Coef. Std. Err. z P>z [95% Conf. Interval]
      policy 0 (omitted)
      treatment 0 (omitted)
      did 0 (omitted)
      _cons 0 (omitted)
      sigma_u .49116237
      sigma_e 0
      rho 1 (fraction of variance due to u_i)

      Thanks again for your help

      Comment


      • #4
        Lorien:
        it would seem that your predictors were all omitted due to collinearity.
        Moreover, the data excerpt that you provide is not helpful to reply your problem.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo,

          Thank you for the explanation. Given the fact that child health is also a dummy, would that be the issue thats causing the collinearity? Would it suffice that I use a non-count discrete variable that measures childhealth to circumvent the issue?

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float(policy treatment did childhealth)
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 0 0 0
          0 0 0 0
          1 1 1 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 0 0 0
          0 0 0 0
          0 1 0 0
          1 1 1 0
          0 1 0 0
          0 0 0 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          1 1 1 0
          1 1 1 0
          0 1 0 0
          1 1 1 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          1 1 1 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 0 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          1 1 1 1
          0 1 0 1
          1 1 1 1
          0 1 0 1
          0 0 0 0
          0 0 0 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 0 0 0
          1 1 1 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 0 0 0
          1 0 0 0
          0 0 0 0
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          0 1 0 1
          1 1 1 1
          0 1 0 1
          end

          Comment


          • #6
            Lorien:
            if -chilhealth- (the regressand) is a dummy, -xtreg- should be replaced by -xtlogit-.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X