How to get a statistical output value into a data file

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

How to get a statistical output value into a data file

msherman

Dear List: I hope someone can help me with this problem. I have been unable to find anything on the web. Here is the situation.

I have a data file which has an Idnumber and then responses to 20 items on a scale. I want to run the SPSS RUNS procedure to

See if individuals are responding “randomly (want to identify those individuals who have too few expected runs or too many

Expected runs). The SPSS RUNS procedure does exactly that. I transpose the data so that each column now represents

a participant and the responses for the 20 items down the column (delete the first row because it is the Idnumber). I then run

the RUNS procedure and get an output for each column (for each individual). The output includes the NUMBER OF RUNS. It is this

number that I want to be placed into a data file.  I can do it by hand but I have over 800 cases. I am curious as to whether or

not it is possible to get the output value into  a data file simply by using spss and not hand inputted. 

.  Thanks,  martin

 

 

 

 

Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track

Loyola University Maryland

4501 North Charles Street

222 B Beatty Hall

Baltimore, MD 21210

 

410 617-2417

[hidden email]

 

===================== 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 to get a statistical output value into a data file

Bruce Weaver
Administrator
Martin, it will be much clearer to everyone what you are trying to do if you
provide a small data set (via DATA LIST), paste your current syntax here,
and then show what you want the final result to look like.  

Cheers,
Bruce


msherman wrote

> Dear List: I hope someone can help me with this problem. I have been
> unable to find anything on the web. Here is the situation.
> I have a data file which has an Idnumber and then responses to 20 items on
> a scale. I want to run the SPSS RUNS procedure to
> See if individuals are responding "randomly (want to identify those
> individuals who have too few expected runs or too many
> Expected runs). The SPSS RUNS procedure does exactly that. I transpose the
> data so that each column now represents
> a participant and the responses for the 20 items down the column (delete
> the first row because it is the Idnumber). I then run
> the RUNS procedure and get an output for each column (for each
> individual). The output includes the NUMBER OF RUNS. It is this
> number that I want to be placed into a data file.  I can do it by hand but
> I have over 800 cases. I am curious as to whether or
> not it is possible to get the output value into  a data file simply by
> using spss and not hand inputted.
> .  Thanks,  martin
>
>
>
>
> Martin F. Sherman, Ph.D.
> Professor of Psychology
> Director of Masters Education: Thesis Track
> Loyola University Maryland
> 4501 North Charles Street
> 222 B Beatty Hall
> Baltimore, MD 21210
>
> 410 617-2417

> msherman@

>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: How to get a statistical output value into a data file

David Marso
Administrator
In reply to this post by msherman
The basic answer is OMS.  Have you looked into that?


msherman wrote

> Dear List: I hope someone can help me with this problem. I have been
> unable to find anything on the web. Here is the situation.
> I have a data file which has an Idnumber and then responses to 20 items on
> a scale. I want to run the SPSS RUNS procedure to
> See if individuals are responding "randomly (want to identify those
> individuals who have too few expected runs or too many
> Expected runs). The SPSS RUNS procedure does exactly that. I transpose the
> data so that each column now represents
> a participant and the responses for the 20 items down the column (delete
> the first row because it is the Idnumber). I then run
> the RUNS procedure and get an output for each column (for each
> individual). The output includes the NUMBER OF RUNS. It is this
> number that I want to be placed into a data file.  I can do it by hand but
> I have over 800 cases. I am curious as to whether or
> not it is possible to get the output value into  a data file simply by
> using spss and not hand inputted.
> .  Thanks,  martin
>
>
>
>
> Martin F. Sherman, Ph.D.
> Professor of Psychology
> Director of Masters Education: Thesis Track
> Loyola University Maryland
> 4501 North Charles Street
> 222 B Beatty Hall
> Baltimore, MD 21210
>
> 410 617-2417

> msherman@

>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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
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 to get a statistical output value into a data file

