Computing individual-level ranks from the counts

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Computing individual-level ranks from the counts

mils
Hi everyone,

I have the below dataset that contains data from a survey that shows respondents a card with 5 random brands and ask them to select which is the best (1) and which is the worst (-1) brand. The one's not selected but shown get a value of 0. In total each respondent sees 6 different cards with a total of 10 brands.

Dataset:
http://surveyanalysis.org/images/0/06/ItMaxDiff.sav

So far, and using the below syntax, I've managed to get the aggregated counts/mean for each Brand and rank them, showing which is the prefered brand.

comp suma1=mean(maxDiff1alt1,maxDiff2alt1,maxDiff3alt1,maxDiff4alt1,maxDiff5alt1,maxDiff6alt1).
comp suma2=mean(maxDiff1alt2,maxDiff2alt2,maxDiff3alt2,maxDiff4alt2,maxDiff5alt2,maxDiff6alt2).
comp suma3=mean(maxDiff1alt3,maxDiff2alt3,maxDiff3alt3,maxDiff4alt3,maxDiff5alt3,maxDiff6alt3).
comp suma4=mean(maxDiff1alt4,maxDiff2alt4,maxDiff3alt4,maxDiff4alt4,maxDiff5alt4,maxDiff6alt4).
comp suma5=mean(maxDiff1alt5,maxDiff2alt5,maxDiff3alt5,maxDiff4alt5,maxDiff5alt5,maxDiff6alt5).
comp suma6=mean(maxDiff1alt6,maxDiff2alt6,maxDiff3alt6,maxDiff4alt6,maxDiff5alt6,maxDiff6alt6).
comp suma7=mean(maxDiff1alt7,maxDiff2alt7,maxDiff3alt7,maxDiff4alt7,maxDiff5alt7,maxDiff6alt7).
comp suma8=mean(maxDiff1alt8,maxDiff2alt8,maxDiff3alt8,maxDiff4alt8,maxDiff5alt8,maxDiff6alt8).
comp suma9=mean(maxDiff1alt9,maxDiff2alt9,maxDiff3alt9,maxDiff4alt9,maxDiff5alt9,maxDiff6alt9).
comp suma10=mean(maxDiff1alt10,maxDiff2alt10,maxDiff3alt10,maxDiff4alt10,maxDiff5alt10,maxDiff6alt10).
desc suma1 to suma10.

DATASET COPY     Unroll.
DATASET ACTIVATE Unroll WINDOW=FRONT.
VARSTOCASES
   /MAKE    Score FROM suma1 TO suma10
   /INDEX = MsgName(Score)
   /NULL  = DROP.

DATASET DECLARE  Summary.
AGGREGATE OUTFILE=Summary
    /BREAK=MsgName
    /Mean 'Mean score'          = MEAN(Score).

DATASET ACTIVATE  Summary  WINDOW=FRONT.
SORT CASES BY Mean (D).
FORMATS  Mean (F7.4).

NUMERIC  Rank (F3).
COMPUTE  Rank = $CASENUM.
LIST.

MsgName    Mean Rank

suma4     .3579    1
suma7     .2650    2
suma10    .1442    3
suma1     .1432    4
suma2    -.0118    5
suma5    -.0876    6
suma6    -.1154    7
suma9    -.1891    8
suma8    -.2051    9
suma3    -.3013   10


Number of cases read:  10    Number of cases listed:  10

However,  I would like now to compute the rankings. I would like to show the proportion of people that have their highest count for each of the different brands as shown in the table below:

           1    2    3    4    5    6    7    8    9   10
Apple          22.8 11.9 11.9  5.8  9.3  6.1  6.4  4.8  9.3 11.9
Microsoft       5.4  9.0 11.9 13.5 14.1 12.2 10.3  9.6  5.1  9.0
IBM             1.9  1.6  5.1  7.4  9.0  7.4 12.8 17.6 20.5 16.7
Google         21.8 20.5 15.7 10.3  7.1 11.5  4.8  4.2  2.9  1.3
Intel           3.5  5.8  8.3 14.1 13.8 12.8 11.2 12.2 10.3  8.0
HewlettPackard  4.2  8.7  9.3  7.4  8.7 11.5 10.9 16.0 11.2 12.2
Sony           16.0 15.7 16.0 13.8  9.0 10.6  7.7  6.4  3.2  1.6
Dell            5.8  8.0  3.5  8.3 10.3  7.4 11.5  7.4 19.6 18.3
Yahoo           1.9  6.4  7.7  6.1  8.0 13.8 14.7 14.1 12.5 14.7
Nokia          16.7 12.5 10.6 13.5 10.9  6.7  9.6  7.7  5.4  6.4

