Create new time series object based on values of another

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

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

PChindamo
Posts: 7
Joined: Mon May 23, 2016 8:18 pm

Create new time series object based on values of another

Postby PChindamo » Mon May 23, 2016 8:24 pm

I'm new to Eviews and this user forum. I need help with the following to create a new time series object called B:

A is an existing time series object; B is a new calculated time series object

IF(A>(2089.71+70), B = A -70))

IF(A >(180+3.49), B=(A-3.49+0.035*180)/1.035))

IF(A<180, B=(A-3.49))

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

Re: Create new time series object based on values of another

Postby startz » Mon May 23, 2016 8:32 pm

Look at @recode()

PChindamo
Posts: 7
Joined: Mon May 23, 2016 8:18 pm

Re: Create new time series object based on values of another

Postby PChindamo » Mon May 23, 2016 9:08 pm

I did try recode but Eviews returned an error message about too many arguments.

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

Re: Create new time series object based on values of another

Postby EViews Gareth » Mon May 23, 2016 9:15 pm

You probably did something wrong.

PChindamo
Posts: 7
Joined: Mon May 23, 2016 8:18 pm

Re: Create new time series object based on values of another

Postby PChindamo » Mon May 23, 2016 9:20 pm

That's really insightful - I thought I had probably done something wrong when Eviews returned an error. Is there any advice you can provide beyond "you probably did something wrong"?

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

Re: Create new time series object based on values of another

Postby EViews Gareth » Mon May 23, 2016 9:24 pm

Not without out knowing what you did.

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

Re: Create new time series object based on values of another

Postby startz » Mon May 23, 2016 9:58 pm

Well I know what you did.
You gave @recode more than 3 arguments.

PChindamo
Posts: 7
Joined: Mon May 23, 2016 8:18 pm

Re: Create new time series object based on values of another

Postby PChindamo » Mon May 23, 2016 10:22 pm

yes I gave @recode more than 3 arguments. How do I fix this if there are three categories (arguments)? Do I need to do each one at a time?

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

Re: Create new time series object based on values of another

Postby EViews Gareth » Mon May 23, 2016 10:30 pm

You will have to nest a couple of recodes inside each other.

Code: Select all

Series a = @recode(x<5, @recode(x<3, 10, 20), 30)

PChindamo
Posts: 7
Joined: Mon May 23, 2016 8:18 pm

Re: Create new time series object based on values of another

Postby PChindamo » Mon May 23, 2016 11:52 pm

thanks, I will give it a try.

bob_dubai
Posts: 2
Joined: Tue Jun 07, 2016 2:48 am

Re: Create new time series object based on values of another

Postby bob_dubai » Tue Jun 07, 2016 2:59 am

Greetings:
I have a similar problem.
I have two series

First series : Personal_Income ( $ )
Second series : Age ( years old )

i would like to make a group with two new series :

Personal_Income_Of_Young :: Income of people below 25
Personal_income_Of_Old :: income of people above 50

If i could get these new series into a group , then i could call .testbtw and
get stats on the differences in these two age groups

there seems to be no way to "Freeze" a smpl command after i create one of
the new series.
Hope this is understandable ..

Many thanks for any hints or advice --!

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

Re: Create new time series object based on values of another

Postby EViews Gareth » Tue Jun 07, 2016 3:07 am

What you're describing doesn't really fit in with the structure of EViews.


All series in a workfile page have the same structure - the same number of observations.

So you have two series:

Code: Select all

Income Age 10,000 25 12,000 23 34,000 45 56,000 60 13,000 22
Which means you have 5 observations. Any new series you create will also have 5 observations. So in your case where you say you want to create a series that will contain income information for those under 25, what would the other 3 observations be?

bob_dubai
Posts: 2
Joined: Tue Jun 07, 2016 2:48 am

Re: Create new time series object based on values of another

Postby bob_dubai » Tue Jun 07, 2016 3:12 am

thanks for the reply - I would NOT have 5 samples any more, I would have two unequal series

I found that I could create two (unequal length ) vectors and then do the
required stats on the vectors with my own code, but could not get
Groups to accept vectors as members so I could not call .testbtw on the group members .

I will try the "stats by classification " -
Oh well, thanks for the confirmation that my approach needs reconsideration

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

Re: Create new time series object based on values of another

Postby EViews Gareth » Tue Jun 07, 2016 3:13 am

I think a specific solution to your overall problem would be to do the following:
  • Create an indicator series that is equal to 1 for young people, 0 for middle aged and 2 for old people:

    Code: Select all

    series indicator = @recode(age>50,2, @recode(age<25,1,0))
  • set the sample to be if indicator>0 (i.e. only young or old people):

    Code: Select all

    smpl if indicator>0
  • Open up the income series and click on View->Descriptive Statistics->Equality Tests by Classification, and enter Indicator as the classifying series.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests