Monte Carlo Random Assignment by Proportion

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

Monte Carlo Random Assignment by Proportion

bdates

I need to simulate Likert responses to measures of varying numbers of items in which one of the response categories has a finite proportion of all responses.  For example, for a measure of 10 items with four response categories and 100 subjects, I need to assign category 1 randomly to each of the items for 60% of the subjects and the remainder of the categories a random number of times to the other 40% of the subjects.  I can make do with assigning category 1 to 60% of the subjects for each of the items (and not worry about the other 40%).  I’ve tried using RV.Binomial(1,0.60), but of course the actual % of 1’s varies around the actual 60%.  Any help would be appreciated.  Thanks.

 

Brian

 

 

 

Brian G. Dates

Director of Evaluation and Research

Southwest Counseling Solutions

1700 Waterman

Detroit, MI     48209

313-841-7442

[hidden email]

 

Leading the Way in Building a Healthy Community

 

Reply | Threaded
Open this post in threaded view
|

Re: Monte Carlo Random Assignment by Proportion

Maguin, Eugene
Brian,

I didn't clearly understand what you wanted to do. I think that for each
variable you want to assign a value of 1 to that variable for a randomly
selected 60% of your sample and then randomly assign one the remaining
possible values to the remaining 40% of cases.

The key is to use the Rank command. So, let v1 to v10 be your variables,
each having range of 1 to 4 but with 60 of cases for each variable having a
value of 1.

*  not tested.
Input program.
Loop id=1 to 100.
Do repeat x=v1 to v10.
+  compute x=rv.uniform(0,4)
End repeat.
End case.
End loop.
End file.
End input program.

Rank v1 to v10.

*  I assume 100 cases.
Do repeat x=v1 to v10/y=rv1 to rv10.
+  if (y le 60) x=1.  /* if 200 cases, 60 becomes 120.
+  if (y gt 60) x=trunc(rv.uniform(2,5)).
End repeat.
Execute.
*  warning. If you need exactly 60 cases=1 for each variable, you need to be
cognizant of the possibility of a tie in the ranking. Let's say there is a
tiny, but non-zero probability of a tie. The only way around that
problem--that I know of--is to sort a variable and then use the $casenum
variable to define the first 60 cases. This sequence (sort, $casenum) is
repeated for each variable.

Gene Maguin


>>I need to simulate Likert responses to measures of varying numbers of
items in which one of the response categories has a finite proportion of all
responses.  For example, for a measure of 10 items with four response
categories and 100 subjects, I need to assign category 1 randomly to each of
the items for 60% of the subjects and the remainder of the categories a
random number of times to the other 40% of the subjects.  I can make do with
assigning category 1 to 60% of the subjects for each of the items (and not
worry about the other 40%).  I've tried using RV.Binomial(1,0.60), but of
course the actual % of 1's varies around the actual 60%.  Any help would be
appreciated.  Thanks.



Brian







Brian G. Dates

Director of Evaluation and Research

Southwest Counseling Solutions

1700 Waterman

Detroit, MI     48209

313-841-7442

[hidden email]



Leading the Way in Building a Healthy Community

=====================
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: Monte Carlo Random Assignment by Proportion

bdates
Gene,

Thanks.  This works well.  Perfect for what I need.

Brian

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gene Maguin
Sent: Tuesday, March 02, 2010 11:07 AM
To: [hidden email]
Subject: Re: Monte Carlo Random Assignment by Proportion

Brian,

I didn't clearly understand what you wanted to do. I think that for each
variable you want to assign a value of 1 to that variable for a randomly
selected 60% of your sample and then randomly assign one the remaining
possible values to the remaining 40% of cases.

The key is to use the Rank command. So, let v1 to v10 be your variables,
each having range of 1 to 4 but with 60 of cases for each variable
having a
value of 1.

*  not tested.
Input program.
Loop id=1 to 100.
Do repeat x=v1 to v10.
+  compute x=rv.uniform(0,4)
End repeat.
End case.
End loop.
End file.
End input program.

Rank v1 to v10.

*  I assume 100 cases.
Do repeat x=v1 to v10/y=rv1 to rv10.
+  if (y le 60) x=1.  /* if 200 cases, 60 becomes 120.
+  if (y gt 60) x=trunc(rv.uniform(2,5)).
End repeat.
Execute.
*  warning. If you need exactly 60 cases=1 for each variable, you need
to be
cognizant of the possibility of a tie in the ranking. Let's say there is
a
tiny, but non-zero probability of a tie. The only way around that
problem--that I know of--is to sort a variable and then use the $casenum
variable to define the first 60 cases. This sequence (sort, $casenum) is
repeated for each variable.

Gene Maguin


>>I need to simulate Likert responses to measures of varying numbers of
items in which one of the response categories has a finite proportion of
all
responses.  For example, for a measure of 10 items with four response
categories and 100 subjects, I need to assign category 1 randomly to
each of
the items for 60% of the subjects and the remainder of the categories a
random number of times to the other 40% of the subjects.  I can make do
with
assigning category 1 to 60% of the subjects for each of the items (and
not
worry about the other 40%).  I've tried using RV.Binomial(1,0.60), but
of
course the actual % of 1's varies around the actual 60%.  Any help would
be
appreciated.  Thanks.



Brian







Brian G. Dates

Director of Evaluation and Research

Southwest Counseling Solutions

1700 Waterman

Detroit, MI     48209

313-841-7442

[hidden email]



Leading the Way in Building a Healthy Community

=====================
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: Monte Carlo Random Assignment by Proportion

Richard Ristow
In reply to this post by Maguin, Eugene
At 11:06 AM 3/2/2010, Gene Maguin wrote:

I didn't clearly understand what you wanted to do. I think that for each variable you want to assign a value of 1 to that variable for a randomly selected 60% of your sample and then randomly assign one the remaining possible values to the remaining 40% of cases.

One bug: I think

+  if (y gt 60) x=trunc(rv.uniform(2,5)).

should be

+  if (y gt 60) x=trunc(rv.uniform(2,6)).

The former never assigns value 5.

A question for the original poster: should the variables should have value 1 in exactly 60% of the cases, or should they have value 1 independently with probability 60% for each case? The RANK solution gives value 1 in exactly 60% of the cases, but I think independent assignment would better model most real-world mechanisms. Not tested, but

.  COMPUTE    x=rv.bernoulli (0.6).
.  IF (X EQ 0) x=trunc(rv.uniform(2,6)).

-Onward, with best wishes,
 Richard
===================== 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