I just fixed in #14 the last line of code where I broke my rule not to use an if conditional when using an egen command. The correct way to set the first 32 observations per group is:
Again, I do not see your data, code, and results but if you run the example in #12, it generates results based on the value of Error^2 starting on 1995q1 (that's 33 weeks from 1987q1) for both series 1 and 2 and the results match the rolling results. The data for series 2 is derived from the data for series 1 but is not the same and the results are different for series 2.
If you exclude the mata function definition, my rangestat solution in #12 spans 6 lines of code, 5 of which are basic Stata commands. You have the tools in hand to get there. I did my part, now it's time for you to figure things out.
Code:
by series: replace MSFE = . if _n < 33
If you exclude the mata function definition, my rangestat solution in #12 spans 6 lines of code, 5 of which are basic Stata commands. You have the tools in hand to get there. I did my part, now it's time for you to figure things out.
Comment