Announcement

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

  • No observations - Portfolio Sorts

    Hello everyone,

    I have double-sorted my data and dropped observations to include only one observation per date per company. Then, I calculate the value-weighted excess returns and then find the Newey statistics.

    However, the Newey statistics do not work for EXUSD_3_VW_5_1_Size, EXUSD_4_VW_5_1_Size and EXUSD_5_VW_5_1_Size because there are too few observations. Is there any way to change that? Thank you so much!

    My code is as follows:

    tsset DSCode1 ymdate
    gen F_Excess_USD_w=L.Excess_USD_w
    drop if F_Excess_USD_w==.

    * Dependent-sort portfolio - Size & IVOL
    astile nq_Size_w = Size_w, nq(5)
    bys nq_Size_w : astile IVOL_Size=IVOL_w , nq(5)
    sort ymdate IVOL_Size DSCode1
    by ymdate IVOL_Size: drop if _n >1

    * Value-weighted average excess returns of each portfolio in each month (ymdate)
    bys ymdate: asgen ExUSD_1_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==1)), w(MV_USD_w)
    bys ymdate: asgen ExUSD_1_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==1 & IVOL_Size ==5)), w(MV_USD_w)
    bys ymdate: asgen EXUSD_1_VW_5_1_Size = ExUSD_1_VW_5 - ExUSD_1_VW_1

    bys ymdate: asgen ExUSD_2_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==1)), w(MV_USD_w)
    bys ymdate: asgen ExUSD_2_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==2 & IVOL_Size ==5)), w(MV_USD_w)
    bys ymdate: asgen EXUSD_2_VW_5_1_Size = ExUSD_2_VW_5 - ExUSD_2_VW_1

    bys ymdate: asgen ExUSD_3_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==1)), w(MV_USD_w)
    bys ymdate: asgen ExUSD_3_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==3 & IVOL_Size ==5)), w(MV_USD_w)
    bys ymdate: asgen EXUSD_3_VW_5_1_Size = ExUSD_3_VW_5 - ExUSD_3_VW_1

    bys ymdate: asgen ExUSD_4_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==1)), w(MV_USD_w)
    bys ymdate: asgen ExUSD_4_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==4 & IVOL_Size ==5)), w(MV_USD_w)
    bys ymdate: asgen EXUSD_4_VW_5_1_Size = ExUSD_4_VW_5 - ExUSD_4_VW_1

    bys ymdate: asgen ExUSD_5_VW_1_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==1)), w(MV_USD_w)
    bys ymdate: asgen ExUSD_5_VW_5_Size = (F_Excess_USD_w / (nq_Size_w ==5 & IVOL_Size ==5)), w(MV_USD_w)
    bys ymdate: asgen EXUSD_5_VW_5_1_Size = ExUSD_5_VW_5 - ExUSD_5_VW_1

    egen mean_Size = rowmean(EXUSD_1_VW_5_1_Size EXUSD_2_VW_5_1_Size EXUSD_3_VW_5_1_Size EXUSD_4_VW_5_1_Size EXUSD_5_VW_5_1_Size)

    tsset DSCode1 ymdate
    sort DSCode1 ymdate,

    *Value-weighted average excess returns & t-statistics of each portfolio
    newey EXUSD_1_VW_5_1_Size, lag(6) force
    estimates table, star(.05 .01 .001)
    newey EXUSD_2_VW_5_1_Size, lag(6) force
    estimates table, star(.05 .01 .001)
    newey EXUSD_3_VW_5_1_Size, lag(6) force
    estimates table, star(.05 .01 .001)
    newey EXUSD_4_VW_5_1_Size, lag(6) force
    estimates table, star(.05 .01 .001)
    newey EXUSD_5_VW_5_1_Size, lag(6) force
    estimates table, star(.05 .01 .001)
    newey mean_Size, lag(6) force
    estimates table, star(.05 .01 .001)

  • #2
    This would be the output:

    Click image for larger version

Name:	Screen Shot 2019-05-07 at 19.39.24.png
Views:	1
Size:	74.9 KB
ID:	1497157


    Thank you so much in advance.

    Comment


    • #3
      I notice that your example data shows the variable Date but not ymdate, because your screen shot is cut off at the right. And you have not shown the lines at the end of the output that show variable formats.

      If you were to post the output from the following it might prove helpful in ruling out some very simple possibilities.
      Code:
      order DSCode1 ymdate
      sort DSCode1 ymdate
      dataex , count(30)
      Before posting the output, do review the output of help dataex and post your output not as a screen shot but by copying the lines from the screen and pasting them into the post.

      Comment

      Working...
      X