Announcement

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

  • Quantile Regression for Panel Data

    Hi, I am trying to estimate a quantile regression with panel data following Ivan A Canay (2011) A simple approach to quantile regression for panel data, Econometrics Journal, volume 14, pp. 368–386. Unlike Koenkar (2004), this paper uses a two stage GMM estimation.

    I have estimated once this fixed effect quantile regression with R using Koenkar methodology. But this has a lot of limitations. This is why, this time I am trying this Canay methodology.

    Unfortunately I do not find any Stata codes for this, though there are few literatures which report to have done this using Stata. It would be a great help if anybody has any clue where I can find this Stata codes for fixed effect quantile regression following Canay (2011).

    Ujjwal Kumar Das
    Leeds University Business School, UK

  • #2
    Code:
    cap log close
    log using "canay.log", replace
    
    set more off
    
    use "grunfeld.dta", clear
    
    tsset firm year
    
    local qs "0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95"
    
    ****************************************************************
    *** Canay's (2011) Fixed-Effect Quantile Panel Data Approach ***
    ****************************************************************
    // Step 1
    xtreg inv value capital, fe
    predict res, u 
    gen inv1 = inv - res
    
    // Step 2
    local replace replace 
    *forvalues tau = 0.05(0.05)0.95 {
    foreach tau in `qs' {
      qreg inv1 value capital, quantile(`tau') vce(robust)
      outreg2 using "canay", excel dec(4) ctitle(`tau') `replace'
      local replace append
    }
    
    log close
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

    Comment


    • #3
      There is one shortcoming of this procedure. The standard variance-covariance estimator is not valid for such a two-stage approach because it ignores the first-stage estimation uncertainty. The robust VCE is NOT robust in this respect. Conventional standard-errors can be considerably biased (with or without the vce(robust) option). Unfortunately, to my knowledge there is no ready-to-use Stata command that provides the correct standard errors for Canay's two-stage procedure.
      https://twitter.com/Kripfganz

      Comment


      • #4
        My bad. Sebastian is right about the generated regressor (hence estimation uncertainty) problem. I neglected the issue although I found some (very minor) divergences between the estimates of variances/standard errors generated by the R code (originally provided by Canay) and the Stata code above. Thanks for pointing out the error.
        Ho-Chuan (River) Huang
        Stata 17.0, MP(4)

        Comment


        • #5
          Dear Ujjwal,

          You might want to try an alternative quantile estimator for panel data. Please "ssc install qregpd", and see references therein.
          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment


          • #6
            Originally posted by Ujjwal View Post
            Hi, I am trying to estimate a quantile regression with panel data following Ivan A Canay (2011) A simple approach to quantile regression for panel data, Econometrics Journal, volume 14, pp. 368–386. Unlike Koenkar (2004), this paper uses a two stage GMM estimation.

            I have estimated once this fixed effect quantile regression with R using Koenkar methodology. But this has a lot of limitations. This is why, this time I am trying this Canay methodology.

            Unfortunately I do not find any Stata codes for this, though there are few literatures which report to have done this using Stata. It would be a great help if anybody has any clue where I can find this Stata codes for fixed effect quantile regression following Canay (2011).

            Ujjwal Kumar Das
            Leeds University Business School, UK
            How to know that the Canay estimator (2011) is by GMM? In this case, after the estimation, would not it be necessary to perform the endogeneity test?

            Comment


            • #7
              Thanks to you all, esp River Huang. I think Powell has added some important updates on this estimation process in qregpd.

              Comment


              • #8
                As a follow-up point to the previous very detailed comments, could one obtain the correct standard errors by bootstrapping the 2steps?

                Comment


                • #9
                  Dear all,

                  Dear River Huang,

                  Following your suggestion in #2, I will like to use the Canay's (2011) Fixed-Effect Quantile Panel Data Approach. But I need help and also clarification:

                  1. From https://www.statalist.org/forums/for...and-panel-data , Blaise Melly suggests the problem of the SEs as pointed out by Sebastian Kripfganz can be resolved by bootstrapping. Could you and anyone help me with the bootstrapping code to implement this?

                  2. Secondly, if I have one or two endogenous variables among my independent variables (and I have instruments for them), is it possible to implement a 2SLS IV regression that incorporates Canay's approach? For instance, say I have the following model to estimate: regression y on x1, x2, and x3. x1 is endogenous and will be instrumented by z1. And I need to control for individual and year fixed effects. Can I use a 2SLS procedure where at the first stage I do the folowing:

                  Code:
                  xtreg  x1  z1 x2 x3 i.year, fe vce(robust)
                  predict x1_hat
                  Then in the second stage, Canay's 2-step estimation sets in (here I am using what River Huang provided in #2) where

                  Code:
                   
                   tsset ind year
                  Code:
                   local qs "0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95"
                  Code:
                  // Step 1 xtreg y x1_hat x2 x3, fe predict res, u  gen y1 = y - res
                  Code:
                  // Step 2 local replace replace  *forvalues tau = 0.05(0.05)0.95 { foreach tau in `qs' {   qreg y1 x1_hat x2 x3, quantile(`tau') vce(robust)   outreg2 using "canay", excel dec(4) ctitle(`tau') `replace'   local replace append }
                  The above does not do bootstrapping. But even before incorporating the bootstrap, is this procedure meaningful and correct?

                  Please your kind assistance will be greatly helpful.

                  Thanks.

                  Comment

                  Working...
                  X