Page 1 of 1

count positive group items

Posted: Sun Jul 31, 2011 9:53 am
by lomfy
hey there,

i'm trying to program non-parametric tests whether a certain set of observations is significantly different from zero.

in order to program the simple sign test and wilcoxon and corrado rank sign tests, i need to solve the following issue:

suppose i have the following series grouped (in reality they're many more):

rs1 rs2 rs3 rs4
+1 -2 +2 +3
-2 -3 -1 -1
+2 +4 -1 -2
...

can anybody think of a way to count the number of positive items in a row?

what i need to have is a series containing these numbers (concerning all the series in the group) which would look like this for my example:
pos
3
0
2
...

thankful for any advice!

Re: count positive group items

Posted: Mon Aug 01, 2011 9:17 am
by EViews Glenn
The only way I can think is to create a new group with a @recoded version of each series and they count the number of observations in each row. You can do this in a small program without too much effort. Suppose group GRP1 has your series and that there is no group GRP2 in the workfile...

Code: Select all

group grp2 for !i=1 to group01.@count %name = group01.@seriesname(!i) grp2.add @recode({%name}>0, {%name}, na) next series numpos = @robs(grp2) delete grp2
Here, we create a copy of the original group with new series that are based on the old, but with NAs whenever the series value is non-positive. Then we count the number of valid observations.

Re: count positive group items

Posted: Mon Aug 01, 2011 3:37 pm
by lomfy
hey glenn! marvelous, that worked very well...so i'm done with programming all statistical tests i need thanks to you guys' help!
thanks a lot!!!!! :)