Re: Finding Mode of ranks

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Finding Mode of ranks

Art Kendall-2
for ratings the process is the same as rankings except that there is no need for values that represent tied rankings.

Open a new instance of SPSS.  Copy the syntax below to a syntax file. Click <run>. Click <all>.
Is this what you are looking for?


data list list/ id(f2) v1 to v6 (6f3).
begin data
01 1 2 3 4 1 4
02 4 1 4 3 2 1
03 1 1 3 4 1 4
04 1 2 2 4 1 4
01 1 2 3 3 1 4
04 1 2 3 4 4 4
07 1 2 3 4 1 1
08 1 1 3 3 1 1
09 2 2 2 4 1 4
10 3 3 3 3 3 3
11 2 2 2 2 1 1
12 1 1 2 2 2 2
13 3 3 3 3 3 4
14 1 1 2 2 3 3
end data.
count k1   = v1 to v6(1).
count k2   = v1 to v6(2).
count k3   = v1 to v6(3).
count k4   = v1 to v6(4).
compute mosthits = max(k1 to k4).
formats k1 to k4 mosthits (f1).
compute mode1 =0.
compute mode2 =0.
compute mode3 =0.
formats mode1 to mode3 (f3).
do if mosthits ne 1.
do repeat
  k = k1 to k4
 /v = 1 to 4.
do if  k eq mosthits.
do if mode1 eq 0.
compute mode1 =v.
else if mode1 gt 0 and mode2 eq 0 and  v gt mode1.
compute mode2 =v.
else if mode2 gt 0 and mode3 eq 0 and v gt mode2.
compute mode3 =v.
end if.
end if.
end repeat.
end if.
list vars= id v1 to v6 mosthits mode1 mode2 mode3.



Art Kendall
Social Research Consultants



Statmanz wrote:
Thanks Art. In this case each variable has a rank from 1 to 4 (integers) and
then I want to determine the mode across the variables

W

On 3/24/2009 11:33:05 AM, [hidden email] wrote:
  
I am a little confused if you have ranks for the variables, wouldn't the
responses be 1 to 6 each value occurring once in the set of six, unless
there were a tie say at 3.



Open a new instance of SPSS.  Copy the syntax below to a syntax file.
Click <run>. Click <all>.
Is this what you are looking for?


data list list/ id(f2) v1 to v6 (6f3.1).
begin data
01 1 2 3 4 5 6
02 6 5 4 3 2 1
03 1.5 1.5 3 4 5 6
04 1 2.5 2.5 4 5 6
05 1 2 3.5 3.5 5 6
06 1 2 3 4.5 4.5 6
07 1 2 3 4 5.5 5.5
08 1.5 1.5 3.5 3.5 5.5 5.5
13 1.5 1.5 3 4 5.5 5.5
09 2 2 2 4 5 6
10 3.5 3.5 3.5 3.5 3.5 3.5
11 2.5 2.5 2.5 2.5 5.5 5.5
12 3 3 3 3 3 6
end data.
count k1   = v1 to v6(1).
count k1.5 = v1 to v6(1.5).
count k2   = v1 to v6(2).
count k2.5 = v1 to v6(2.5).
count k3   = v1 to v6(3).
count k3.5 = v1 to v6(3.5).
count k4   = v1 to v6(4).
count k4.5 = v1 to v6(4.5).
count k5   = v1 to v6(5).
count k5.5 = v1 to v6(5.5).
count k6   = v1 to v6(6).
compute mosthits = max(k1 to k6).
formats k1 to k6 mosthits (f1