Outliers

For questions regarding programming in the EViews programming language.

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

jessisam
Posts: 12
Joined: Thu May 07, 2009 2:51 am

Outliers

Postby jessisam » Wed Jun 17, 2009 4:40 am

How do I remove outliers form a group of data? I would like to remove the 2,5 % lowest and 2,5 % highest observations within this datagroup and make a new group out of this data without the outliers. I have tried this quote, but it doesn't work:

genr assets= @recode ( assets > @quantile ( assets, 0.025) or assets < 0.975)

Is there a quote to do this?

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

Re: Outliers

Postby startz » Wed Jun 17, 2009 7:33 am

How do I remove outliers form a group of data? I would like to remove the 2,5 % lowest and 2,5 % highest observations within this datagroup and make a new group out of this data without the outliers. I have tried this quote, but it doesn't work:

genr assets= @recode ( assets > @quantile ( assets, 0.025) or assets < 0.975)

Is there a quote to do this?

Code: Select all

smpl if assets > @quantile( assets, 0.025) or assets <@quantile( assets, 0.975)

jessisam
Posts: 12
Joined: Thu May 07, 2009 2:51 am

Re: Outliers

Postby jessisam » Wed Jun 17, 2009 9:31 am

So there isn't a way to generate a new group without the outliers? The reason I ask is because I first want to remove the outliers and then divide the data set into 4 quantiles and see the descriptive statistics of this. Isn't there a quote like this that removes outliers:

genr assets = @recode (assets > @quantile (assets, .025) and assets < @quantile (assets, .975)

?

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

Re: Outliers

Postby EViews Gareth » Wed Jun 17, 2009 10:04 am

First off I believe there is a mistake in Startz's code - the OR should be an AND.

Secondly, yes you can create a series like that:
series test = @recode(assets > @quantile( assets, 0.025) and assets <@quantile( assets, 0.975), assets, na)


Thirdly, if all you want is descriptive statistics, you could use Startz's approach and set the sample, then calculate the statistics.

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Outliers

Postby diggetybo » Sat Feb 21, 2015 11:19 am

I have a follow up question,

How can we specify the sample to impose the quantile restrictions on all variables?

smpl if assets > @quantile( assets, 0.025) and assets <@quantile( assets, 0.975)

The above case is only for the series "assets"

Please advise,

Thanks

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

Re: Outliers

Postby EViews Gareth » Sat Feb 21, 2015 11:58 am

You'll have to just add more and statements to the sample.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests