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
scalar multiplication
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: scalar multiplication
"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.
Incidentally, there is an alternative expression that I believe is equivalent and avoids the double @recodes:
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))Code: Select all
scalar compval = 4*@stdev(returns)
series win = @recode(@abs(returns)>compval, (2*(returns>0)-1)*compval, compval)Re: scalar multiplication
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
Who is online
Users browsing this forum: No registered users and 1 guest
