use @expand by specific years, and replicate trend

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

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

use @expand by specific years, and replicate trend

Postby ch2324 » Wed Apr 19, 2017 8:54 am

Hi for all,
1/i have monthly data from 1998m02 2007m09, i would like to have dummy @month=1...@month=12 for the years 2000m02 2003m07 and for 2000m01 2003m012, i have use:
show @expand(@recode(@year(@month>=2)>=2000 or @year(@month<=7)<=2003 ,1,0)) and
show @expand(@recode(@year(@month>=1)>=2000 or @year(@month<=12)<=2003 ,1,0)) but it not give my all @month=1...@month=12.
2/ i would like to replicate trend by some specific date in the same series: (use smpl every time for large data make long time), i have use @recode for all the date but it not gives me the result.
series multi_trend=@recode(@before("2003m01") or @during("2003m01 2006m12") or @after("2007m01"), @trend+1,0)
from 1998m02 to 2002m12 take 1 2 3...
from 2003m01 2006m12 take 1 2 3...
from 2007m01 at last take 1 2 3...
i have make some effort the read the tutorial and some function but no idea. Thanks in Advance.

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: use @expand by specific years, and replicate trend

Postby EViews Matt » Tue Apr 25, 2017 1:38 pm

Hello,

1) There are some serious syntax issues with your expressions, I recommend you review the basic EViews documentation and tutorials for commands and dummies. What I believe you're trying to do is:

Code: Select all

show @expand(@month, @during("2000m02 2003m07"), @drop(*, 0))
show @expand(@month, @during("2000m01 2003m012"), @drop(*, 0))

2) Your expression is effectively the same as "series multi_trend = @trend+1", which clearly isn't what you want. What you can do instead is create a series that counts up like trend, but resets back to 1 at specific dates. For example:

Code: Select all

series multi_trend = @recode(@isperiod("2003m01") or @isperiod("2007m01"), 1, @nan(multi_trend(-1), 0) + 1)

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

Re: use @expand by specific years, and replicate trend

Postby ch2324 » Wed Apr 26, 2017 12:35 am

Hello,
I understand now, i will read the basic documentation step by step and how can use some functions.
but :roll: how can take acount holiday: when i use @expand for monthly data or daily, for the 4 cases for e.g:
case1: holiday August for every year for monthly data.
case2: holiday August and July from every year monthly data.
case3: holiday August for every year and holiday Friday and Saturday for daily data 7 day/week when i use @expand.
case4: holiday August and July for every year and holiday Friday and Saturday for daily data 7 day/week when i use @expand

e.g: the case3 Friday and Saturday and August from 01/01/2000 30/06/2003 should take 0.

Code: Select all

show @expand(@weekday, @during("01/01/2000 30/06/2003") @holiday( weekday=5 and weekday=6) and @holiday(@month=8), @drop(*, 0))

it show irror message: Syntax error...
to tell you, i have read the Help i don't understand how to use this functions: @holiday("date1 [date2]", [basis]) and @event("date1 [date2]", [basis]) in my 4 cases and for general case.

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: use @expand by specific years, and replicate trend

Postby EViews Matt » Wed Apr 26, 2017 9:47 am

@expand may not be the right way to generate these more complicated dummies. Taking your case 1 for example, using the code below, is it okay that there is no dummy generated for August?

Code: Select all

show @expand(@month, @during("2000m02 2003m07") and @month <> 8, @drop(*, 0))

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

Re: use @expand by specific years, and replicate trend

Postby ch2324 » Wed Apr 26, 2017 2:33 pm

Got it!. :D
could you give an example applicable with @holiday and @event.

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: use @expand by specific years, and replicate trend

Postby EViews Matt » Wed Apr 26, 2017 4:48 pm

@event is intended for "one-off" non-repeating events, but all the holidays you've described are periodic (repeating), so @event isn't appropriate. You can use @holiday, e.g., to exclude August:

Code: Select all

show @expand(@month, @during("2000m02 2003m07") and not @holiday("Aug1 Aug31"), @drop(*, 0))

For daily data, you can use the basis feature of @holiday to include only certain days of the week in the holiday, e.g., Friday and Saturday:

Code: Select all

show @expand(@weekday, @during("1/1/2000 6/30/2003") and not @holiday("Aug1 Aug31") and not @holiday("Jan1 Dec31", "Fri-Sat"), @drop(*, 0))

Keep in mind that the above could also be expressed as:

Code: Select all

show @expand(@weekday, @during("1/1/2000 6/30/2003") and @month <> 8 and (@weekday < 5 or @weekday > 6), @drop(*, 0))

In all my examples so far, the second argument to @expand has been a logical expression that describes when the dummies are allowed to be 1. If you prefer to write an expression for when the dummies cannot be 1, just change the @drop(*, 0) to @drop(*, 1), or enclose your expression in not().

And by the way, the syntax error in one of your examples was due to a missing "and" between @during and @holiday.

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

Re: use @expand by specific years, and replicate trend

Postby ch2324 » Thu Apr 27, 2017 4:58 am

Hello,
For the moment all it's ok! :) , you have said that @event is intended for "one-off" non-repeating events, but when i write series x=@event("3/01/2000 30/06/2003", "Fri-Sat") it repeat :? Fri and Sat for my series x.
so, could you give an example applicable (non-repeating events) about @event to understand this function. (an example about a case)

and thanks! for your reply and your help.

EViews Matt
EViews Developer
Posts: 557
Joined: Thu Apr 25, 2013 7:48 pm

Re: use @expand by specific years, and replicate trend

Postby EViews Matt » Thu Apr 27, 2017 9:10 am

@holiday lets you specify annually repeating items, for example, Earth Day @holiday("Apr22"). @event is intended for single items, for example, the merger of IHS and Markit @event("7/12/2016"). That said, you can further limit @holiday and @event to specific days and times, so if the holiday or event is long enough there will be a repeating pattern of days/times. Mechanically, using @event is a shortcut for using combinations of other EViews date functions such as @during and @weekday, which works nicely for you since the dummies you want fit within the capabilities of @event. Semantically, I think it stretches the idea of an "event", which is why I prefer to use the other date functions.

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

Re: use @expand by specific years, and replicate trend

Postby ch2324 » Thu Apr 27, 2017 10:11 am

I understand well now.
thank you so much. :D


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 6 guests