Transformation of series - returns NAs

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

sean123
Posts: 34
Joined: Wed Apr 25, 2012 11:53 am

Transformation of series - returns NAs

Postby sean123 » Thu Nov 15, 2012 8:45 am

Hi,

I'm composing a program which makes a number of forecasts. At the beginning of the program, data is read from an Excel file. The data is in its original form, and further transformations are needed before the forecasts are made.

What I want is essentially that some of the series are transformed, but his, however, returns NAs as long as I perform it on the series themselves! For example, you may run the following program.

Code: Select all

wfcreate q 1990q1 2009q4 genr y=nrnd series x=d(y) y=d(y)
y is full of NAs where x consists of the differentiated original y series, and this is what I want. My solution is basically this, but instead of a generated series I apply this to my data read from Excel:

Code: Select all

wfcreate q 1990q1 2009q4 genr y=nrnd rename y y2 y=d(y2) d y2
This feels a bit clumsy and I would like to find a cleaner way around this. Anyone have any ideas?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13586
Joined: Tue Sep 16, 2008 5:38 pm

Re: Transformation of series - returns NAs

Postby EViews Gareth » Thu Nov 15, 2012 9:08 am

EViews calculates series sequentially (and if it didn't, lots and lots of things would break). Thus what actually happens when you type:

Code: Select all

y=d(y)
is that the very first observation for Y is calculated first. It is set to NA, since there is no value for lagged Y in this case, so the difference has to be an NA.

Then the second observation is calculated. We just updated the first observation to an NA, so now the second observation, calculated as the second observation minus the first, receives an NA. Then the third observation is calculated, also getting an NA, and so on...

There is no way around it, other than by doing what you're doing.

Of course, given that EViews will let you use the expression d(Y) in pretty much any calculation you'd want to make, there usually isn't really a need to create the transformed series in the first place.

sean123
Posts: 34
Joined: Wed Apr 25, 2012 11:53 am

Re: Transformation of series - returns NAs

Postby sean123 » Fri Nov 16, 2012 12:31 am

Thanks, Gareth. I was suspecting that the NAs were a result of the type of calculation you described. I'll use my way around it then, but at least now I know for sure that there is nothing else causing the missing observations.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests