Hi Stata experts,
I am currently trying to document returns from momentum strategies using panel data.
I want to make a plot containing lines for each strategie (normal momentum, intermediate momentum and for both a dynamic version, 4 in total).
I have four variables WML1, WML2, WML1d, WML2d.
Each variables contains the returns for month 2013-2022. So every company every month contains the same value (see dataex). This is because the value is the calculated return for that strategy in each month, meaning it doesn't differ for a different company it is just the overall return for that month.
For the cumulative returns I think i want to take the log return for every return and then sum these returns and plot then against my variable mofd containing the month.
I am worried that when I sum the log returns, it will sum every return, so instead of summing one return of every month, it will also sum the returns within the month.
Do you have a code for generating a variable cumulative return.
My data looks like this
I hope you can help me. Thanks a lot.
I am currently trying to document returns from momentum strategies using panel data.
I want to make a plot containing lines for each strategie (normal momentum, intermediate momentum and for both a dynamic version, 4 in total).
I have four variables WML1, WML2, WML1d, WML2d.
Each variables contains the returns for month 2013-2022. So every company every month contains the same value (see dataex). This is because the value is the calculated return for that strategy in each month, meaning it doesn't differ for a different company it is just the overall return for that month.
For the cumulative returns I think i want to take the log return for every return and then sum these returns and plot then against my variable mofd containing the month.
I am worried that when I sum the log returns, it will sum every return, so instead of summing one return of every month, it will also sum the returns within the month.
Do you have a code for generating a variable cumulative return.
My data looks like this
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str6 Code float(mofd WML1 logWML1) "9215PR" 731 -.2165781 -.2440839 "9526R7" 731 -.2165781 -.2440839 "692612" 731 -.2165781 -.2440839 "9216VU" 731 -.2165781 -.2440839 "29509W" 731 -.2165781 -.2440839 "912326" 731 -.2165781 -.2440839 "255383" 731 -.2165781 -.2440839 "74085P" 731 -.2165781 -.2440839 "9459TV" 731 -.2165781 -.2440839 "923388" 731 -.2165781 -.2440839 "9406X3" 731 -.2165781 -.2440839 "533153" 731 -.2165781 -.2440839 "8694XQ" 731 -.2165781 -.2440839 "9445LM" 731 -.2165781 -.2440839 "9535FE" 731 -.2165781 -.2440839 "697661" 731 -.2165781 -.2440839 "698992" 731 -.2165781 -.2440839 "8725EZ" 731 -.2165781 -.2440839 end format %tm mofd
