How can I count the number of times...

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

How can I count the number of times...

rots
Hi there,
I did a similarity sorting task, where people had to sort different words into groups. Words were printed on cards (40 cards in total). 50 persons participated. I'd like to do a global similarity matrix, where each cell contains the number of times two words were put into the same group (min=0, max=50). To get there, I have two possibilities:
1. counting for each word combination by how many participants these words were put together into the same group> get 1 matrix (columns/rows: word1,word2,...)
2. use a syntax in spss to merge the different files and "let it count for me".

source material: for each single participant, I have the different word groups that were constructed. Therefore, for each person I have 1 separate excel file (row: word1, word2,...); column: Group 1, group2, group3....

I suppose I have to use a do-repeat and if-command.

Thank you very much for your help!!
Reply | Threaded
Open this post in threaded view
|

Re: How can I count the number of times...

Maguin, Eugene
Describe your data structure, preferably by making up a tiny example that illustrates the data records for a few words and two or three imaginary subjects. In particular, were a preset number of groups defined or did each person determine the number of groups? It looks like you have one excel table/file per person. If the number of groups are preset, do corresponding columns in every table have the same definition? If each person defines their own groups, how is this experimental design element reflected in the data files? I do see that you describe the source material, which is nice (thank you). However, I'd like to see a specific data example.
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of rots
Sent: Wednesday, April 30, 2014 9:10 AM
To: [hidden email]
Subject: How can I count the number of times...

Hi there,
I did a similarity sorting task, where people had to sort different words into groups. Words were printed on cards (40 cards in total). 50 persons participated. I'd like to do a global similarity matrix, where each cell contains the number of times two words were put into the same group (min=0, max=50). To get there, I have two possibilities:
1. counting for each word combination by how many participants these words were put together into the same group> get 1 matrix (columns/rows:
word1,word2,...)
2. use a syntax in spss to merge the different files and "let it count for me".

source material: for each single participant, I have the different word groups that were constructed. Therefore, for each person I have 1 separate excel file (row: word1, word2,...); column: Group 1, group2, group3....

I suppose I have to use a do-repeat and if-command.

Thank you very much for your help!!




--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-can-I-count-the-number-of-times-tp5725729.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: How can I count the number of times...

David Marso
Administrator
In reply to this post by rots
I am pretty sure that "let it count for me" is an optimistic concept at best.

Here is a quick and dirty MATRIX program you can study and adapt to your needs.
You will have to get your data into the format exemplified below by merging the excel files and getting them into SPSS or getting them into SPSS and then merging (your call).

