Announcement

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

  • Problem in running regression with beta/coefficient that are estimated based on month, year, and country

    Hi,

    I am currently working on a panel dataset (15 EU countries for 15 years). I have approximately 7300 data comprising of fundamentals information from multiple companies from different countries and year. I have a regression equation that look like this PB = b0 + b1roe + b2leverage + b3RND etc., + e
    I would like to run a regression that allows for each treatment variable (roe,leverage,rnd) to be separately estimated by the month, year and country, with fiscal years falling in the 12-month window ending in month m-1 of year y. For example coefficient for march 2008 are estimated by country using all firms with fiscal year end from 2007 through February 2008. Therefore the beta or coefficient would look like this Bcmy. The desired outcome that I would like to obtain out of this equation is the median coefficient and standard errors by year (from 2002 to 2016).
    I tried using the ssc asreg "bysort year CurrentFiscalYearEndMonth CurrentISOCountryCodeIncor: asreg PB ROEready RNDready LEVready" however the outcome generates some missing value which I am also not sure whether this is the right code to use.
    I tried to generate the data through dataex as seen below

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(PBready ROEready LEVready RNDready) int year byte CurrentFiscalYearEndMonth str3 CurrentISOCountryCodeIncor
     2.501992   .22056963     1.4670886   .0439127 2002  1 "FRA"
     .9965728 -.010727056     .04386174   .2514096 2002  1 "FRA"
      2.78899    .0900184      .5920326 .008851121 2002  3 "FRA"
     .6334071  -.11643155      .5996423 .016627148 2002  3 "FRA"
     6.608397   -.1338486      .3021003 .024569996 2002  3 "FRA"
     .0971978 .0020639836     1.1801376  .07070528 2002  3 "FRA"
    1.6154306  -.05894583      .1180996  .07520621 2002  5 "DEU"
    .22132427   .15421036      .1815995  .02372183 2002  6 "FRA"
      4.01267   .33485195      .5054485  .08253022 2002  6 "FRA"
     .6657547  -.10321123             0 .015558808 2002  8 "DEU"
    .05388878   -.9597693      .4103953    .051802 2002  9 "DEU"
     3.379321  .070527285             0   .1678453 2002  9 "DEU"
     .3793055  -.17807257     .04592275   .1870879 2002  9 "DEU"
    .51270676  .011335916    .015425456  .17126264 2002  9 "DEU"
    2.5424826   .03546665      .3734435  .10433023 2002  9 "DEU"
    1.4651828   .11041197      .4354832  .06926062 2002  9 "DEU"
    .17458844   .29191756    .017979816   .0490125 2002  9 "NLD"
     .4889281   -.3171233             0   .2578869 2002  9 "NLD"
     2.655715  -.05951535      .3898171  .01935532 2002 12 "BEL"
     .5394989   -.0884109     .13530505  .06627381 2002 12 "BEL"
     2.011141   .14027476     .48083875   .0529575 2002 12 "BEL"
    1.8065038    .1687703      .3916336  .05013892 2002 12 "BEL"
     2.745315    .0994887      .3052833 .002145309 2002 12 "BEL"
    .19615325  -.06549847     .55540633  .07967845 2002 12 "BEL"
    3.0185804   .24911647     .04999597  .14057754 2002 12 "BEL"
     1.287757    .0422771      .7376518 .005315501 2002 12 "BEL"
    .10233635   -.3386864      .2086739  .01466511 2002 12 "BEL"
     4.376657   .15507407      .2499764 .015744422 2002 12 "BEL"
    14.962033    .1698887   .0017574693  .01961198 2002 12 "DEU"
    4.5375695    .3372018      .1029913  .05714334 2002 12 "DEU"
     .8751419   .01844172     .16250384  .01863337 2002 12 "DEU"
    2.1571429   -.8049549      .4088401  .06344415 2002 12 "DEU"
     5.442753   .10837727     .22085787 .025447164 2002 12 "DEU"
     .3769042   -1.703446      .4426773   .1858746 2002 12 "DEU"
     4.953071  -1.1824311     .11398914   1.169183 2002 12 "DEU"
     1.556017   .10869005   .0041701626  .01640392 2002 12 "DEU"
     .4467585   -.7064934   .0003442246  .04234625 2002 12 "DEU"
    1.3440048   .02798005     .10274063 .016996719 2002 12 "DEU"
      5.87459    .2083515             0 .005855615 2002 12 "DEU"
    2.8817124    .1805593     1.2459283 .020198647 2002 12 "DEU"
     .4881609  -.44505045 .000030900916 .031418554 2002 12 "DEU"
      1.92073   -.8516082      .3737817   .2123062 2002 12 "DEU"
    1.0306753 -.011357614     .14795184  .05718863 2002 12 "DEU"
    .51089525  -.20148303     .11809663 .012979218 2002 12 "DEU"
    .10291866  -1.0448582             0   .1602102 2002 12 "DEU"
     .5730759   .05065738      .2975638  .01983557 2002 12 "DEU"
     .3598839   .05911022      .0911895  .03530624 2002 12 "DEU"
     .6664566   -.7726374      .4177446   .0062833 2002 12 "DEU"
     .6160062   -.6003456             0  .28277555 2002 12 "DEU"
     2.642094   .12900597      .7688438 .029153215 2002 12 "DEU"
    2.1150463   .01605743     .45360425  .04826149 2002 12 "DEU"
      2.52395   -.4510309      .1572165  .10676835 2002 12 "DEU"
     .3107454   -.6736197     .04059732  .32876635 2002 12 "DEU"
      .376853  -.02921353             0  .11302073 2002 12 "DEU"
       .66889  -.54542226             0   .8584071 2002 12 "DEU"
    1.8121578   .20726496      .6012821  .00886501 2002 12 "DEU"
     4.774646   .12061794      .7546643  .08138523 2002 12 "DEU"
     .3817754  .010508094     .08953138   .1097979 2002 12 "DEU"
    1.0852587  -.15649834     .04431737 .031412087 2002 12 "DEU"
    .37710705  -.29013616     .01022627  .07242809 2002 12 "DEU"
    1.6711057  -1.1101563             0 .001792452 2002 12 "DEU"
      .479313   .09309833      .4775604 .028163636 2002 12 "DEU"
     .4903025 -.015567716      .5357945 .011187978 2002 12 "DEU"
    2.2117758  -.12586667     1.3621334 .022835566 2002 12 "DEU"
     .7684557    .1396861      1.397262  .04058616 2002 12 "DEU"
     .5806255   .01517721    .033352893 .013543376 2002 12 "DEU"
     .8207924   .05363528      .4306714  .02150873 2002 12 "DEU"
    .09770728   -.8172043    .018330773   .0487846 2002 12 "DEU"
    1.0410833   .09805055             0  .08020724 2002 12 "DEU"
     1.342729   .09005567     .17294085  .02836905 2002 12 "DEU"
     .7030928   .22867852     .26641548  .01980642 2002 12 "DEU"
     .8065854   .07882356      .3304667  .15993802 2002 12 "DEU"
    1.2576966   .13509406      .9230101  .04756161 2002 12 "DEU"
    1.0136155   .02376993     .10587818  .13083273 2002 12 "DEU"
     .3626794   .00691348     .08633968  .06181116 2002 12 "DEU"
    .15556324  -.07540452     .12750772  .09831785 2002 12 "DEU"
     2.883697  -.02713133      .6812069  .01051874 2002 12 "DEU"
     3.074653   .04581846      .9110928 .016970545 2002 12 "DEU"
     .3446856   .02930433      .7991381  .03324976 2002 12 "DEU"
    1.3887497   .10213708   .0019612485  .04050211 2002 12 "DEU"
    1.8156796   .07802318   .0001153336  .03104684 2002 12 "DEU"
     .5976862   .06912292       .477209  .08743697 2002 12 "DEU"
    2.3231912   .09092283     .11250521   .0352408 2002 12 "DEU"
     .9926935   .13176306      1.111882  .04305637 2002 12 "DEU"
     .3765133  -.28253514             0  .17025778 2002 12 "DEU"
     .5812076  -1.0716673      2.598589 .003095494 2002 12 "DEU"
    1.6630104   .18955117     .09466209  .06890064 2002 12 "DEU"
     3.652923   .08902733    .018388264   .1670039 2002 12 "FIN"
     1.470671   -.3428717     .36101705 .025584945 2002 12 "FIN"
     4.182527   .14893901      .4090635  .02173701 2002 12 "FIN"
     1.906931   .07947977      .6933526 .004391408 2002 12 "FIN"
     1.264242   .11295794     .56071913 .003408683 2002 12 "FIN"
     .9243179  -.26771626     .02717709  .04061502 2002 12 "FIN"
    21.843977   .19158944      .7642595  .01773771 2002 12 "FIN"
     3.443972      .19592       .618259  .03777195 2002 12 "FIN"
    15.830564   .15597697     1.0701946  .01451011 2002 12 "FIN"
    1.0098228   .10721224      .5146916  .00549426 2002 12 "FIN"
    1.6306534   .11560883      .3356914  .08539633 2002 12 "FIN"
     .6516293   .08572516     .02020032  .04574978 2002 12 "FIN"
      .689446   .07452567      .5525226 .008627627 2002 12 "FIN"
    end
    ------------------ copy up to and including the previous line ------------------

    My question would be:
    1. Did I use the right command? if not
    2. What would be the right code to obtain this coefficient betacmy.
    Thank you in advance.

    Best,

    Kevin

  • #2
    I'm not certain I understand what you want to do, but it sounds like you want to do, within each country, a series of rolling regressions using a 12 month backward window (not including the current month) based on the fiscal year end month and year.

    To do that you need two things. First you need a variable that actually gives both the month and year together. Then you need a command to do rolling regressions. There are several of the latter, but my personal favorite is -rangestat-, by Robert Picard, Nick Cox, and Roberto Ferrer, available from SSC.

    Code:
    gen mdate = ym(year, CurrentFiscalYearEndMonth)
    format mdate %tm
    rangestat (reg) PBready ROEready LEVready RNDready, by(CurrentISOCountryCodeIncor) ///
        interval(mdate -12 -1)
    I don't see any reason to have a separate coefficient variable for each country month and year combination. Those will have mostly missing values anyway. The coefficients can be understood as applying to the particular country month and year of the observation in which they occur.

    If this is not what you are looking for, please post back with a clearer explanation.

    Comment


    • #3
      Apologies for not being clear enough in my previous post, currently I am replicating a paper by Young, S. and Zeng, Y. (2015). Accounting Comparability and the Accuracy of Peer-Based Valuation Models. The Accounting Review. I adapted the authors' research design, and I tried using the command that you provided. I agree that this command leads to lots of missing value. Based on how I understand it, the regression output from equation 6 (see attached below) should generate a coefficient beta that enables equation 7 (see attached below) to be calculated and generated. However, with lots of missing values I believe that equation 7 can't be obtained fully.

      Pardon for my limited knowledge, but why does it generate some missing values?
      And what is the most appropriate way/ command to deal with this situation?

      If I got it correctly, my problem is also similar to the thread created by River Huang
      ( https://www.statalist.org/forums/for...values-and-sum) particularly on his equation 1 and 2 in which I am also trying to obtain a predicted value on for my equation 7 based on regression on equation 6.
      I believe that the authors (Young & Zeng, 2015) separate the coefficient because they would not constrain firms to have the same fiscal year end. I hope I already specify the problem. Any suggestions are highly appreciated. Thank you in advance.
      Click image for larger version

Name:	Equation6.png
Views:	1
Size:	23.2 KB
ID:	1491786

      Click image for larger version

Name:	Equation 7.png
Views:	1
Size:	137.8 KB
ID:	1491787



      Best,

      Kevin
      Last edited by Kevin Lim; 04 Apr 2019, 04:43.

      Comment


      • #4
        I'm afraid I don't find the explanation from the original article any more enlightening than yours was. So I'm still not sure if the code I wrote implements what you want, though I still think it likely does.

        As for getting missing values, you are doing a regression equation with several predictor variables. The regression is carried out only on those firms that fall within a certain chronological window and are matched on country. Even though we specify a 12 month window, in the first month of a firm's data that window will be empty, so with nothing to regress, the output is missing. In the second month of a firm's data, that window will contain only one observation--that of the preceding year. But you cannot do a regression with 3 predictors and only one observation. So that output is also missing. And so on. Eventually, we reach a point where the number of observations in the window will be large enough to support a regression on 3 predictors. The minimum to get coefficients is 4 variables. The minimum to get both coefficients and standard errors is 5. Anything less produces missing values for the regression results.

        Comment


        • #5
          Thank you for your explanation about the missing values. After reviewing it, I believe that the code you gave me in the previous post was correct, and Indeed that is how the author formulated it. In the result section of the regression, I can see that the author also get some missing values.

          Comment

          Working...
          X