many trend in the series

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

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

many trend in the series

Postby ecofin » Fri Jan 06, 2017 9:15 am

Hi,
i have a problem to make many trend in the series, i use this code but i get not the result (for example the year 2005m10 should start by 1 and finish by 3 not start by 10 and finished by 12), i can use step by step to make many trend (use smpl) but it take a long time because i have many trend...etc, is there an easy way to do this. :x

Code: Select all

series trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @@during("2007m01 2007m04") or @during("2008m01 2009m02") or.....or......etc,1,0)
series trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @@during("2007m01 2007m04") or @during("2008m01 2009m02") or.... or......etc,@cumsum(1),0)

Best Regards.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Mon Jan 09, 2017 11:16 am

any help.

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

Re: many trend in the series

Postby EViews Gareth » Mon Jan 09, 2017 11:42 am

Don't understand the question.
Follow us on Twitter @IHSEViews

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Mon Jan 09, 2017 1:11 pm

the fisrt code it generate dummy for each date, when i use in the second code @cumsum(1) it generate continuous trend.
from 2005m01 2005m07 the trend start by 1 to 7
from 2005m10 2005m12 it start by 10 to 12 (should start by 1 to 3)
........etc.
is there an easy way to do all this by simple code.

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

Re: many trend in the series

Postby EViews Gareth » Mon Jan 09, 2017 1:20 pm

Not really.
Follow us on Twitter @IHSEViews

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Mon Jan 09, 2017 1:47 pm

generate trend from 2005m01 2005m07 start by 1 and finish by 7. (7 obs)
generate trend from 2005m10 2005m12 srat by 1 2 3. (3 obs)
generate trend from 2007m01 2007m04 start by 1 2 3 4 . (4 obs)
generate trend from2008m01 2009m02 start by 1 2 3 4 5...14 (14 obs)
for example if i use this code

Code: Select all

series trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @during("2007m01 2007m04") or @during("2008m01 2009m02"),1,0)

Code: Select all

series ss=@recode(trends,@cumsum(trends),0)

how can transforme the value 1 in trend (broken trend)
Last edited by ecofin on Tue Jan 10, 2017 8:44 am, edited 1 time in total.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Tue Jan 10, 2017 4:25 am

ecofin wrote:generate trend from 2005m01 2005m07 start by 1 and finish by 7. (7 obs)
generate trend from 2005m10 2005m12 srat by 1 2 3. (3 obs)
generate trend from 2007m01 2007m04 start by 1 2 3 4 . (4 obs)
generate trend from2008m01 2009m02 start by 1 2 3 4 5...14 (14 obs)
for example if i use this code

Code: Select all

series trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @during("2007m01 2007m04") or @during("2008m01 2009m02"),1,0)

Code: Select all

series ss=@recode(trends,@cumsum(trends),0)

how can transforme the value 1 in trend (broken trend)
Attachments
trends.png
trends.png (27.45 KiB) Viewed 7550 times

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

Re: many trend in the series

Postby EViews Gareth » Tue Jan 10, 2017 9:26 am

You'll have to set the sample and reassign those values.
Follow us on Twitter @IHSEViews

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Tue Jan 10, 2017 11:52 am

i get the same result when i write this code Mr Gareth, and it take long time to use smpl each time

Code: Select all

smpl @all
series ss=0
smpl 2005m01 2005m07
series ss=@recode(trends,@cumsum(trends),0)
smpl 2005m10 2005m12
series ss=@recode(trends,@cumsum(trends),0)
smpl 2005m10 2005m12
series ss=@recode(trends,@cumsum(trends),0)
smpl 2007m01 2007m04
series ss=@recode(trends,@cumsum(trends),0)
smpl 2008m01 2009m02
series ss=@recode(trends,@cumsum(trends),0)
smpl @all

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

Re: many trend in the series

Postby EViews Gareth » Tue Jan 10, 2017 12:02 pm

Just do something like:

Code: Select all

trends=trends(-1)+1
Follow us on Twitter @IHSEViews

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

Re: many trend in the series

Postby startz » Tue Jan 10, 2017 12:19 pm

or something like
smpl 2005m01 2005m07
ss = 1 + @trend("2005m01")

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: many trend in the series

Postby ecofin » Tue Jan 10, 2017 3:28 pm

solved thank you Mr Gareth and Mr starz

Code: Select all

series trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @during("2007m01 2007m04") or @during("2008m01 2009m02"),1,0)
trends=@recode(@during("2005m01 2005m07") or @during("2005m10 2005m12") or @during("2007m01 2007m04") or @during("2008m01 2009m02"),trends(-1)+1,0)
trends=@recode(trends=na, @cumsum(1),trends)

or use the code:

Code: Select all

trends=@recode(trends=na, 1 + @trend("2005m01"), trends)

is there an easy way to simplify the second and third code (combinate the third code in the second).


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 13 guests