genr x from quarterly page to yield a particular annual growth rate

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Sat Oct 13, 2018 4:03 am

Hi

Can you please describe how to generate a series in a quarterly page to match a specified annual growth rate?

I am looking for a command of the type

Code: Select all

!annualgrowthrate=2.5
smpl 2018:2 2019
genr x = ... (?)....


where the series x already exists in the workfile up to 2018:2 and the expression .... (?).... will generate the series x, from 2018:2 onwards, that will yield the annual growth rate of 2.5 per cent in 2019. To do this one must of course assume something about the development of x. Lets assume that x has a constant quarterly growth rate, i.e. x/x(-1)=constant. Under this assumption one can calculate the development of x which yields the annual growth rate of 2.5 per cent, but I do not know how this is done in EViews.

Can you please give me a clue on how to proceed?
Thomas

(this type of command may be useful when excluding an endogenous variable in a quarterly model and where one wants to set the annual growth rate of that variable over the exclusion period)

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby startz » Sat Oct 13, 2018 6:53 am

Maybe

Code: Select all

x = (1+!annualgrowthrate/4)*x(-1)

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Sat Oct 13, 2018 10:41 pm

Hi startz

Thanks for your suggestion! I see that I was somewhat imprecise in my first post. I would like the annual growth rate to be

!annualgrowthrate=100 * ( (x8+x7+x6+x5) / (x4+x3+x2+x1)-1),

where x1, x2, ..., x8 are observations of x in different quarters, where quarters 1,2,3,4 are in Year 1 and quarters 5,6,7,8 are in Year 2.

Lets consider a couple of different situations:
1) We know the value x1
2) We know the value x1, x2, x3.
3) We know the value of x1, x2, x3, x4, x5, x6.

What I would like is a routine that creates the values x for the situations above, i.e.
1) x2, x3, x4, x5, x6, x7, x8
2) x4, x5, x6, x7, x8
3) x7, x8

so that the annual growth rate of the series x in all situations equals !annualgrowthrate (under the assumption of a constant quarterly growth rate for x).

Thomas

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby startz » Sun Oct 14, 2018 6:52 am

If you only know x1, for example, I don't see how you can compute (x8+x7+x6+x5) / (x4+x3+x2+x1)

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Sun Oct 14, 2018 8:17 am

Hi

In that particular example, by assuming constant quarterly growth (say g) in x, we have

x = g * x(-1)

which means that in our particular case:

x1=x1
x2=g*x1
x3=g^2*x1
x4=g^3*x1
x5=g^4*x1
x6=g^5*x1
x7=g^6*x1
x8=g^7*x1

By inserting in the expression for the annual growth rate we get:

!annualgrowthrate = 100 * ( (x8+x7+x6+x5) / (x4+x3+x2+x1)-1),
= 100 * ( (g^7*x1+g^6*x1+g^5*x1+g^4*x1) / (g^3*x1+g^2*x1+g^1*x1+g^0*x1)-1)
= 100 * ( (g^7+g^6+g^5+g^4) / (g^3+g^2+g^1+1)-1),

which, for a given specified annual growth rate, is one equation with one unknown: the quarterly growth rate "g". I am hoping for an easy way to calculate this "unknown" constant quarterly growth rate for all possible cases, i.e. where the value of x might be known for quarter 1 up to 7.
Thomas

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby startz » Sun Oct 14, 2018 10:02 am

I think

Code: Select all

!annualgrowthrate = 100 * (@mav(x,4)/@mav(x(-4),4)-1)

works. But I'd give it a test.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Sun Oct 14, 2018 11:47 am

Thanks for this startz! and thanks for looking into this. But it does not give me the quarterly growth rate... it gives the annual growth rate (every q4). i would like to first specify the annual growth rate, and then generate a series, in a given smpl, that will yield this specified annual growth rate based on an assumed constant quarterly growth rate:

Code: Select all

!annualgrowthrate=2.5
smpl 2018:2 2019
!quarterlygrowthrate=...?...
genr x =!quarterlygrowthrate* x(-1)


But I am starting to doubt if there is an easy way of generating such a series....

Thomas

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby EViews Matt » Mon Oct 15, 2018 9:02 am

Hello,

If you carry the algebra through a little further you'll see that,

!annualgrowthrate = 100 * (!quarterlygrowthrate^4 - 1)

Consequently,

!quarterlygrowthrate = (!annualgrowthrate / 100 + 1)^(1/4)

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Mon Oct 15, 2018 9:42 am

hi matt!

thanks for your response. Yes, in that particular example, it follows what the quarterly growth rate must be. However, if more of the x-series is known during the time period under consideration, it becomes more complex. Consider again situation 3) described above, and illustrated in the picture below

annual_growth.PNG
annual_growth.PNG (9.13 KiB) Viewed 12316 times


in this case, we know x for the first 6-quarters in the 8-quarter time period covering the 2 years 2017 and 2018. how can I, in this situation, calculate x7=2018:3 and x8=2018:4 so that the annual growth rate in x from 2017 to 2018 becomes, say 2.5 per cent (given the assumption of a constant quarterly growth rate)?
thomas

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby EViews Matt » Mon Oct 15, 2018 2:53 pm

Fundamentally, determining the quarterly growth rate as you've described involves solving a polynomial, a polynomial with degree matching the number of unknown quarters. For a scenario with no more than four unknowns (e.g., the unknowns begin in 2018), there are algebraic solutions, though the solutions for degrees three (unknown x6, x7, x8) and four (unknown x5, x6, x7, x8) are pretty ugly. The solutions for one (x8) and two (x7, x8) unknowns are:

(x8) !quarterlygrowthrate = ((!annualgrowth / 100 + 1) * (x1 + x2 + x3 + x4) - x5 - x6 - x7) / x7
(x7, x8) !quarterlygrowthrate = (-x6 +- @sqrt((4 * (!annualgrowth / 100 + 1) * (x1 + x2 + x3 + x4) - 4 * x5) * x6 - 3 * x3^2)) / (2 * x6)

For (x7, x8), I'd expect only one of the solutions to be positive. Pre-apologies if I've screwed up transcribing from Maxima output to the above.

Above four unknowns, there is no guaranteed algebraic solution, although the degree seven polynomial (unknown x2 through x8) has a convenient cancellation leading to the previously mentioned algebraic solution. Regardless, it's easiest to find a solution numerically (perhaps via an EViews model?).
Last edited by EViews Matt on Wed Oct 17, 2018 2:28 pm, edited 1 time in total.

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Wed Oct 17, 2018 12:28 am

Hi Matt

Thanks again for looking into this. I have tried to make an EViews model to solve for the quarterly growth rate given a specified annual growth rate. Attached are two programs. The first "create_example.prg" generates a series x and calls on another program "setpcy.prg". This program is supposed to create a model that solves for the quarterly growth rate. However, i get the error message when solving the model:

error.PNG
error.PNG (3.24 KiB) Viewed 12270 times

This could very well be due to an incorrectly specified model. The model looks like this:


Code: Select all

x = g * x(-1)

g =
@recode(@quarter = 1 , (1 + 2.5 / 100) = (g^3 * x + g^2 * x + g * x + x) / (x(-1) + x(-2) + x(-3) + x(-4)) ,
@recode(@quarter = 2 , (1 + 2.5 / 100) = (g^2 * x + g^1 * x + x + x(-1)) / (x(-2) + x(-3) + x(-4) + x(-5)) ,
@recode(@quarter = 3 , (1 + 2.5 / 100) = (g * x + x + x(-1) + x(-2)) / (x(-3) + x(-4) + x(-5) + x(-6)) , (1 + 2.5 / 100) = (x + x(-1) + x(-2) + x(-3)) / (x(-4) + x(-5) + x(-6) + x(-7)) ) )) + g


Can you please take a look at these programs and let me know what I have done wrong and how I should proceed?
Thomas
Attachments
create_example.prg
(591 Bytes) Downloaded 323 times
setpcy.prg
(881 Bytes) Downloaded 305 times

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: genr x from quarterly page to yield a particular annual growth rate

Postby EViews Matt » Wed Oct 17, 2018 2:26 pm

After further reflection, an EViews model seems a cumbersome way to determine the quarterly growth rate. I've attached an updated version of your setpcy.png that uses an equation object instead. I've only implemented cases for generating up to a year's worth of data (x5 through x8 in your earlier examples), but it could certainly be extended cover x2 through x4. See what you think.
Attachments
setpcy.prg
(1.23 KiB) Downloaded 364 times

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: genr x from quarterly page to yield a particular annual growth rate

Postby tvonbrasch » Thu Oct 18, 2018 5:28 am

Brilliant program Matt, just what I was looking for! Thank you. Highly appreciated!

Thomas


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 9 guests