Thanks in advance!
mils
Reply | Threaded
Open this post in threaded view
|

Re: Computing individual-level ranks from the counts

Maguin, Eugene
I'm not sure that this gives what you want but it's how I understand what you want. You have

           1    2    3    4    5    6    7    8    9   10
Apple          22.8 11.9 11.9  5.8  9.3  6.1  6.4  4.8  9.3 11.9
Microsoft       5.4  9.0 11.9 13.5 14.1 12.2 10.3  9.6  5.1  9.0
IBM             1.9  1.6  5.1  7.4  9.0  7.4 12.8 17.6 20.5 16.7
Google         21.8 20.5 15.7 10.3  7.1 11.5  4.8  4.2  2.9  1.3
Intel           3.5  5.8  8.3 14.1 13.8 12.8 11.2 12.2 10.3  8.0
HewlettPackard  4.2  8.7  9.3  7.4  8.7 11.5 10.9 16.0 11.2 12.2
Sony           16.0 15.7 16.0 13.8  9.0 10.6  7.7  6.4  3.2  1.6
Dell            5.8  8.0  3.5  8.3 10.3  7.4 11.5  7.4 19.6 18.3
Yahoo           1.9  6.4  7.7  6.1  8.0 13.8 14.7 14.1 12.5 14.7
Nokia          16.7 12.5 10.6 13.5 10.9  6.7  9.6  7.7  5.4  6.4

I assume the variables are brand, y1 to y10.
So. Varstocases with y=y1 to y10. Followed by Aggregate with break=brand and ymax=max(y).

Gene Maguin











-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of mils
Sent: Wednesday, April 22, 2015 6:43 AM
To: [hidden email]
Subject: Computing individual-level ranks from the counts

Hi everyone,

I have the below dataset that contains data from a survey that shows respondents a card with 5 random brands and ask them to select which is the best (1) and which is the worst (-1) brand. The one's not selected but shown get a value of 0. In total each respondent sees 6 different cards with a total of 10 brands.

Dataset:
http://surveyanalysis.org/images/0/06/ItMaxDiff.sav

So far, and using the below syntax, I've managed to get the aggregated counts/mean for each Brand and rank them, showing which is the prefered brand.

comp
suma1=mean(maxDiff1alt1,maxDiff2alt1,maxDiff3alt1,maxDiff4alt1,maxDiff5alt1,maxDiff6alt1).
comp
suma2=mean(maxDiff1alt2,maxDiff2alt2,maxDiff3alt2,maxDiff4alt2,maxDiff5alt2,maxDiff6alt2).
comp
suma3=mean(maxDiff1alt3,maxDiff2alt3,maxDiff3alt3,maxDiff4alt3,maxDiff5alt3,maxDiff6alt3).
comp
suma4=mean(maxDiff1alt4,maxDiff2alt4,maxDiff3alt4,maxDiff4alt4,maxDiff5alt4,maxDiff6alt4).
comp
suma5=mean(maxDiff1alt5,maxDiff2alt5,maxDiff3alt5,maxDiff4alt5,maxDiff5alt5,maxDiff6alt5).
comp
suma6=mean(maxDiff1alt6,maxDiff2alt6,maxDiff3alt6,maxDiff4alt6,maxDiff5alt6,maxDiff6alt6).
comp
suma7=mean(maxDiff1alt7,maxDiff2alt7,maxDiff3alt7,maxDiff4alt7,maxDiff5alt7,maxDiff6alt7).
comp
suma8=mean(maxDiff1alt8,maxDiff2alt8,maxDiff3alt8,maxDiff4alt8,maxDiff5alt8,maxDiff6alt8).
comp
suma9=mean(maxDiff1alt9,maxDiff2alt9,maxDiff3alt9,maxDiff4alt9,maxDiff5alt9,maxDiff6alt9).
comp
suma10=mean(maxDiff1alt10,maxDiff2alt10,maxDiff3alt10,maxDiff4alt10,maxDiff5alt10,maxDiff6alt10).
desc suma1 to suma10.

DATASET COPY     Unroll.
DATASET ACTIVATE Unroll WINDOW=FRONT.
VARSTOCASES
   /MAKE    Score FROM suma1 TO suma10
   /INDEX = MsgName(Score)
   /NULL  = DROP.

