Announcement

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

  • #16
    Clyde Schechter Dear Mr. Schechter,

    I have another question regarding this topic. It regards a question that I already asked in #11 although not very specifically:

    Or is it possible to only cluster on the location in period one, thereby keeping all observations?
    If is is the case that some individuals switched their location between the two periods is it obligatory to cluster the standard error taking these switches into account? Alternatively, one could just cluster on the location in period 1, thereby ignoring that switches occurred (that was proposed by a friend of mine but I find that suspicious since the information that location changes occurred is omitted thereby).

    Comment


    • #17
      Steffen:
      if you plan to go -xtreg,fe-, variation in panelid location in between the two interviews allows a coefficient to be estimated.
      Therefore, why not clustering the standard errors on -panelid- and add -i.location- as a predictor in the right-hand side of your regression equation?
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #18
        Carlo Lazzaro You mean
        Code:
        xtivreg ... , fe vce(cluster id)
        ?

        I haven't thought about this. My supervisor suggested to cluster on the location level. How does one choose the level at which the standard error should be clustered?

        Comment


        • #19
          Steffen:
          not quite.
          Unless you have an endogeneity issue, I would go:
          Code:
           
           xtreg ... i.location, fe vce(cluster panelid)
          As far as clustering is concerned, the first requirement is that -clustervar- has to be in line with the way you -xtste- your dataset.
          In addition, double clustering is supported by the community-contributed module -reghdfe-.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #20
            Originally posted by Clyde Schechter View Post
            The message is self-explanatory. Your panels (IDs) are not nested within the clusters (states), which makes this an inadmissible command. So somewhere in your data there is at least one ID that appears in more than one state. There might be many like that.

            If your IDs represent people or firms, and this is panel data, people and firms do move around. So this isn't really very surprising. But if the nature of the panel data's construction is such that it should only include non-moving entities, then that means there is an error in your data. You can find the offending ID's as follows:

            Code:
            by ID (state), sort: gen byte moved = (state[1] != state[_N])
            browse if moved
            I am having a similar error in my regression. I am trying to replicate a journal article and the authors used "district fixed effects and the standard errors are adjusted for clustering at the village level". I tried the following commands:

            xtset "DISTRICT ID"
            xtreg y x1...., fe vce (cluster VILLAGE ID) ----this is where the error appeared.

            Are my commands wrong?

            Thanks in advance

            Comment


            • #21
              is "VILLAGE ID" supposed to refer to just one variable (it needs to); the problem is that spaces are not allowed in variable names in Stata so that can't be correct; maybe that's the variable label? you need to include a single variable name within the parens; also, don't put a space between "vce" and the open parens; note that your -xtset- statement has a similar problem and should not include the quotation marks

              Comment


              • #22
                Originally posted by Rich Goldstein View Post
                is "VILLAGE ID" supposed to refer to just one variable (it needs to); the problem is that spaces are not allowed in variable names in Stata so that can't be correct; maybe that's the variable label? you need to include a single variable name within the parens; also, don't put a space between "vce" and the open parens; note that your -xtset- statement has a similar problem and should not include the quotation marks
                Sorry the exact variable names are DISTID and PSUID (for village). Here is what I placed in stata

                . xtset DISTID

                . xtreg ES2 pcrime, fe vce(cluster PSUID)

                Comment

                Working...
                X