Removing outliers with IQR?

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

AfonsoRod
Posts: 32
Joined: Wed May 31, 2017 7:37 am

Removing outliers with IQR?

Postby AfonsoRod » Wed Feb 27, 2019 10:43 am

Dear all,

I have an hourly data-set covering a ten year period and I am facing a problem with outliers, witch my series contains in a high number.
I know that this can be dealt with by using the Inter Quantile Range. Thus, I've calculated the IQR as well as the Lower and Upper Bound by using the following formulas:

    1) UB=Q3+(1,5*IQR)
    2) LB=Q1-(1,5*IQR)

From what I have understood, an outlier is every value that is either under the lower bound or above the upper bound.

Having in mind the results shown in the image below, what code should I use in Eviews in order to remove the outliers from my data?

outliers.jpg
outliers.jpg (73.82 KiB) Viewed 331 times


I thank you all in advance for the help.

Yours sincerely,
Afonso Rodrigues

AfonsoRod
Posts: 32
Joined: Wed May 31, 2017 7:37 am

Re: Removing outliers with IQR?

Postby AfonsoRod » Thu Feb 28, 2019 8:11 am

[UPDATE]

So, I am still trying to understand what codes can I use to remove the outliers from all my variables. Searching through this forum I found this topic where I think he uses the respective code to remove the top 5% from both ends.
Can someone help me to write a similar code but, instead of removing the top 5%, I want to remove all values that are outside of the Lower Bound-Upper Bound Interval?

http://forums.eviews.com/viewtopic.php?t=7530

Thank you all in advance.

AfonsoRod
Posts: 32
Joined: Wed May 31, 2017 7:37 am

Re: Removing outliers with IQR?

Postby AfonsoRod » Thu Feb 28, 2019 8:31 am

[UPDATE2]

So, I think I figured it out. i used the following code for my first variable and I think it has done what I wanted:

Code: Select all

series lep = @recode(l_elec_price>3.1310155 and l_elec_price<4.6186515,l_elec_price,na)


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 3 guests