DATA LIST LIST / id (F1) word (A5) group1 TO group4 (4F1).
BEGIN DATA
1 word1 1 0 0 0 0
1 word2 1 0 0 0 0
1 word3 0 1 0 0 0
1 word4 0 0 0 1 0
1 word5 0 0 0 1 0
2 word1 0 1 0 0 0
2 word2 0 0 0 1 0
2 word3 0 1 0 0 0
2 word4 0 0 0 1 0
2 word5 0 0 0 1 0
END DATA.
DATASET NAME data.
MATRIX.
GET wordgp  /FILE * / VARIABLES group1 TO group4.
GET words /FILE * / VARIABLES word.
COMPUTE nwords=5.
COMPUTE Cross=MAKE(nwords,nwords,0).
LOOP #CASEID=1 TO NROW(wordgp) BY nwords.
COMPUTE subjdata=wordgp(#caseID:(#caseID+4),:).
COMPUTE Cross=Cross + subjdata*T(subjdata).
END LOOP.
CALL SETDIAG(cross,0).
COMPUTE namevec={'word',T(words(1:nwords))}.
SAVE {words(1:nwords), Cross}/OUTFILE * / NAMES=namevec/STRINGS word .
END MATRIX.

rots wrote
Hi there,
I did a similarity sorting task, where people had to sort different words into groups. Words were printed on cards (40 cards in total). 50 persons participated. I'd like to do a global similarity matrix, where each cell contains the number of times two words were put into the same group (min=0, max=50). To get there, I have two possibilities:
1. counting for each word combination by how many participants these words were put together into the same group> get 1 matrix (columns/rows: word1,word2,...)
2. use a syntax in spss to merge the different files and "let it count for me".

source material: for each single participant, I have the different word groups that were constructed. Therefore, for each person I have 1 separate excel file (row: word1, word2,...); column: Group 1, group2, group3....

I suppose I have to use a do-repeat and if-command.

Thank you very much for your help!!
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: How can I count the number of times...

Andy W
In reply to this post by rots
Well I wasted an hour playing around with that task!

I have posted some code to show how if you start with a dataset of the form:

Person Rank1  Rank2 Rank3
-------------------------
1        WordA WordB WordC
2        WordC WordA WordB

Which seems like a natural way to enter the data to me. Basically if you reshape the variables so all words in in one column with an index signifying the rank, you can then use aggregate to get the counts of each word in each ranking.

I was mostly interested in generating some plots for such situations, and I have posted the code plus some graphs at https://www.dropbox.com/sh/lq5omvldax4djjj/vaIEpZcmV8.

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: How can I count the number of times...

David Marso
Administrator
I suspect MATRIX is likely the only non 'kinky' way to do what OP requested.
One could do CASESTOVARS twice to get words arrayed in a single row per case.
Initialize a 780 length vector to store the accumulated group matches.
Do a double loop with a triangular index and then AGGREGATE and then disembowel the result.
PROXIMITIES with SPLIT and and MATRIX OUT can give various distance/similarity measures, but I'm not sure what would be appropriate and will not spend time pro-bono to research it!

Andy W wrote
Well I wasted an hour playing around with that task!

I have posted some code to show how if you start with a dataset of the form:

Person Rank1  Rank2 Rank3
-------------------------
1        WordA WordB WordC
2        WordC WordA WordB

Which seems like a natural way to enter the data to me. Basically if you reshape the variables so all words in in one column with an index signifying the rank, you can then use aggregate to get the counts of each word in each ranking.

I was mostly interested in generating some plots for such situations, and I have posted the code plus some graphs at https://www.dropbox.com/sh/lq5omvldax4djjj/vaIEpZcmV8.
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: How can I count the number of times...

Rich Ulrich
[see comments, inserted below]

> Date: Wed, 30 Apr 2014 09:36:44 -0700.
> From: [hidden email]
> Subject: Re: How can I count the number of times...
> To: [hidden email]
>
> I suspect MATRIX is likely the only non 'kinky' way to do what OP requested.
> One could do CASESTOVARS twice to get words arrayed in a single row per
> case.

That gives you something like what I figure is the compact way to show the data:
Each line has 41 variables, ID and "group" for the 40 words taken in order.
    ID, (Group#), (Group#), (Group#), ...
It doesn't matter how many groups there are, or if they are the same.
You could read David's set of lines as (A9) and do only one CasesToVars.

> Initialize a 780 length vector to store the accumulated group matches.
> Do a double loop with a triangular index and then AGGREGATE and then
> disembowel the result.

Why bother with a triangular index?  You probably want the full 40x40 matrix
at the end, anyway.   You set Mat0001 to Mat1600  to 1 when Group (i) equals
Group (j).   AGGREGATE  sums the matrix into one long line.

"Disembowel the result" is easily done with the 40x40 result.
Use XSAVE  in a Loop -- copy the next 40 to a vector for XSAVE.

> PROXIMITIES with SPLIT and and MATRIX OUT can give various
> distance/similarity measures, but I'm not sure what would be appropriate and
> will not spend time pro-bono to research it!
>
>
> Andy W wrote
> > Well I wasted an hour playing around with that task!
> >
> > I have posted some code to show how if you start with a dataset of the
> > form:
[snip, more]

--
Rich Ullrich
Reply | Threaded
Open this post in threaded view
|

Re: How can I count the number of times...

Art Kendall
In reply to this post by rots
I have not checked out word by word matrix analysis recently, but you might consider multidimensional
(INDSCAl or ALSCAL) in the SPSS base.  You could get results for the common matrix but may want to to relate the different  use of that matrix to other characteristics of the respondents.
Art Kendall
Social Research Consultants
On 4/30/2014 9:10 AM, rots [via SPSSX Discussion] wrote:
Hi there,
I did a similarity sorting task, where people had to sort different words into groups. Words were printed on cards (40 cards in total). 50 persons participated. I'd like to do a global similarity matrix, where each cell contains the number of times two words were put into the same group (min=0, max=50). To get there, I have two possibilities:
1. counting for each word combination by how many participants these words were put together into the same group> get 1 matrix (columns/rows: word1,word2,...)
2. use a syntax in spss to merge the different files and "let it count for me".

source material: for each single participant, I have the different word groups that were constructed. Therefore, for each person I have 1 separate excel file (row: word1, word2,...); column: Group 1, group2, group3....

I suppose I have to use a do-repeat and if-command.

Thank you very much for your help!!



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/How-can-I-count-the-number-of-times-tp5725729.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: How can I count the number of times...

Art Kendall
In reply to this post by rots
If you are considering the extra information from INDSCAL or something like it you may want file with a separate similarity matrix for each respondent.

check the documentation under MULTIDIMENSIONAL SCALING
Art Kendall
Social Research Consultants
On 4/30/2014 9:10 AM, rots [via SPSSX Discussion] wrote:
Hi there,
I did a similarity sorting task, where people had to sort different words into groups. Words were printed on cards (40 cards in total). 50 persons participated. I'd like to do a global similarity matrix, where each cell contains the number of times two words were put into the same group (min=0, max=50). To get there, I have two possibilities:
1. counting for each word combination by how many participants these words were put together into the same group> get 1 matrix (columns/rows: word1,word2,...)
2. use a syntax in spss to merge the different files and "let it count for me".

source material: for each single participant, I have the different word groups that were constructed. Therefore, for each person I have 1 separate excel file (row: word1, word2,...); column: Group 1, group2, group3....

I suppose I have to use a do-repeat and if-command.

Thank you very much for your help!!



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/How-can-I-count-the-number-of-times-tp5725729.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants