Page 1 of 1
Historical snapshots
Posted: Thu Mar 05, 2015 2:40 pm
by miorinnovo
Hi all,
Does anyone know how to make a series of historical quarterly "snapshots"? What I mean by this is I would like to take a monthly series and create a quarterly series of "snapshots" which would be the quarterly growth rate assuming no more growth in the quarter. For example the snap shot after the second month of the quarter is thje quarterly growth rate if the third month of the quarter equals the second month of the quarter.
Any help would be appreciated.
Re: Historical snapshots
Posted: Thu Mar 05, 2015 7:33 pm
by EViews Gareth
I don't understand. Perhaps you could provide a numerical example.
Re: Historical snapshots
Posted: Fri Mar 06, 2015 10:00 am
by miorinnovo
Sure. Say the monthly evolution for gdp in Q1 is Jan:1 Feb:2 March:3. This means gdp is growing by 1 in each month. Now say the monthly evolution for gdp in Q2 is April:4 May:5 June:6. To calculate the growth rate we would take the average of the second quarter and divide by the average of the first minus 1. (4+5+6)/(1+2+3) -1
So a snapshot after getting May's data for example is the assumptiong that June gdp equals May gdp, in other words, June is also 5. In that case the snapshot for growth in Q2 would be (4+5+5)/(1+2+3) -1.
Does that make sense?
Re: Historical snapshots
Posted: Fri Mar 06, 2015 10:08 am
by EViews Gareth
Still not 100% certain I understand what the resulting series is.
Is it a quarterly series or a monthly series? If it is quarterly, does it always assume that month 3 of the quarter is missing, and just fill it in with the value of month 2?
Re: Historical snapshots
Posted: Fri Mar 06, 2015 11:26 am
by miorinnovo
I don't think it can be done by creating one new series because I want to have quarterly growth rates with missing monthly variables, but the missing month has to change.
The snapshot for Q2 would require replacing the third month of Q2 with the second month of Q2. This is true for every subsequent quarter. But the problem is that I need the third month to be included inthe previous quarter to calculate the growth rate.
Said another way I need Jan Feb March April May and then another May, but then next quarter I need Apr May June July August August
Re: Historical snapshots
Posted: Fri Mar 06, 2015 11:36 am
by EViews Gareth
Something along these lines (a little overly-complex perhaps, but I think it works):
Code: Select all
create(page=mymonthly) m 1990 2010
series x = rnd
pagecreate(page=myquarterly) q 1990 2010
copy(c=f) mymonthly\x myquarterly\first
copy(c=l) mymonthly\x myquarterly\last
copy(c=s) mymonthly\x myquarterly\sum
series middle = sum-first-last
series snapshot = sum/(first(-1)+middle(-1)+middle(-1))-1
Re: Historical snapshots
Posted: Fri Mar 06, 2015 12:11 pm
by miorinnovo
I can't follow what this is doing.
I think the best way to do it would be to create a quarterly growth rate series from the monthly series. Can that be done? Just calculate (M4+M5+M5)/(M1=M2+M3) -1?
Re: Historical snapshots
Posted: Fri Mar 06, 2015 12:16 pm
by EViews Gareth
Code: Select all
copy(c=f) mymonthly\x myquarterly\first
copy(c=l) mymonthly\x myquarterly\last
Copies the first month of the quarter into the series "first", the last month of the quarter into the series "last". EViews doesn't have a way to copy the middle month of the quarter, so I copied the sum of the three months instead, then subtracted the first and last from the sum to get the middle:
Code: Select all
copy(c=s) mymonthly\x myquarterly\sum
series middle = sum-first-last
Then I create the snap shot series as being the sum of this quarter's months (held in the series "sum") and divide it by last quarter's first month plus two times last quarter's second month:
Code: Select all
series snapshot = sum/(first(-1)+middle(-1)+middle(-1))-1
Re: Historical snapshots
Posted: Fri Mar 06, 2015 12:25 pm
by miorinnovo
I see. thanks for the explanation. The only issue is that now when I want a growth rate it will be calculating it without using the full previous quarter in the denominator. :?
Re: Historical snapshots
Posted: Fri Mar 06, 2015 12:48 pm
by EViews Gareth
Sorry, yes, I got my calculation wrong:
Code: Select all
series snapshot = (first+middle+middle)/sum(-1) -1
Re: Historical snapshots
Posted: Fri Mar 06, 2015 1:40 pm
by miorinnovo
Oh my goodness. This worked! Thanks a million!