filter the extreme values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

popdycentral
Posts: 7
Joined: Tue May 20, 2014 4:55 am

filter the extreme values

Postby popdycentral » Tue May 20, 2014 5:07 am

Hi, I usually can find my answers by checking the forum, but this time I have some difficulties in tackling this problem. As I'm new to this software, I thought it might be a good idea to ask help from the forum.
Here is my question:
I have a time series of stock returns over 20 years, and I'd like to create dummy variables for the returns in the top of 10% and below the 10% with a value "1", the returns fall out of this range will give a value "0". I know @recode can filter the data with a given value, however, I don't know how to manipulate the code to find a percentile.

I'm using Eviews 7.
Hope you can help here, thank you in advance!

popdycentral
Posts: 7
Joined: Tue May 20, 2014 4:55 am

Re: filter the extreme values

Postby popdycentral » Tue May 20, 2014 8:59 am

I figured the command would be:
series xtop10=@recode ( x > @quantile ( x, .10),1,0)
series xbottom10=@recode ( x < @quantile ( x, .90),1,0)

whereas I checked the output, they don't appear to be what I want.

Can anyone help.....?

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

Re: filter the extreme values

Postby EViews Esther » Tue May 20, 2014 9:08 am

Code: Select all

series xtop10 = @recode(x>@quantile(x, .90), 1, 0)
series xbottom10 = @recode(x<@quantile(x, .10), 1, 0)

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: filter the extreme values

Postby EViews Glenn » Tue May 20, 2014 10:54 am

And following up on EViews Esther's post, the all-in-one is

Code: Select all

series xrecode = @recode(x>@quantile(x, .90) or x<@quantile(x, .10), 1, 0)

popdycentral
Posts: 7
Joined: Tue May 20, 2014 4:55 am

Re: filter the extreme values

Postby popdycentral » Tue May 20, 2014 11:23 am

thanK you! That worked.


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 34 guests