Announcement

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

  • Lower 5th quantile of a variable

    Hi,
    I am new to the forum. I am working on conducting some statistical analysis in stata. I have couple of queries:

    1. I am very confused in differentiating between centile, xtile and p in stata. I want to find the lower 5th percentile (quantile) of a variable for each panel ID that I have (by ID). please help me know the relevant code.

    2. I am conducting quantile regression on a panel data set and I want to know the difference between "xtqreg" and "by panelID qreg". Also when I want to run the regression individually for each Panel ID that I have tried to do using xtreg, it doesnot accepts "by" option and gives the aggregate quantile regression results for the entire data-set and not just the individual firms or panel IDs.

    3. Lastly, when I use "by panelID qreg" and want to output the results in asdoc, it doesnot considers sorting w.r..t "by panelID" rather only gives the aggregated regression result for the entire data-set. How can I output regression results using asdoc for individual firms using "by panelID" or "bysort PanelID"

    Much Thanks
    Aamina

  • #2
    I will peel off Q1. I note that in Q2 and Q3 you refer to communitty-contributed commands xtqreg and asdoc. You're asked to explain where they come from (https://www.statalist.org/forums/help#stata).

    Q1. You can put the 5th percentile (sometimes described as the 0.05 quantile) in a variable with something like

    Code:
    . webuse grunfeld , clear
    
    . egen p5 = pctile(invest), p(5) by(company)
    
    . tabdisp company, c(p5)
    
    ----------------------
      company |         p5
    ----------+-----------
            1 |     287.65
            2 |     220.15
            3 |      38.85
            4 |     43.545
            5 |     39.675
            6 |      22.48
            7 |      23.82
            8 |     15.885
            9 |      22.14
           10 |      1.055
    ----------------------
    
    . egen p5y = pctile(invest), p(5) by(year)
    
    . tabdisp year, c(p5y)
    
    ----------------------
         year |        p5y
    ----------+-----------
         1935 |       2.54
         1936 |          2
         1937 |       2.19
         1938 |       1.99
         1939 |       2.03
         1940 |       1.81
         1941 |       2.14
         1942 |       1.86
         1943 |        .93
         1944 |       1.18
         1945 |       1.36
         1946 |       2.24
         1947 |       3.81
         1948 |       5.66
         1949 |       4.21
         1950 |       3.42
         1951 |       4.67
         1952 |          6
         1953 |       6.53
         1954 |       5.12
    ----------------------
    I don't think I can improve on the help and manual entries in explaining centile and xtile. Sorry, but I have no idea what you mean by p. You will note that neither of the first two commands is what I recommend here.

    Comment


    • #3
      Thank you Nick for your valued assistance.

      Regarding Q2 and Q3, if I am not getting your question wrong, I am using xtqreg in stata 15.1. which is quantile regression for panel data. The problem is that I can't find any code to perform the quantile regressions at 0.05 for individual firms or panels in the data.

      Best
      Aamina

      Comment


      • #4
        The point is that xtqreg and asdoc are not official commands, but on SSC. If you don't get replies -- authors of each are members here but may not read this thread -- you may need to start new threads mentioning those commands.

        Comment


        • #5
          Alternatively, you try something like this to attract the attention of the authors of those packages to this thread:
          xtqreg - written by J.A.F. Machado & Joao Santos Silva
          asdoc - written by Attaullah Shah
          Members you name using the @name feature will be notified that they have been mentioned in a post.
          --
          Bruce Weaver
          Email: [email protected]
          Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
          Version: Stata/MP 18.0 (Windows)

          Comment


          • #6
            Thank you Nick and Bruce. I will follow

            Comment


            • #7
              Thanks, Bruce Weaver for tagging me in this post. Since xtqreg is a community-contributed program, asdoc was not aware of that. I have added this to the regression group, and now asdoc can treat it like any other Stata regression command. The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
              Code:
              net install asdoc, from(http://fintechprofessor.com) replace
              sysuse auto, clear
              asdoc xtqreg price weight length i.foreign, i(headroom) quantile(.25)
              Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

              Please do remember to cite asdoc. To cite:
              In-text citation
              Tables were created using asdoc, a Stata program written by Shah (2018).

              Bibliography
              Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

              Regards
              --------------------------------------------------
              Attaullah Shah, PhD.
              Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
              FinTechProfessor.com
              https://asdocx.com
              Check out my asdoc program, which sends outputs to MS Word.
              For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

              Comment


              • #8
                Thank you so much Attah Ullah Shah. I look forward to further assistance from you all.

                I will definitely try this and cite asdoc in the paper

                Best
                Aamina

                Comment

                Working...
                X