Announcement

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

  • Quantile Regression with qreg and laplacereg

    Hi all,

    I am working with a colleague on a paper. We have a basic OLS regression, but want to check our results with a quantile regression at the median. We have a very large dataset with about 4 million observations (IPUMS ACS 5-Year Estimates) and use state puma and occupation as controls. I note this because there are about 4,000 state pumas and about 800 different occupations in our dataset. So, it will take a while to run. However, we are using a pretty fast desktop PC. We are also trying to run a three-way interaction of age with age with our some college variable, so that complicates things.

    Our first thought was to use qreg, but it took like a week and then threw up the following error: invalid numlist has too many errors. So we switched to laplacereg. This ran for a while, but then threw up an error saying that factor notion was not allowed after about two days. We then used the "xi:" prefix but still had the same problem. This was a bit puzzling because the help file has the below example using factor notation.

    Code:
    xi: laplacereg studytime i.drug
    Any one have any ideas on the best way to run this quantile regression at the median? Here is our code for each attempt at qreg and laplacereg.

    qreg
    Code:
    qreg wageslf c.age##c.age##i.somecoll2 i.multyear i.statepuma, q(50)
    laplacereg
    Code:
    xi: laplacereg wageslf c.age##c.age##i.somecoll2 i.multyear i.statepuma, q(50)

    Thanks. Best,
    Kasey

  • #2
    Hi Kasey,
    I think you will find problems with this method regardless, because you have a very large dataset.
    Now, laplace reg was written to be compatible with stata 10, which means there were a few features in terms of factor notation it cannot handle natively. Since i was doing some work with this, I did a small modification to the program that allows for factor notation. Im attaching a link you can have access to that version. Perhaps it may help with your work.
    Best
    Fernando
    https://www.dropbox.com/sh/7c2spopdb...J8-Nw4Bla?dl=0

    Comment


    • #3
      Dear Kasey Zapatka,

      An alternative is to treat the state pumas as fixed effects and estimate the model using xtqreg; that should be fast.

      Best wishes,

      Joao

      Comment


      • #4
        Hi Fernando and Joao,

        Sorry for the delay in responding. I appreciate both of your suggestions. We ended up using (for now at least) xtrifreg, as some of our modeling assumptions changes.

        Thanks for your help. Best,
        Kasey

        Comment


        • #5
          Hi Kasey
          Just two words of advice on that.
          1. xtrifreg estimates unconditional quantile regressions, not conditional quantile regressions. Both aim to identify different things.
          2. If you have difficulties with xtrifreg, I would also suggest to use -rifhdreg-, which works like reghdfe (sergio Correira), and its more flexible than xtrifreg.
          You can download it using "ssc install rif"

          Best Regards,

          Comment


          • #6
            Thanks, Fernando. Will do.

            Comment

            Working...
            X