Page 1 of 1

scalar multiplication

Posted: Fri Dec 09, 2011 10:28 am
by Nau2306
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

Re: scalar multiplication

Posted: Fri Dec 09, 2011 10:51 am
by EViews Glenn
"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)

Re: scalar multiplication

Posted: Sat Dec 10, 2011 3:50 am
by Nau2306
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