random selection from multiple measures

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

random selection from multiple measures

tino
Dear All,

I have repeated measures of the same observational units; specifically, for each observational unit, there are 6 measurements.

From these six measurements, I need to randomly select one measurement for each person.

For example, if there were 100 persons measured six times, there would be 600 measurements. From these 600 measurement, I would need 100 measurements, but each person should only be sampled once.

Say "person" is numbered from 1 to 100, and "measurements" is numbered from 1 to 6. Which sytnax could I use to make the kind of selection outlined above? Many thanks for your help!

Tino

=====================
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: random selection from multiple measures

Bruce Weaver
Administrator
Here are some functions you may find useful.

RV.UNIFORM(min, max). Numeric. Returns a random value from a uniform distribution with specified minimum and maximum. See also the UNIFORM function.

RND(numexpr[,mult,fuzzbits]). Numeric. With a single argument, returns the integer nearest to that argument. Numbers ending in .5 exactly are rounded away from 0. For example, RND(-4.5) rounds to -5. The optional second argument, mult, specifies that the result is an integer multiple of this value—for example, RND(-4.57,0.1) = -4.6. The value must be numeric but cannot be 0. The default is 1.


tino wrote
Dear All,

I have repeated measures of the same observational units; specifically, for each observational unit, there are 6 measurements.

From these six measurements, I need to randomly select one measurement for each person.

For example, if there were 100 persons measured six times, there would be 600 measurements. From these 600 measurement, I would need 100 measurements, but each person should only be sampled once.

Say "person" is numbered from 1 to 100, and "measurements" is numbered from 1 to 6. Which sytnax could I use to make the kind of selection outlined above? Many thanks for your help!

Tino

=====================
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: random selection from multiple measures

David Marso
Administrator
In reply to this post by tino
Presuming there is some sensible reason for tossing 84% of the data ;-(
Study this, fill in the <blanks> and ...< be well and prosper or as Dr. Who would quip RUN>!

GET FILE <yourdata> /KEEP <your6vars>.
COMPUTE ID=$CASENUM.
DATASET NAME rawdata.
*------*.

DATASET DECLARE picker.
SET MXLOOPS=200.
MATRIX.
LOOP #=1 TO 100.
SAVE GRADE(UNIFORM(1,6)) /OUTFILE picker/VARIABLES rank1 TO rank6.
END LOOP.
END MATRIX.

DATASET ACTIVATE picker.
COMPUTE ID=$CASENUM.
VARSTOCASES MAKE rank FROM rank1 TO rank6/ INDEX=index.
SELECT IF rank=1.
EXECUTE.

MATCH FILES FILE */FILE rawdata / BY ID.
VECTOR vars=<youristvar TO your6thvar>.
COMPUTE Keep=vars(rank).




tino wrote
Dear All,

I have repeated measures of the same observational units; specifically, for each observational unit, there are 6 measurements.

From these six measurements, I need to randomly select one measurement for each person.

For example, if there were 100 persons measured six times, there would be 600 measurements. From these 600 measurement, I would need 100 measurements, but each person should only be sampled once.

Say "person" is numbered from 1 to 100, and "measurements" is numbered from 1 to 6. Which sytnax could I use to make the kind of selection outlined above? Many thanks for your help!

Tino

=====================
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: random selection from multiple measures

David Marso
Administrator
That last line should read
COMPUTE Keep=vars(index).
---
David Marso wrote
Presuming there is some sensible reason for tossing 84% of the data ;-(
Study this, fill in the <blanks> and ...< be well and prosper or as Dr. Who would quip RUN>!

GET FILE <yourdata> /KEEP <your6vars>.
COMPUTE ID=$CASENUM.
DATASET NAME rawdata.
*------*.

DATASET DECLARE picker.
SET MXLOOPS=200.
MATRIX.
LOOP #=1 TO 100.
SAVE GRADE(UNIFORM(1,6)) /OUTFILE picker/VARIABLES rank1 TO rank6.
END LOOP.
END MATRIX.

DATASET ACTIVATE picker.
COMPUTE ID=$CASENUM.
VARSTOCASES MAKE rank FROM rank1 TO rank6/ INDEX=index.
SELECT IF rank=1.
EXECUTE.

MATCH FILES FILE */FILE rawdata / BY ID.
VECTOR vars=<youristvar TO your6thvar>.
COMPUTE Keep=vars(rank).




tino wrote
Dear All,

I have repeated measures of the same observational units; specifically, for each observational unit, there are 6 measurements.

From these six measurements, I need to randomly select one measurement for each person.

For example, if there were 100 persons measured six times, there would be 600 measurements. From these 600 measurement, I would need 100 measurements, but each person should only be sampled once.

Say "person" is numbered from 1 to 100, and "measurements" is numbered from 1 to 6. Which sytnax could I use to make the kind of selection outlined above? Many thanks for your help!

Tino

=====================
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?"