Page 1 of 1

Removing outliers with IQR?

Posted: Wed Feb 27, 2019 10:43 am
by AfonsoRod
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 4383 times
I thank you all in advance for the help.

Yours sincerely,
Afonso Rodrigues

Re: Removing outliers with IQR?

Posted: Thu Feb 28, 2019 8:11 am
by AfonsoRod
[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.

Re: Removing outliers with IQR?

Posted: Thu Feb 28, 2019 8:31 am
by AfonsoRod
[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)