Announcement

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

  • standard deviation of CF

    Hi all. I have 3 years data of Cash flows. I want to create the new variable called standard deviation of cash flows.

    My criteria of computing standard deviation should consider current year and previous two years cash flow value. My data looks like as follows. Anyone can help me with the codes please? thank you.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Sc_CFO2011 Sc_CFO2012 Sc_CFO2013)
              .             .           .
      -.3860381     -.3597933           .
              .             .           .
     -.10475975    -.03570958 -.012102192
      .13857491     .12891544    .1740137
      -.4435588    -.20759946   -.2458681
      .12072135      .1313896   .13192604
     -.16103554    -.03993411  -.05328979
              .             .           .
     -.00276379     .00193762 -.006666118
     -.04520761    -.05725682   .09006368
       .2112188    -.10498337  .018807584
              .             .           .
              .             .           .
     -.05324906    -.06125481  -.11283514
       .1106137     .10489891   .08966232
       .1955397     .22058703   .21639615
      .03848699    .073502414   .07481907
    -.012009406     .06544434  .020994816
       .0837502     .10066172    .1712667
              .             .           .
      .08046798     .13804372   .08676395
              .             .           .
      .13697949      .1616734   .16869096
      -.1813328    -.05625737   .09287822
              .             .           .
      .14158474     .17264888   .08286411
              .             .           .
      -.4685636     .05922992  -1.1937827
     -.05163642    -.05220062  -.01189538
       -.065637    -.04525664 -.072647795
     -.08890636     -.0762267  -.08330552
      .07204117     .16871414     .054863
       .0626024      .0438548   .03790539
              .             .           .
     -.12775278     .08454742       .0934
      -.3819858    -.55436945  -.43332285
       .3747621   -.035379045           .
      .04088739             .           .
      .06248074             .           .
     -.02301202     .14632961    .3567229
     -.05743625  -.0006619134 -.016407728
       .1222202      .2101468           .
              .             .           .
     -.04806253   -.015108452           .
      .11089886     .10421222   .06004208
       .2016897      .1713293   .17307273
              .             .           .
      -.2503514    -.25209895  -.15952137
      .06760907     .11057123   .12650084
       -.094936    -.03730988  -.16313663
              .             .           .
      -9.636364    -20.166666   -58.93333
      .10380463      .0541729   .10153043
      .03165128     .05052466   .02681478
      .19489187     .13970853           .
              .             .           .
     .020391755     .04367191  .033030257
     -.42333275     -.3990178    -.357005
     -.01881255    -.04085186 -.021425257
      .08228289      .2824856   .08012997
              .             .           .
     -.10583363    -.10653073  -.08476888
    -.009980716 -.00012072205 -.006988566
      .20636426      .2398241    .2161358
      .19440664     .13564143   .09825218
      -.1679828    -.09390076   -.1784905
              .             .           .
      .07121068    -.11485796    .3798301
              .             .           .
      -.6930873    -.28440118   -3.095238
      .31792295      .3091469    .3296374
     .002574812     .03772387   .02346682
    -.009663402    -.17643294           .
              .             .           .
      .11030339     .09558129   .10725558
      .10646547     -.9043319  -.10057916
              .             .           .
    -.003388156             .           .
     -.05011038    -.14857869  .009492666
              .             .           .
      -.1915949     .02684863    .0372381
              .             .           .
      -.1674009    -.22213195   -.3792751
              .             .           .
              .             .           .
    -.030865636    -.04978596  .007142148
     -.27316326    -.03482294  -.02767962
              .             .           .
              .             .           .
              .             .           .
       .0387801     .04703472           .
      .09665805     .23170248    .2026429
     -.12292805    -.16540617    .1491008
    -.030086186     -.0499874  -.05682465
     -.06342081      .1893176    .4214724
      .04060564     .05316626    .0903033
         .15465     .23040645   .23989803
     -1.4675187     -1.403818           .
       .1351545      .2909707    .2134148
    end

  • #2
    P.S. In other words I want to calculate the volatility or Standard deviation of each firm year observation using these 3 years historical value.

    Comment


    • #3
      So, does each observation in your table correspond to a different firm? If so, use the -rowsd()- function with -egen-. See -help egen- for details.

      Comment


      • #4
        its a panel data setting, hence it means i have three years observations of CF for each firm. Therefore I want to calculate SD of CF for each firm using the three year historical CF value.

        Comment


        • #5
          Thanks i sorted it out using the following code:

          egen SD_CFO = rowsd(Sc_CFO2011-Sc_CFO2013)

          Comment

          Working...
          X