Home › Forums › ASROL : Rolling Window and by-Group Descriptive Statistics › rolling command panel data
Tagged: asrol, Panel data, rolling standard deviation, Stata
-
AuthorPosts
-
APARECIDA DE FATIMA ALVES DE LIMA
GuestJuly 16, 2020 at 7:23 amPost count: 118Can you please help me to calculate the standard deviation of the moving average of the last 4 years of ebitda, in an 18-year data panel?
This can be easily done using asrol. Let’s assume that your panel identifier is
id
and time identifier isyear
. The asrol code you would use is given below.bysort id : asrol ebitda, gen(sd_ebitda) stat(sd) window(year 4) min(4)
The min(4) option ensures that at least 4 observations are available for the calculation of the standard deviation.
APARECIDA DE FATIMA ALVES DE LIMA
GuestJuly 16, 2020 at 7:06 pmPost count: 118very good! I will follow this path. Thanks!!
APARECIDA DE FATIMA ALVES DE LIMA
GuestJuly 16, 2020 at 7:36 pmPost count: 118Thanks, I have got the results.
___________________________________________________ EBITDA_w empresa ano2 sd_EBITDA_w ___________________________________________________ 0 524 Particip 2001 .6949924 524 Particip 2002 .7736318 524 Particip 2003 .2955975 524 Particip 2004 .36091502 .1612284 524 Particip 2005 .29891669 .2536765 524 Particip 2006 .27420603 .1506352 524 Particip 2007 .07077126 .1462069 524 Particip 2008 .05088494 .254717 524 Particip 2009 .06109785 3.082896 524 Particip 2010 1.4503886 3.342857 524 Particip 2011 1.7430165 .7713718 524 Particip 2012 1.576531 .1252485 524 Particip 2013 1.6212501 .5900621 524 Particip 2014 1.4494201 .4056225 524 Particip 2015 .27580191 .7866667 524 Particip 2016 .28136591 1.56 524 Particip 2017 .50738521 1.430107 524 Particip 2018 .54438681 _________________________________________________
-
This reply was modified 3 years, 2 months ago by
Attaullah Shah.
-
This reply was modified 3 years, 2 months ago by
Attaullah Shah.
APARECIDA DE FATIMA ALVES DE LIMA
GuestJuly 21, 2020 at 5:29 amPost count: 118Hello! now i need to calculate only the moving average of the last 4 years of the ebitda value, in an 18-year data panel. Can you help me please?
Attaullah Shah
GuestJuly 21, 2020 at 1:39 pmPost count: 118The code is the same as used in my earlier reply. That calculates the moving average of the last 4 years. If you want to exclude the current year, then the code would be:
bysort id : asrol ebitda, gen(sd_ebitda) stat(sd) window(year 5) min(4) xf(focal)
APARECIDA DE FATIMA ALVES DE LIMA
GuestJuly 21, 2020 at 6:31 pmPost count: 118thank you for your reply. Maybe I didn’t ask the right question. In my panel what I need now is the average of the absolute value of the ebitda, for the same period. I need to build a variable with:
= sd_ebitda / ma_ebitda -
This reply was modified 3 years, 2 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.