msherman
In reply to this post by Bruce Weaver
This is what it looks like. I hope this helps clarify what I am after.  Thanks,

Here is the data
ID  v1  v2  v3  v4    v5      v6 ......    v20
01   1    0    2     2      0      3
02   0     0    0    1      2      1
03   2     1    1    0      3      3
04   1     2     0   0      2       0
Etc.

Using a cut point of 2 or higher (2 or 3)  versus less than 2 (0  or 1)
The number of runs would be for each subject, examples.
                                                   1   1   1    1   1   1    = one run
                                                   1   2    1    2   1   2 =  six runs
                                                           0   0    0    0   0   1 = one run
                                                                   0   0    0    2    2  3 = two runs
                                                                            2    2    3   1    0    3  = three runs
          runs
ID      
01       4
02       3
03       3
04       5

In order to use the runs procedure within SPSS I need to transpose the data so that it looks like this

Var001(ID=1) var002(ID=2) var003(ID=3) var004(ID=4)
1 0 2 1
0 0 1 2
2 0 1 0
2 1 0 0
0 2 3 2
3 1 3 0



Using the Runs procedure the output file provides stats for each variable (one for var001, one for var002, var003, and var004)

The output will include the number of runs for each column variable which is actually an individual
       
Runs Test var001 var002 var003 var004
Test value
Total cases
Number of runs    4   3               3             5
Z
Asympt sign

The only thing I want to get into a data file is the number of runs.






-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver
Sent: Thursday, October 26, 2017 11:30 AM
To: [hidden email]
Subject: Re: How to get a statistical output value into a data file

Martin, it will be much clearer to everyone what you are trying to do if you provide a small data set (via DATA LIST), paste your current syntax here, and then show what you want the final result to look like.  

Cheers,
Bruce


msherman wrote

> Dear List: I hope someone can help me with this problem. I have been
> unable to find anything on the web. Here is the situation.
> I have a data file which has an Idnumber and then responses to 20
> items on a scale. I want to run the SPSS RUNS procedure to See if
> individuals are responding "randomly (want to identify those
> individuals who have too few expected runs or too many Expected runs).
> The SPSS RUNS procedure does exactly that. I transpose the data so
> that each column now represents a participant and the responses for
> the 20 items down the column (delete the first row because it is the
> Idnumber). I then run the RUNS procedure and get an output for each
> column (for each individual). The output includes the NUMBER OF RUNS.
> It is this number that I want to be placed into a data file.  I can do
> it by hand but I have over 800 cases. I am curious as to whether or
> not it is possible to get the output value into  a data file simply by
> using spss and not hand inputted.
> .  Thanks,  martin
>
>
>
>
> Martin F. Sherman, Ph.D.
> Professor of Psychology
> Director of Masters Education: Thesis Track Loyola University Maryland
> 4501 North Charles Street
> 222 B Beatty Hall
> Baltimore, MD 21210
>
> 410 617-2417

> msherman@

>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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 to get a statistical output value into a data file

msherman
In reply to this post by David Marso
Unfortunately I have never used OMS. I wonder how difficult it would be write the program for what I want.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: Thursday, October 26, 2017 11:52 AM
To: [hidden email]
Subject: Re: How to get a statistical output value into a data file

The basic answer is OMS.  Have you looked into that?


msherman wrote

> Dear List: I hope someone can help me with this problem. I have been
> unable to find anything on the web. Here is the situation.
> I have a data file which has an Idnumber and then responses to 20
> items on a scale. I want to run the SPSS RUNS procedure to See if
> individuals are responding "randomly (want to identify those
> individuals who have too few expected runs or too many Expected runs).
> The SPSS RUNS procedure does exactly that. I transpose the data so
> that each column now represents a participant and the responses for
> the 20 items down the column (delete the first row because it is the
> Idnumber). I then run the RUNS procedure and get an output for each
> column (for each individual). The output includes the NUMBER OF RUNS.
> It is this number that I want to be placed into a data file.  I can do
> it by hand but I have over 800 cases. I am curious as to whether or
> not it is possible to get the output value into  a data file simply by
> using spss and not hand inputted.
> .  Thanks,  martin
>
>
>
>
> Martin F. Sherman, Ph.D.
> Professor of Psychology
> Director of Masters Education: Thesis Track Loyola University Maryland
> 4501 North Charles Street
> 222 B Beatty Hall
> Baltimore, MD 21210
>
> 410 617-2417

