Page 1 of 1
many trend in the series
Posted: Fri Jan 06, 2017 9:15 am
by ecofin
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.
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.
Re: many trend in the series
Posted: Mon Jan 09, 2017 11:16 am
by ecofin
any help.
Re: many trend in the series
Posted: Mon Jan 09, 2017 11:42 am
by EViews Gareth
Don't understand the question.
Re: many trend in the series
Posted: Mon Jan 09, 2017 1:11 pm
by ecofin
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.
Re: many trend in the series
Posted: Mon Jan 09, 2017 1:20 pm
by EViews Gareth
Not really.
Re: many trend in the series
Posted: Mon Jan 09, 2017 1:47 pm
by ecofin
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)
Re: many trend in the series
Posted: Tue Jan 10, 2017 4:25 am
by ecofin
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)
Re: many trend in the series
Posted: Tue Jan 10, 2017 9:26 am
by EViews Gareth
You'll have to set the sample and reassign those values.
Re: many trend in the series
Posted: Tue Jan 10, 2017 11:52 am
by ecofin
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
Re: many trend in the series
Posted: Tue Jan 10, 2017 12:02 pm
by EViews Gareth
Re: many trend in the series
Posted: Tue Jan 10, 2017 12:19 pm
by startz
or something like
smpl 2005m01 2005m07
ss = 1 + @trend("2005m01")
Re: many trend in the series
Posted: Tue Jan 10, 2017 3:28 pm
by ecofin
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).