Announcement

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

  • How can I perform regression of Y on different quantiles of X?

    Quantile regression typically examines how the independent variable X affects different quantiles of Y, but I would like to investigate the quantiles of the independent variable X instead. Is there a command to achieve this, and would this approach be valid?

  • #2
    Originally posted by Eric Cheung View Post
    Quantile regression typically examines how the independent variable X affects different quantiles of Y, but I would like to investigate the quantiles of the independent variable X instead. Is there a command to achieve this . . .
    Are you looking for something like this?
    Code:
    sysuse auto
    egen double rpr = rank(price), track
    regress mpg c.rpr
    (I haven't bothered to convert ranks to quantiles.)

    . . . and would this approach be valid?
    Inasmuch as there's no distributional requirement for a predictor, I'm not sure what you'd be gaining. Do you expect that it will help with interpretability of the regression coefficient?

    Comment


    • #3
      I can't follow what is wanted here either. Nevertheless I am reminded of

      https://www.stata.com/statalist/arch.../msg00395.html

      https://www.statalist.org/forums/for...revised-on-ssc

      Comment


      • #4
        Originally posted by Eric Cheung View Post
        Quantile regression typically examines how the independent variable X affects different quantiles of Y, but I would like to investigate the quantiles of the independent variable X instead. Is there a command to achieve this, and would this approach be valid?
        For example, suppose I estimate the effect of the proportion of low-ability students in a middle school class (maybe measured by their elementary school performance) on other students. Now, I want to examine whether different quantiles of this proportion have varying effects. For instance, if the proportion oflow-ability students in the sample ranges from 1% to 30%, I would like to see whether the effect differs when the proportion is 10%, what the effect is at 15%, and how it changes at 20%.

        Comment


        • #5
          Originally posted by Joseph Coveney View Post
          Are you looking for something like this?
          Code:
          sysuse auto
          egen double rpr = rank(price), track
          regress mpg c.rpr
          (I haven't bothered to convert ranks to quantiles.)

          Inasmuch as there's no distributional requirement for a predictor, I'm not sure what you'd be gaining. Do you expect that it will help with interpretability of the regression coefficient?
          Thanks for reply. For example, suppose I estimate the effect of the proportion of low-ability students in a middle school class (maybe measured by their elementary school performance) on other students. Now, I want to examine whether different quantiles of this proportion have varying effects. For instance, if the proportion oflow-ability students in the sample ranges from 1% to 30%, I would like to see whether the effect differs when the proportion is 10%, what the effect is at 15%, and how it changes at 20%.

          Comment


          • #6
            Originally posted by Nick Cox View Post
            I can't follow what is wanted here either. Nevertheless I am reminded of

            https://www.stata.com/statalist/arch.../msg00395.html

            https://www.statalist.org/forums/for...revised-on-ssc
            Thanks for reply, my purpose is:

            For example, suppose I estimate the effect of the proportion of low-ability students in a middle school class (maybe measured by their elementary school performance) on other students. Now, I want to examine whether different quantiles of this proportion have varying effects. For instance, if the proportion oflow-ability students in the sample ranges from 1% to 30%, I would like to see whether the effect differs when the proportion is 10%, what the effect is at 15%, and how it changes at 20%.

            Comment


            • #7
              So, I suggest that you study the linked threads and decide whether they can help. Perhaps what you want is just some flavour of nonparametric regression. Otherwise this seems to hinge on whether you are imagining smooth dependence -- or wanting to bin the data and fit separate models and then combine them, which seems a very unattractive approach to me.

              Comment


              • #8
                Originally posted by Eric Cheung View Post
                . . . I would like to see whether the effect differs when the proportion is 10%, what the effect is at 15%, and how it changes at 20%.
                Maybe try something like the following then.
                Code:
                version 18
                
                clear *
                
                sysuse auto
                
                egen double rpr = rank(price), track
                quietly replace rpr = (rpr - 0.5) / _N
                
                regress mpg c.rpr
                
                margins , at(rpr = (0.1 0.15 0.2)) post
                
                // Twentieth versus tenth
                lincom _b[3._at] - _b[1._at]
                
                exit
                It uses Hazen’s rule; more here if you're interested in alternatives.

                Comment

                Working...
                X