> msherman@

>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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 to get a statistical output value into a data file

David Marso
Administrator
In reply to this post by Bruce Weaver
Ah Bruce, Your ESPss is FUBAR?

Unless mine is being affected by my tinfoil hat...

He starts with 800x21 matrix which looks like this:
MATRIX.
SAVE MAKE(800,21,0) / OUTFILE * / VARIABLES ID v01 TO v20.
END MATRIX.
COMPUTE ID=$CASENUM.
DO REPEAT v=v01 TO v20 .
COMPUTE v=RV.BERNOULLI(.5).
END REPEAT.
FORMATS ID (F3.0)v01 TO v20 (F1.0).
DATASET NAME raw.

/*He then for some reason FLIPS the data to
/*this monstrosity.

FLIP.

/*and then runs */.
NPAR TESTS/RUNS( 1)=var001 TO var800.

/*Which results in a really ugly FAT table .

/*Being a sane person  [wink wink]...
/*I would have done:

VARSTOCASES /MAKE v FROM v01 TO v20.
SPLIT FILE BY ID.
NPAR TESTS/RUNS( 1)=v.

/*Of course I would have preceeded the NPAR TESTS with

DATASET DECLARE  runsLong.
OMS
 /SELECT TABLES
  /IF COMMANDS=['NPar Tests'] SUBTYPES=['Runs Test']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='runsLong'.

/*and followed it with .

OMSEND.

/*After that I would have edited the mess with:

DATASET ACTIVATE runsLong .
DELETE VARIABLES TableNumber_ Command_ Subtype_ Label_.
RENAME VARIABLES Var1 =ID.
COMPUTE Var2=REPLACE(REPLACE(REPLACE(REPLACE(Var2,"
","_"),"(",""),")",""),"-","").
CASESTOVARS /ID=ID /INDEX=Var2.

That results in 800x6 matrix with ID in the first column and 5 stats in
remaining columns.
Or something like that....But what do I know?
;-))))

IMNSHO, OMS is the tool we needed 20 tears ago.  That would have saved me
from rolling my own with AGGREGATE and MATRIX.
------------------------------------


Bruce Weaver wrote

> Martin, it will be much clearer to everyone what you are trying to do if
> you
> provide a small data set (via DATA LIST), paste your current syntax here,
> and then show what you want the final result to look like.  
>
> Cheers,
> Bruce
>
>
> msherman wrote
>> Dear List: I hope someone can help me with this problem. I have been
>> unable to find anything on the web. Here is the situation.
>> I have a data file which has an Idnumber and then responses to 20 items
>> on
>> a scale. I want to run the SPSS RUNS procedure to
>> See if individuals are responding "randomly (want to identify those
>> individuals who have too few expected runs or too many
>> Expected runs). The SPSS RUNS procedure does exactly that. I transpose
>> the
>> data so that each column now represents
>> a participant and the responses for the 20 items down the column (delete
>> the first row because it is the Idnumber). I then run
>> the RUNS procedure and get an output for each column (for each
>> individual). The output includes the NUMBER OF RUNS. It is this
>> number that I want to be placed into a data file.  I can do it by hand
>> but
>> I have over 800 cases. I am curious as to whether or
>> not it is possible to get the output value into  a data file simply by
>> using spss and not hand inputted.
>> .  Thanks,  martin
>>
>>
>>
>>
>> Martin F. Sherman, Ph.D.
>> Professor of Psychology
>> Director of Masters Education: Thesis Track
>> Loyola University Maryland
>> 4501 North Charles Street
>> 222 B Beatty Hall
>> Baltimore, MD 21210
>>
>> 410 617-2417
>
>> msherman@
>
>>
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
> -----
> --
> Bruce Weaver

> bweaver@

> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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
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 to get a statistical output value into a data file

David Marso
Administrator
In reply to this post by msherman
Utterly trivial: See below.
Please consider the VARSOTOCASES/SPLI FILE rather than FLIP.
Much cleaner from a Data wrangling perspective.
IMNSHO: Considering that NPAR using the wide format requires you to know the
exact number of cases and hard code it into a file is enough reason to seek
an alternative pathway to joy.

Damn, now I sound like a freaking fortune cookie ;-}


msherman wrote
> Unfortunately I have never used OMS. I wonder how difficult it would be
> write the program for what I want.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:

> SPSSX-L@.UGA

> ] On Behalf Of David Marso
> Sent: Thursday, October 26, 2017 11:52 AM
> To:

> SPSSX-L@.UGA

> Subject: Re: How to get a statistical output value into a data file
>
> The basic answer is OMS.  Have you looked into that?
>
>
> msherman wrote
>> Dear List: I hope someone can help me with this problem. I have been
>> unable to find anything on the web. Here is the situation.
>> I have a data file which has an Idnumber and then responses to 20
>> items on a scale. I want to run the SPSS RUNS procedure to See if
>> individuals are responding "randomly (want to identify those
>> individuals who have too few expected runs or too many Expected runs).
>> The SPSS RUNS procedure does exactly that. I transpose the data so
>> that each column now represents a participant and the responses for
>> the 20 items down the column (delete the first row because it is the
>> Idnumber). I then run the RUNS procedure and get an output for each
>> column (for each individual). The output includes the NUMBER OF RUNS.
>> It is this number that I want to be placed into a data file.  I can do
>> it by hand but I have over 800 cases. I am curious as to whether or
>> not it is possible to get the output value into  a data file simply by
>> using spss and not hand inputted.
>> .  Thanks,  martin
>>
>>
>>
>>
>> Martin F. Sherman, Ph.D.
>> Professor of Psychology
>> Director of Masters Education: Thesis Track Loyola University Maryland
>> 4501 North Charles Street
>> 222 B Beatty Hall
>> Baltimore, MD 21210
>>
>> 410 617-2417
>
>> msherman@
>
>>
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
> -----
> 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?"
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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

> LISTSERV@.UGA

>  (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





-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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
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 to get a statistical output value into a data file

Andy W
In reply to this post by msherman
Instead of transposing the data, I might suggest to use VARSTOCASES and use
SPLIT FILE (given your current description). Then you only have to run the
runs command once. Here is an example, using OMS to stuff the results into a
nice new dataset.

****************************************************************************.
*Create fake data, 100 people with 20 binary questions.
SET SEED 10.
INPUT PROGRAM.
LOOP Id = 1 TO 100.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
DATASET NAME Sim.
FORMATS Id (F3.0).
VECTOR R(20,F1.0).
LOOP #i = 1 TO 20.
  COMPUTE R(#i) = RV.BERNOULLI(0.5).
END LOOP.
EXECUTE.

*Reshape questions wide to long.
VARSTOCASES /MAKE Qs FROM R1 TO R20 /INDEX=Order.

DATASET DECLARE RunsTest.
OMS
  /SELECT TABLES
  /IF LABELS = 'Runs Test'
  /DESTINATION FORMAT=SAV OUTFILE='RunsTest'.
SPLIT FILE BY Id.
*Delete the last METHOD option if you do not have exact tests.
NPAR TESTS
  /RUNS(0.5)=Qs
  /MISSING ANALYSIS
  /METHOD=EXACT TIMER(5).
SPLIT FILE OFF.
OMSEND.

DATASET ACTIVATE RunsTest.
ALTER TYPE Var1 (F3.0).
CASESTOVARS /ID = Var1 /INDEX = Var2 /DROP Command_ Subtype_ Label_ .
****************************************************************************.

Here I specify exact tests -- I don't remember the behavior of this
statistic with smaller samples, and whether 20 observations is reasonable to
assume asymptotic behavior.

SPSS does the runs test with just two groups, so works out just fine if your
survey questions are binary 0/1. If you are interested in more outcomes
though (say Likert items ranging from 1 to 5), I have some code to estimate
the runs test with multiple groups, see:

 - https://stats.stackexchange.com/a/73170/1036
 - https://www.dropbox.com/sh/kr6qvukrw6xvue4/AABWSg-DAcoLoysqTKMyeRdNa

Although that code is not as easy to just do the split file approach.

Likert data it may be reasonable to still split the answers, e.g. and the
middle/neutral option, but that multiple groups code will definitely be more
appropriate if you have more than two categorical answers.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to get a statistical output value into a data file

Rich Ulrich
In reply to this post by msherman

What you want is the number of runs for each case? 


COMMENT  Just count the number of "changes" sequentially.

COMPUTE Runs= 0.

DO REPEAT  dum1 = item1 to item 19/ dum2= item2 to item20.

COMPUTE  Runs= Runs + (dum1 NE dum2).

END REPEAT.


--

Rich Ulrich


From: SPSSX(r) Discussion <[hidden email]> on behalf of Martin Sherman <[hidden email]>
Sent: Thursday, October 26, 2017 10:52:53 AM
To: [hidden email]
Subject: How to get a statistical output value into a data file
 

Dear List: I hope someone can help me with this problem. I have been unable to find anything on the web. Here is the situation.

I have a data file which has an Idnumber and then responses to 20 items on a scale. I want to run the SPSS RUNS procedure to

See if individuals are responding “randomly (want to identify those individuals who have too few expected runs or too many

Expected runs). The SPSS RUNS procedure does exactly that. I transpose the data so that each column now represents

a participant and the responses for the 20 items down the column (delete the first row because it is the Idnumber). I then run

the RUNS procedure and get an output for each column (for each individual). The output includes the NUMBER OF RUNS. It is this

number that I want to be placed into a data file.  I can do it by hand but I have over 800 cases. I am curious as to whether or

not it is possible to get the output value into  a data file simply by using spss and not hand inputted. 

.  Thanks,  martin

 

 

 

 

Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track

Loyola University Maryland

4501 North Charles Street

222 B Beatty Hall

Baltimore, MD 21210

 

410 617-2417

[hidden email]

 

===================== 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 to get a statistical output value into a data file

msherman

Great let me play with. Given Rich’s syntax I will have to create a binary variable for each response (where 0 , 1 =0, and 2,3 =1).  Thanks to all who have responded. I have something to work with now.  martin

 

From: Rich Ulrich [mailto:[hidden email]]
Sent: Thursday, October 26, 2017 12:41 PM
To: [hidden email]; Martin Sherman <[hidden email]>
Subject: Re: How to get a statistical output value into a data file

 

What you want is the number of runs for each case? 

 

COMMENT  Just count the number of "changes" sequentially.

COMPUTE Runs= 0.

DO REPEAT  dum1 = item1 to item 19/ dum2= item2 to item20.

COMPUTE  Runs= Runs + (dum1 NE dum2).

END REPEAT.

 

--

Rich Ulrich


From: SPSSX(r) Discussion <[hidden email]> on behalf of Martin Sherman <[hidden email]>
Sent: Thursday, October 26, 2017 10:52:53 AM
To: [hidden email]
Subject: How to get a statistical output value into a data file

 

Dear List: I hope someone can help me with this problem. I have been unable to find anything on the web. Here is the situation.

I have a data file which has an Idnumber and then responses to 20 items on a scale. I want to run the SPSS RUNS procedure to

See if individuals are responding “randomly (want to identify those individuals who have too few expected runs or too many

Expected runs). The SPSS RUNS procedure does exactly that. I transpose the data so that each column now represents

a participant and the responses for the 20 items down the column (delete the first row because it is the Idnumber). I then run

the RUNS procedure and get an output for each column (for each individual). The output includes the NUMBER OF RUNS. It is this

number that I want to be placed into a data file.  I can do it by hand but I have over 800 cases. I am curious as to whether or

not it is possible to get the output value into  a data file simply by using spss and not hand inputted. 

.  Thanks,  martin

 

 

 

 

Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track

Loyola University Maryland

4501 North Charles Street

222 B Beatty Hall

Baltimore, MD 21210

 

410 617-2417

[hidden email]

 

===================== 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 to get a statistical output value into a data file

msherman
In reply to this post by Rich Ulrich

Rich: When I run your syntax it produces the number of runs but is always off by 1. That is, it comes up short by one run. I could simple use syntax to add 1 to the final RUNS variable

 

From: Rich Ulrich [mailto:[hidden email]]
Sent: Thursday, October 26, 2017 12:41 PM
To: [hidden email]; Martin Sherman <[hidden email]>
Subject: Re: How to get a statistical output value into a data file

 

What you want is the number of runs for each case? 

 

COMMENT  Just count the number of "changes" sequentially.

COMPUTE Runs= 0.

DO REPEAT  dum1 = item1 to item 19/ dum2= item2 to item20.

COMPUTE  Runs= Runs + (dum1 NE dum2).

END REPEAT.

 

--

Rich Ulrich


From: SPSSX(r) Discussion <[hidden email]> on behalf of Martin Sherman <[hidden email]>
Sent: Thursday, October 26, 2017 10:52:53 AM
To: [hidden email]
Subject: How to get a statistical output value into a data file

 

Dear List: I hope someone can help me with this problem. I have been unable to find anything on the web. Here is the situation.

I have a data file which has an Idnumber and then responses to 20 items on a scale. I want to run the SPSS RUNS procedure to

See if individuals are responding “randomly (want to identify those individuals who have too few expected runs or too many

Expected runs). The SPSS RUNS procedure does exactly that. I transpose the data so that each column now represents

a participant and the responses for the 20 items down the column (delete the first row because it is the Idnumber). I then run

the RUNS procedure and get an output for each column (for each individual). The output includes the NUMBER OF RUNS. It is this

number that I want to be placed into a data file.  I can do it by hand but I have over 800 cases. I am curious as to whether or

not it is possible to get the output value into  a data file simply by using spss and not hand inputted. 

.  Thanks,  martin

 

 

 

 

Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track

Loyola University Maryland

4501 North Charles Street

222 B Beatty Hall

Baltimore, MD 21210

 

410 617-2417

[hidden email]

 

===================== 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 to get a statistical output value into a data file

Bruce Weaver
Administrator
In reply to this post by msherman
Martin, do you mean that your variables can take on 3 values (1-3)?  If so,
why do you need to create a binary variable for each response?  Rich's code
should work regardless of how many possible values there are.  E.g., the
following tweaks Andy's code to generate variables with 3 possible values
(0-2), and then calls Rich's code with no changes (apart from initializing
Runs to 1, not 0).  I think it gives the result you want.

NEW FILE.
DATASET CLOSE ALL.
*Create fake data, 100 people with 20 binary questions.
SET SEED 10.
INPUT PROGRAM.
LOOP Id = 1 TO 100.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
DATASET NAME Sim.
FORMATS Id (F3.0).
VECTOR R(20,F1.0).
LOOP #i = 1 TO 20.
*  COMPUTE R(#i) = RV.BERNOULLI(0.5).
  COMPUTE R(#i) = RV.BINOM(2,0.5).
END LOOP.
EXECUTE.

COMMENT  Just count the number of "changes" sequentially.
COMPUTE Runs= 1. /* If all items are the same, there is 1 run.
DO REPEAT  dum1 = R1 to R19/ dum2= R2 to R20.
  COMPUTE  Runs= SUM(Runs,(dum1 NE dum2)).
END REPEAT.
FORMATS Runs (F5.0).
FREQUENCIES Runs.
* Visually verify that Runs value is correct for first 5 cases.
LIST /CASES FROM 1 to 5.

Output from LIST:

 
 Id R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20
Runs
 
  1  0  0  1  2  1  2  0  0  0  1   1   0   1   1   0   2   2   0   0   0    
12
  2  0  1  1  2  2  0  2  0  1  2   2   2   2   2   1   1   1   1   1   0    
10
  3  1  2  2  2  0  1  1  0  2  1   2   0   1   1   2   1   1   0   0   2    
14
  4  1  1  0  2  1  0  0  2  1  1   0   1   1   0   1   2   1   2   1   2    
16
  5  2  2  1  2  1  0  2  1  2  0   1   1   1   1   1   1   2   0   1   1    
13



msherman wrote
> Great let me play with. Given Rich's syntax I will have to create a binary
> variable for each response (where 0 , 1 =0, and 2,3 =1).  Thanks to all
> who have responded. I have something to work with now.  martin
>
> From: Rich Ulrich [mailto:

> rich-ulrich@

> ]
> Sent: Thursday, October 26, 2017 12:41 PM
> To:

> SPSSX-L@.UGA

> ; Martin Sherman &lt;

> MSherman@

> &gt;
> Subject: Re: How to get a statistical output value into a data file
>
>
> What you want is the number of runs for each case?
>
>
>
> COMMENT  Just count the number of "changes" sequentially.
>
> COMPUTE Runs= 0.
>
> DO REPEAT  dum1 = item1 to item 19/ dum2= item2 to item20.
>
> COMPUTE  Runs= Runs + (dum1 NE dum2).
>
> END REPEAT.
>
>
>
> --
>
> Rich Ulrich
>
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

> &lt;mailto:

> SPSSX-L@.UGA

> &gt;> on behalf of Martin Sherman &lt;

> MSherman@

> &lt;mailto:

> MSherman@

> &gt;>
> Sent: Thursday, October 26, 2017 10:52:53 AM
> To:

> SPSSX-L@.UGA

> &lt;mailto:

> SPSSX-L@.UGA

> &gt;
> Subject: How to get a statistical output value into a data file
>
>
> Dear List: I hope someone can help me with this problem. I have been
> unable to find anything on the web. Here is the situation.
>
> I have a data file which has an Idnumber and then responses to 20 items on
> a scale. I want to run the SPSS RUNS procedure to
>
> See if individuals are responding "randomly (want to identify those
> individuals who have too few expected runs or too many
>
> Expected runs). The SPSS RUNS procedure does exactly that. I transpose the
> data so that each column now represents
>
> a participant and the responses for the 20 items down the column (delete
> the first row because it is the Idnumber). I then run
>
> the RUNS procedure and get an output for each column (for each
> individual). The output includes the NUMBER OF RUNS. It is this
>
> number that I want to be placed into a data file.  I can do it by hand but
> I have over 800 cases. I am curious as to whether or
>
> not it is possible to get the output value into  a data file simply by
> using spss and not hand inputted.
>
> .  Thanks,  martin
>
>
>
>
>
>
>
>
>
> Martin F. Sherman, Ph.D.
>
> Professor of Psychology
>
> Director of Masters Education: Thesis Track
>
> Loyola University Maryland
>
> 4501 North Charles Street
>
> 222 B Beatty Hall
>
> Baltimore, MD 21210
>
>
>
> 410 617-2417

> msherman@

> &lt;mailto:

> msherman@

> &gt;
>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to

> LISTSERV@.UGA

> &lt;mailto:

> LISTSERV@.UGA

> &gt; (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

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).