scalar multiplication

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

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

Nau2306
Posts: 74
Joined: Thu Nov 17, 2011 11:51 am

scalar multiplication

Postby Nau2306 » Fri Dec 09, 2011 10:28 am

Hi

I am using eviews 6 and I am trying to perform the winsorization process where given a return series, I would like to replace all the values exceeding four times the value of the standard deviation of the series by the standard deviation times four.

series win = @recode(returns> (4 x @stdev(returns)), 4 x stdev(returns), @recode(returns < (-1 x 4 x @stdev(returns)), -1 x 4 x @stdev(returns), returns))

well i think this is what i am trying to do but i cant seem to be able to carry out scalar multiplication in eviews :(

please help me

thanks

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

Re: scalar multiplication

Postby EViews Glenn » Fri Dec 09, 2011 10:51 am

"x" should be "*".

I would also recommend that you save the @stdev to a scalar prior to this operation as it will increase the efficiency of the recoding significantly. It also makes it easier to read.

Code: Select all

scalar compval = 4*@stdev(returns) series win = @recode(returns>compval, compval, @recode(returns<-compval, -compval, returns))
Incidentally, there is an alternative expression that I believe is equivalent and avoids the double @recodes:

Code: Select all

scalar compval = 4*@stdev(returns) series win = @recode(@abs(returns)>compval, (2*(returns>0)-1)*compval, compval)

Nau2306
Posts: 74
Joined: Thu Nov 17, 2011 11:51 am

Re: scalar multiplication

Postby Nau2306 » Sat Dec 10, 2011 3:50 am

Thanks loads, it works perfectly, however the second code you provided does not produce the result i am expecting, anyways thats not a prob. thx agen. :D


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests