Announcement

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

  • Xtile with dates

    Hello, I've a panel data with this structure.

    list id newdate pchg qgarp pais industria size if inrange(id, 1, 5), noobs

    +-------------------------------------------------------------------------------------------------+
    id newdate pchg qgarp pais industria size
    -------------------------------------------------------------------------------------------------
    AIM:ABC 28mar2014 4.09206 .650909 United Kingdom Healthcare Small_cap
    AIM:ABC 11jun2014 -1.2285 .641818 United Kingdom Healthcare Small_cap
    AIM:ABC 26sep2014 13.5294 .629091 United Kingdom Healthcare Small_cap
    AIM:ABC 11dec2014 .277778 .590909 United Kingdom Healthcare Small_cap
    AIM:ASC 28mar2014 -35.6688 .718182 United Kingdom Consumer Discretionary Mid_cap
    -------------------------------------------------------------------------------------------------
    AIM:ASC 11jun2014 -35.6436 .556364 United Kingdom Consumer Discretionary Mid_cap
    AIM:ASC 26sep2014 27.9327 .543636 United Kingdom Consumer Discretionary Mid_cap
    AIM:ASC 11dec2014 -.601278 .530909 United Kingdom Consumer Discretionary Mid_cap
    AIM:CLIN 28mar2014 -17.2727 .778182 United Kingdom Healthcare Small_cap
    AIM:CLIN 11jun2014 4.22207 .705455 United Kingdom Healthcare Small_cap
    -------------------------------------------------------------------------------------------------
    AIM:CLIN 26sep2014 15.7503 .68 United Kingdom Healthcare Small_cap
    AIM:CLIN 11dec2014 -3.85356 .641818 United Kingdom Healthcare Small_cap
    AIM:DTG 28mar2014 -5.58028 .872727 United Kingdom Industrials Small_cap
    AIM:DTG 11jun2014 -18.2639 .821818 United Kingdom Industrials Small_cap
    AIM:DTG 26sep2014 30.591 .694545 United Kingdom Industrials Small_cap
    -------------------------------------------------------------------------------------------------
    AIM:DTG 11dec2014 .169381 .809091 United Kingdom Industrials Small_cap
    AIM:NANO 28mar2014 .825472 .467273 United Kingdom Information Technology Micro_Cap
    AIM:NANO 11jun2014 38.2456 .552727 United Kingdom Information Technology Micro_Cap
    AIM:NANO 26sep2014 -17.7665 .378182 United Kingdom Information Technology Micro_Cap
    AIM:NANO 11dec2014 -16.8724 .429091 United Kingdom Information Technology Micro_Cap
    +-------------------------------------------------------------------------------------------------+

    How can i create quintiles by date with xtile function??? For example i want to create a quintile at 28/03/2014???? How can i need to write the command??

    I´ll attach below the details of the panel data.

    thks all.

    xtdescribe

    id: 1, 2, ..., 3767 n = 3767
    newdate: 28mar2014, 11jun2014, ..., 11dec2014 T = 4
    Delta(newdate) = 1 day
    Span(newdate) = 259 periods
    (id*newdate uniquely identifies each observation)

    Distribution of T_i: min 5% 25% 50% 75% 95% max
    4 4 4 4 4 4 4

    Freq. Percent Cum. Pattern*
    ---------------------------+----------
    3767 100.00 100.00 1111
    ---------------------------+----------
    3767 100.00 XXXX
    --------------------------------------
    *Each column represents 75 periods.



  • #2
    Please use full real names (typically given name plus family name) on Statalist. FAQ Advice Section 6 explains our policy and how to fix your identifier.

    You seem to be confusing quintiles and quintile-based bins or groups, but no matter. Daily dates are just numeric variables; there is no special technology for summarising or binning them.

    Comment


    • #3
      I'll update now my name Nick, sorry.

      The variable that i want to create quintiles are qgarp, but i want to do that for 4 different date time: 28/03/2014, 11/06/2014, 26/09/2014 and 11/12/2014.

      my command looks this but not works

      xtile quantile1= -qgarp if newdate=="28/03/2014", nq(5)

      Comment


      • #4
        I'll update now my name Nick, sorry.

        The variable that i want to create quintiles are qgarp, but i want to do that for 4 different date time: 28/03/2014, 11/06/2014, 26/09/2014 and 11/12/2014.

        my command looks this but not works

        xtile quantile1= -qgarp if newdate=="28/03/2014", nq(5)

        Comment


        • #5
          Any idea???

          Comment


          • #6
            It might help if you show us exactly what you got and how it differs from what you expected. "not works" could mean many things.

            Comment


            • #7
              I'll find the command i think, but i need in invers orders the quantiles.

              egen quantile = xtile(qgarp), by(newdate) nq(5)

              . table quantile newdate, c (p50 pchg)


              newdate
              quantile 28mar2014 11jun2014 26sep2014 11dec2014

              1 2.33298 -2.41431 2.18127 2.75215
              2 3.42853 -2.19018 3.97359 3.53407
              3 3.34752 -1.43584 1.23103 3.89868
              4 3.55135 -1.16467 .838935 3.16016
              5 2.88418 -.273322 -.963735 2.85079

              I'll need the invers of this table, like the 1 quantile are the higghest qgarp number and the 5 quintile are the lowest.

              Comment


              • #8
                So just do
                Code:
                replace quantile = 6 - quantile
                and the order will be reversed.

                Comment


                • #9
                  Thks a lot clyde!

                  Comment

                  Working...
                  X