|
RANK2Name:
Nonparameteric analysis is often based on ranked data rather than the original data. This command may be helpful in implementing nonparameteric methods that are not directly supported by Dataplot.
<SUBSET/EXCEPT/FOR qualification> where <y1> is a response variable to be ranked; <x1> is a group-id variable; <y2> is a variable where the ranked <y1> values are saved; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used for the case where we are ranking based on one group-id variable.
<SUBSET/EXCEPT/FOR qualification> where <y1> is a response variable to be ranked; <x1> is the first group-id variable; <x2> is the second group-id variable; <y2> is a variable where the ranked <y1> values are saved; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used for the case where we are ranking based on two group-id variables.
<SUBSET/EXCEPT/FOR qualification> where <y1> is a response variable to be ranked; <x1> is the first group-id variable; <x2> is the second group-id variable; <x3> is the third group-id variable; <y2> is a variable where the ranked <y1> values are saved; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used for the case where we are ranking based on three group-id variables.
LET Y2 = RANK2 Y X1 X2 LET Y2 = RANK2 Y X1 X2 X3 LET Y2 = RANK2 Y X1 SUBSET X1 > 2
If you want to extract the rankings for a specific group, you can do something like the following
skip 25 read gear.dat y x . let x2 y2 = rank2 x y . set write decimals 3 print x y x2 y2The following output is generated. VARIABLES--X Y Y2 1.000 1.006 10.000 1.000 0.996 4.000 1.000 0.998 5.000 1.000 1.000 7.500 1.000 0.992 1.000 1.000 0.993 2.000 1.000 1.002 9.000 1.000 0.999 6.000 1.000 0.994 3.000 1.000 1.000 7.500 2.000 0.998 4.500 2.000 1.006 9.500 2.000 1.000 6.500 2.000 1.002 8.000 2.000 0.997 3.000 2.000 0.998 4.500 2.000 0.996 2.000 2.000 1.000 6.500 2.000 1.006 9.500 2.000 0.988 1.000 3.000 0.991 2.000 3.000 0.987 1.000 3.000 0.997 7.000 3.000 0.999 8.500 3.000 0.995 4.000 3.000 0.994 3.000 3.000 1.000 10.000 3.000 0.999 8.500 3.000 0.996 5.500 3.000 0.996 5.500 4.000 1.005 10.000 4.000 1.002 8.500 4.000 0.994 1.500 4.000 1.000 7.000 4.000 0.995 3.000 4.000 0.994 1.500 4.000 0.998 6.000 4.000 0.996 4.500 4.000 1.002 8.500 4.000 0.996 4.500 5.000 0.998 8.500 5.000 0.998 8.500 5.000 0.982 2.000 5.000 0.990 4.000 5.000 1.002 10.000 5.000 0.984 3.000 5.000 0.996 6.500 5.000 0.993 5.000 5.000 0.980 1.000 5.000 0.996 6.500 6.000 1.009 8.500 6.000 1.013 10.000 6.000 1.009 8.500 6.000 0.997 5.000 6.000 0.988 2.000 6.000 1.002 7.000 6.000 0.995 3.000 6.000 0.998 6.000 6.000 0.981 1.000 6.000 0.996 4.000 7.000 0.990 1.000 7.000 1.004 8.000 7.000 0.996 2.500 7.000 1.001 6.000 7.000 0.998 4.000 7.000 1.000 5.000 7.000 1.018 10.000 7.000 1.010 9.000 7.000 0.996 2.500 7.000 1.002 7.000 8.000 0.998 3.500 8.000 1.000 5.500 8.000 1.006 9.500 8.000 1.000 5.500 8.000 1.002 7.500 8.000 0.996 1.500 8.000 0.998 3.500 8.000 0.996 1.500 8.000 1.002 7.500 8.000 1.006 9.500 9.000 1.002 8.000 9.000 0.998 5.500 9.000 0.996 3.500 9.000 0.995 2.000 9.000 0.996 3.500 9.000 1.004 9.500 9.000 1.004 9.500 9.000 0.998 5.500 9.000 0.999 7.000 9.000 0.991 1.000 10.000 0.991 2.500 10.000 0.995 5.000 10.000 0.984 1.000 10.000 0.994 4.000 10.000 0.997 7.000 10.000 0.997 7.000 10.000 0.991 2.500 10.000 0.998 9.000 10.000 1.004 10.000 10.000 0.997 7.000Program 2: skip 25 read ripken.dat y x1 x2 x3 x4 . let y2 = rank3 y x1 x2 . set write decimals 3 print x1 x2 y y2The following output is generated. VARIABLES--X1 X2 Y Y2 1.000 1.000 0.400 4.000 1.000 2.000 0.354 2.000 1.000 3.000 0.388 4.000 2.000 1.000 0.380 4.000 2.000 2.000 0.409 2.000 2.000 3.000 0.391 3.000 3.000 1.000 0.136 2.000 3.000 2.000 0.322 4.000 3.000 3.000 0.304 3.000 1.000 1.000 0.166 1.500 1.000 2.000 0.333 1.000 1.000 3.000 0.000 1.000 2.000 1.000 0.300 1.500 2.000 2.000 0.875 4.000 2.000 3.000 1.000 4.000 3.000 1.000 0.166 4.000 3.000 2.000 0.090 1.000 3.000 3.000 0.333 4.000 1.000 1.000 0.382 3.000 1.000 2.000 0.373 4.000 1.000 3.000 0.223 2.000 2.000 1.000 0.333 3.000 2.000 2.000 0.350 1.000 2.000 3.000 0.304 2.000 3.000 1.000 0.086 1.000 3.000 2.000 0.280 3.000 3.000 3.000 0.218 2.000 1.000 1.000 0.166 1.500 1.000 2.000 0.363 3.000 1.000 3.000 0.333 3.000 2.000 1.000 0.300 1.500 2.000 2.000 0.454 3.000 2.000 3.000 0.285 1.000 3.000 1.000 0.162 3.000 3.000 2.000 0.211 2.000 3.000 3.000 0.000 1.000
Date created: 12/4/2008 |