Announcement

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

  • Quantile regressions with clustered standard errors and sampling weights

    Hi Statalist,

    I am having troubles estimating quantile regressions using both clustered standard errors (by country in a multi-country regression) and sampling weights. The command qreg does not allow to cluster the standard errors so I am using the user written command qreg2, as following:

    qreg2 exp edu hhsize rain yr1-yr10 cr1-cr10, quantile(0.25) cluster(country_c)
    qreg2 exp edu hhsize rain yr1-yr10 cr1-cr10 [w=weight], quantile(0.25) cluster(country_c)

    In the first line I ignore the sampling weights so the code runs properly, but when I try to run the second line I get the following error message: "Options cluster and weights are not compatible"

    Does anybody has a solution that will let me do both things at the same time (clustering + using sampling weights)? Thank you very much in advance!




  • #2
    Your code says "w=weight" but I think you need to specify what type of weight, e.g. pweight, you mean. The error message may reflect the fact that you don't specify the weight properly.
    Richard T. Campbell
    Emeritus Professor of Biostatistics and Sociology
    University of Illinois at Chicago

    Comment


    • #3
      Dear Mr. Campbell, thank you for your reply. When no specific weight types are specified, the default used by Stata are frequency weights. The help file for qreg2 specifies the following:
      "qreg2 allows fweights except when the option cluster is used" , so it seems that it is not possible with this command to do both things at the same time.

      I would highly appreciate if someone could suggest an alternative way / command to use in order to allow for both sampling weights and clustering of s.e.

      Comment


      • #4
        You can use Stas Kolenikov's program bsweights ("findit") after svyset to create bootstrap replicates that will effectively contain the stratum and cluster information. The Stata Journal article referenced below has examples. Then you can use the companion prefix command bs4rw to run qreg. For an example of this, see the Stata section of
        http://epid.blogspot.com/2012/04/qua...egression.html


        References:

        Kolenikov,Stanislav. 2010. Resampling variance estimation for complex survey data. Stata Journal 10, no. 2: 165-199., available here.
        Last edited by Steve Samuels; 09 Mar 2016, 17:07.
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Dear Sara,

          It is not clear to me how to estimate the covariance matrix with clustering and weights; that is why I did not implement an option to use weights with clustered standard errors when I wrote -qreg2-.

          What I suggest is that you consider whether you really need to use weights; often weights are not used in regressions.

          Best wishes,

          Joao

          Comment

          Working...
          X