DATASET DECLARE  Summary.
AGGREGATE OUTFILE=Summary
    /BREAK=MsgName
    /Mean 'Mean score'          = MEAN(Score).

DATASET ACTIVATE  Summary  WINDOW=FRONT.
SORT CASES BY Mean (D).
FORMATS  Mean (F7.4).

NUMERIC  Rank (F3).
COMPUTE  Rank = $CASENUM.
LIST.

MsgName    Mean Rank

suma4     .3579    1
suma7     .2650    2
suma10    .1442    3
suma1     .1432    4
suma2    -.0118    5
suma5    -.0876    6
suma6    -.1154    7
suma9    -.1891    8
suma8    -.2051    9
suma3    -.3013   10


Number of cases read:  10    Number of cases listed:  10

However,  I would like now to compute the rankings. I would like to show the proportion of people that have their highest count for each of the different brands as shown in the table below:

           1    2    3    4    5    6    7    8    9   10
Apple          22.8 11.9 11.9  5.8  9.3  6.1  6.4  4.8  9.3 11.9
Microsoft       5.4  9.0 11.9 13.5 14.1 12.2 10.3  9.6  5.1  9.0
IBM             1.9  1.6  5.1  7.4  9.0  7.4 12.8 17.6 20.5 16.7
Google         21.8 20.5 15.7 10.3  7.1 11.5  4.8  4.2  2.9  1.3
Intel           3.5  5.8  8.3 14.1 13.8 12.8 11.2 12.2 10.3  8.0
HewlettPackard  4.2  8.7  9.3  7.4  8.7 11.5 10.9 16.0 11.2 12.2
Sony           16.0 15.7 16.0 13.8  9.0 10.6  7.7  6.4  3.2  1.6
Dell            5.8  8.0  3.5  8.3 10.3  7.4 11.5  7.4 19.6 18.3
Yahoo           1.9  6.4  7.7  6.1  8.0 13.8 14.7 14.1 12.5 14.7
Nokia          16.7 12.5 10.6 13.5 10.9  6.7  9.6  7.7  5.4  6.4

Thanks in advance!




-----
mils
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Computing-individual-level-ranks-from-the-counts-tp5729316.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Computing individual-level ranks from the counts

mils
Hi Eugene,

Thanks for your email. So far my syntax caculates the aggregate ranking for each brand. What I'm trying to achieve is the indiviadual ranking for each brand and then calculate the proportion of times Apple was chosen as first, second, third, and tenth: proportion of times Microsoft was chosen as first, second... and the proportion of times nokia was chosen as first, second, ,....

I hope that makes sense now.

Thanks.
mils
Reply | Threaded
Open this post in threaded view
|

Re: Computing individual-level ranks from the counts

Art Kendall
In reply to this post by mils
I have not examined your data in detail.
I wont; have time until tomoorow to test my idea but
have you sonsiderd whether MULT RESPONSE
or CTABLES will puduce a multiway tabel where some of the dimensions are the -1,0,1 and other are brands?
You can even crosstab set of variables by them selves e.g., brand by brand by brand by the -1,0,1 variable.
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Computing individual-level ranks from the counts

David Marso
Administrator
In reply to this post by mils
AGGREGATE has a PIN function.  Read up on it.
--
mils wrote
Hi Eugene,

Thanks for your email. So far my syntax caculates the aggregate ranking for each brand. What I'm trying to achieve is the indiviadual ranking for each brand and then calculate the proportion of times Apple was chosen as first, second, third, and tenth: proportion of times Microsoft was chosen as first, second... and the proportion of times nokia was chosen as first, second, ,....

I hope that makes sense now.

Thanks.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Computing individual-level ranks from the counts

MLIves
And in version 22+ a CIN function (count in). YAY!

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: Thursday, April 23, 2015 11:25 AM
To: [hidden email]
Subject: Re: [SPSSX-L] Computing individual-level ranks from the counts

AGGREGATE has a PIN function.  Read up on it.
--

mils wrote

> Hi Eugene,
>
> Thanks for your email. So far my syntax caculates the aggregate
> ranking for each brand. What I'm trying to achieve is the indiviadual
> ranking for each brand and then calculate the proportion of times
> Apple was chosen as first, second, third, and tenth: proportion of
> times Microsoft was chosen as first, second... and the proportion of
> times nokia was chosen as first, second, ,....
>
> I hope that makes sense now.
>
> Thanks.





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Computing-individual-level-ranks-from-the-counts-tp5729316p5729340.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately.  Please notify the sender if you have received this email in error.  NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD