generate trend for dummy

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

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Wed Oct 29, 2014 7:47 am

can you hepl me Mr Gareth.

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

Re: generate trend for dummy

Postby EViews Gareth » Wed Oct 29, 2014 9:11 am

I still don't follow what you're trying to do.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Thu Oct 30, 2014 11:57 am

sorry! this is my workfile, i hope that you understand me what i mean. just i would to generate trend and dummy for different frequency.
it's very important for me Mr Gareth.

many thanks in advance.
Attachments
sales3.WF1
(209.4 KiB) Downloaded 337 times

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

Re: generate trend for dummy

Postby EViews Gareth » Thu Oct 30, 2014 12:00 pm

Still not clear.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Thu Oct 30, 2014 12:12 pm

see the picture
Attachments
weekday_3.png
weekday
weekday_3.png (13.35 KiB) Viewed 9287 times
daily_2.png
daily
daily_2.png (16.61 KiB) Viewed 9287 times
intraday_1.png
interday
intraday_1.png (15.06 KiB) Viewed 9287 times
Last edited by ch2324 on Thu Oct 30, 2014 12:17 pm, edited 2 times in total.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Thu Oct 30, 2014 12:13 pm

and this
Attachments
fortnight_5.png
fortnight
fortnight_5.png (19.12 KiB) Viewed 9289 times
tenday_4.png
tenday
tenday_4.png (14.41 KiB) Viewed 9289 times

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

Re: generate trend for dummy

Postby EViews Gareth » Thu Oct 30, 2014 1:10 pm

Showing pictures isn't asking a question...

But I think at least one of your columns is just the @month variable.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Fri Oct 31, 2014 7:11 am

question: generate trend and dummy for different frequency.
1-interday:
genr trend (t1): from 03/01/2000 08:00 to 03/01/2000 10:00 take 1
from 04/01/2000 08:00 to 04/01/2000 10:00 take 2. and so on

genr trend (2): from 03/01/2000 08:00 to 03/01/2000 10:00 take 1 2 3 4 5.
from 04/01/2000 08:00 to 04/01/2000 10:00 take 1 2 3 4 5. and son on

genr dum1: the first 03/01/2000 08:00 and the last 03/01/2000 10:00 take 1
the first 04/01/20000 08:00 and the last 04/01/2000 10:00 take 1. and so on

2-daily
genr trend (t3): the first month take 1, the second month take 2, the third month take 3...etc

genr trend (t4): the first month take 1 2 3...29, the second month take 1 2 3...29, the third month take 1 2 3...31,...and son on

3-weekday
genr trend (t5): the first month take 1 next month take 2 and so on

genr trend (t6): the first month take 1 2 3...5, the second month take 1...4, and son on.

4-tenday
genr trend (t7): the first month take 1 next month take 2 and so on

genr trend (t8): the first month take 1 2 3 next month take 1 2 3 and so on

genr dum2: the first tenday and the last take 1 for every month.

5-fortnight
genr trend (t9): the first month take 1 next month take 2 and so on

genr trend (t10): the first month take 1 2 3 next month take 1 2 and so on

genr dum3: the first and last fortnight take 1 for every months.

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

Re: generate trend for dummy

Postby EViews Gareth » Fri Oct 31, 2014 8:10 am

A few of these will have issues at the start of the workfile, but:


1-Interday:

Code: Select all

series dum1 = @datepart(@date, "ddd")-3 series dum2 = @recode(@day<>@day(-1), 1, dum2(-1)+1) series dum3 = @recode(@day<>@day(-1) or @day<>@day(1), 1, 0)
2-daily:

Code: Select all

series dum1=@month series dum2 = @day
3-weekday:

Code: Select all

series dum1= @month series dum2= @recode(@month<>@month(-1), 1, dum(-1)+1)

That should get you doing, anyway

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Fri Oct 31, 2014 11:30 am

problem
1-inraday:
the code for dum1 generate trend for the first year, it not continue for the second year 2001 it repeat.

Code: Select all

series dum1 = @datepart(@date, "ddd")-3
2-daily:
same problem for the code dum1 (and same problem for fortnight & tenday)

Code: Select all

series dum1=@month
3-weekday:
A- same problem for the code dum1 (and same problem for fortnight & tenday)

Code: Select all

series dum1=@month
B- when i une the code for dum2 it chow error message '' dum is not defined "

Code: Select all

series dum2= @recode(@month<>@month(-1), 1, dum(-1)+1)
4- when i use the code for dum2 (tenday & fortnight) it not generate trend for example: frequency tenday
11/01/2000 take 11 it should equal 2.
21/01/2000 take 21 it should equal 3.

Code: Select all

series dum2 = @day
Attachments
dum2222.png
dum2222.png (55.6 KiB) Viewed 9248 times
dum11111.png
dum11111.png (81.43 KiB) Viewed 9248 times

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Tue Nov 04, 2014 10:28 am

can you help me Mr Gareth.

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

Re: generate trend for dummy

Postby EViews Gareth » Tue Nov 04, 2014 10:58 am

Code: Select all

series dum1=@cumsum(@recode(@datefloor(@date,"d")<>@datefloor(@date(-1) ,"d"),1,0))
That's pretty general, and will solve the intraday. For the monthly ones, change the "d" to an "m".

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Tue Nov 04, 2014 11:31 am

thanks a lot,
this code for dummy chow error message

Code: Select all

series dum2= @recode(@month<>@month(-1), 1, dum(-1)+1)
what can i do. :oops:
Attachments
dummy2.png
dummy2.png (37.35 KiB) Viewed 9212 times

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

Re: generate trend for dummy

Postby EViews Gareth » Tue Nov 04, 2014 11:38 am

series dum2= @recode(@month<>@month(-1), 1, dum2(-1)+1)

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend for dummy

Postby ch2324 » Tue Nov 04, 2014 12:11 pm

thanks for your help. :D


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests