Announcement

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

  • Fama Mcbeth Regression with dummy variable

    Hi,

    I have to run Fama Mcbeth regressions where I want to add industry dummy (ind49 below) in explanatory variables. Following is the data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int(permno fiscalyear) float(pm1 hdm ln_mv bmv) byte ind49
    10006 1975  .1263129 .0145676  5.407476 1.144122 25
    10006 1976  .1173139 .0124178  5.723209 .8973941 25
    10006 1977  .1155713 .0128079  5.711154 .9765569 25
    10006 1978  .1020929 .0174595  5.599564 1.180962 25
    10006 1979  .1219242 .0166106   5.71841 1.148188 25
    10006 1980  .1291541 .0158416  6.029275 .9091827 25
    10006 1981  .1260228 .0220012  5.927597 1.079713 25
    10006 1982  .0707452 .0284683  5.598817 1.394729 25
    10006 1983         . .0162004   6.04085 .8742469 25
    10007 1989         . .0988984 1.8093128 .1498164 36
    10010 1986  .1315111 .1205143 2.0396607 .8253588 12
    10010 1987  .0971349  .076647  2.473846 .6089437 12
    10010 1988  .1191888 .0505933  2.848796 .4774705 12
    10010 1989  .0997793 .0626254 2.6932986 .6643519 12
    10010 1990  .1203119 .0190569  3.946284 .2305157 12
    10010 1991  .0479836 .0207386 4.5500975 .1815966 12
    10010 1992  .0824324 .0387597  4.169765 .2784134 12
    10010 1993  .1283757 .0966105  3.923771 .1499469 12
    10010 1994         . .0894412  3.997769 .1688779 12
    10012 1987  .1052932 .1010276  1.493915 .3036619 37
    10012 1988  .0500071 .0664791 1.9134238 .3398399 37
    10012 1989  .0663238 .0830875  1.429683 .5611551 37
    10012 1990 -.1067734 .1175252 1.0126244 1.256835 37
    10012 1991 -.0173474 .0143952  2.831894 .1570951 37
    10012 1992   .075859 .0079708  3.083102 .1175454 37
    10012 1993 -.0516746 .0124058 3.5206754 .2103194 37
    10012 1994  .0984672 .0182261 3.4961154 .1313031 37
    10012 1995 -.0704507 .0050087  4.650334   .12017 37
    10012 1996 -.1419341 .0177345  3.843179 .1888617 37
    10012 1997 -.1905744   .02295 4.0444264 .1359346 37
    10012 1998  .0996723 .0302348  3.573158 .1301513 37
    10012 1999  .0487396  .008036  5.075385 .0594213 37
    10012 2000  .0629077 .0391909  3.758219 .3873949 37
    10012 2001  .0262692 .0288672 4.1905117 .2793875 37
    10012 2002 -.2712731 .0738338  3.364327 .8381803 37
    10012 2003         . .0986469  3.390408 .3508258 37
    10015 1983  .0973642        0  3.290936   .30242 44
    10015 1985         .        0 3.7227614 .3223003 44
    10016 1986  .0971006 .0411898  5.948447 .7660862 12
    10016 1987   .094049 .0379149     5.897 .8888644 12
    10016 1988  .0925538   .02786  6.311408 .6652541 12
    10016 1989  .0845441 .0390437  6.017851 .7725356 12
    10016 1990  .0703844 .0600927   5.55355 1.369642 12
    10016 1991  .0645687 .0525482  5.512707 1.533058 12
    10016 1992   -.09232 .0476832  5.740683 1.272476 12
    10016 1993 -.0463903 .1053467  5.546422 .7960007 12
    10016 1994  .0643174 .1640635 4.7341013 .5784079 12
    10016 1995  .1037756 .0736338  5.255297 .2602237 12
    10016 1996  .0906871 .0665109  5.401938 .3373952 12
    10016 1997  .1661641 .0526175  5.492948 .2958848 12
    10016 1998  .1863889 .0103638  5.708351 .1839908 12
    10016 1999  .1656256 .0106731  5.815855 .2901295 12
    10016 2000         . .0138657  5.941669  .281922 12
    10017 1986   .042169 .1767167  4.992254 1.156692 35
    10017 1987         . .1077084  5.439643  .772724 35
    10019 1986  .2399631 .0312287 4.2103667 .1971189 38
    10019 1987  .2201286 .0461489 3.9501615 .3418672 38
    10019 1988  .2025597 .0602429  4.007901 .4070052 38
    10019 1989  .1942298   .04545 4.4220433 .3067358 38
    10019 1990  .1487938 .0831592  4.055439 .5577274 38
    10019 1991  .0544461 .1283635    3.7388 .7825812 38
    10019 1992  .0304486 .2123995 3.3706694 1.178376 38
    10019 1993  .0307501  .137559  3.815413 .7563379 38
    10019 1994  .0484512 .1842091  3.731502 .8542097 38
    10019 1995  .0924031 .1223869  4.181806 .5991564 38
    10019 1996  .1053643 .1089716 4.2292976 .6408843 38
    10019 1997  .1056197  .098212  4.631995 .4734034 38
    10019 1998  .0331874  .201615  5.001379 .2173244 38
    10019 1999  .0642002 .2788843  3.941118 .6897914 38
    10019 2000         . .4643338 3.1783416 1.349334 38
    10025 1986  .0910104   .00998 3.1589134 .8273231 15
    10025 1987  .0717465 .0106834 3.1434624  .987829 15
    10025 1988  .0793327 .0076291  3.488002 .8214247 15
    10025 1989  .0594297 .0038563  4.233237 .4744186 15
    10025 1990  .0605854 .0078906 3.6377506 .9801317 15
    10025 1991  .0466972 .0059468  4.114147 .6642026 15
    10025 1992  .0931269 .0063166   4.05759 .7694941 15
    10025 1993  .1068615 .0033928 4.5906653 .5188192 15
    10025 1994  .1038512 .0028597  4.881149  .472458 15
    10025 1995  .0574346 .0064576  4.692173 .1555001 15
    10025 1996  .0524974 .0018506  5.841023 .2772496 15
    10025 1997  .0537549 .0095046  5.445116 .3814954 15
    10025 1998  .0582656 .0102379  5.059279 .5515252 15
    10025 1999  .0325543 .0067924  5.471161 .2823314 15
    10025 2000  .0402142 .0057663  5.565018 .2030908 15
    
    end
    What I found is user written commands, one of which is xtfmb and other is asreg, when I run these commands both gave me an error that "factor-variable and time-series operators not allowed"

    Here are the commands
    Code:
     asreg pm1 hdm ln_mv bmv i.ind49,fmb
    and the other is
    Code:
     xtfmb pm1 hdm ln_mv bmv i.ind49, verbose
    Is there something wrong with data/commands because I have seen papers which have used dummy variables in Fama Mcbeth regressions OR is there any other way to do it in Stata?

    Regards,

    Shafaq

  • #2
    If you read the error, it says "factor-variable and time-series operators not allowed" and that is what it means. asreg and xtfmb are user written and do not apparently accept factor variable (i. or c.) notations. You'll need to create your dummies with xi and enter them explicitly.

    Comment


    • #3
      Just for reference, I replied to Shafaq post here. See the last post in the thread.
      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

      Working...
      X