| Date: | Sat, 13 Mar 2010 14:36:15 -0500 |
| Reply-To: | Art@DrKendall.org |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Art Kendall <Art@DrKendall.org> |
| Organization: | Social Research Consultants |
| Subject: | Re: Random Numbers in Matrix Mode |
|
| In-Reply-To: | <A650B8D8486FD44CA54B17FD7E5C74A703AE220E@mail.swsol.org> |
| Content-type: | text/html; charset=ISO-8859-1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Below is an example of syntax for generating 10,000 throws of a pair of
dice. (each die is considered a random number from 1 to 6).<br>
There is a client at the door so I don't have time to see how it works
in matrix mode, but this may give you a start.<br>
<br>
<br>
<tt>*THROW 2 DICE.<br>
SET SEED=20090515.<br>
NEW FILE.<br>
INPUT PROGRAM .<br>
LOOP id=1 to 10000.<br>
COMPUTE die1=RND(RV.UNIFORM(.5,6.5)).<br>
COMPUTE die2=RND(RV.UNIFORM(.5,6.5)).<br>
END CASE.<br>
END LOOP.<br>
END FILE.<br>
END INPUT PROGRAM.<br>
FORMATS DIE1 DIE2 (F1).<br>
CROSSTAB TABLES= DIE1 BY DIE2 /CELLS=ALL.<br>
</tt><br>
Art Kendall<br>
Social Research Consultants<br>
<br>
On 3/6/2010 8:51 AM, Dates, Brian wrote:
<blockquote
cite="mid:A650B8D8486FD44CA54B17FD7E5C74A703AE220E@mail.swsol.org"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<meta name="GENERATOR" content="MSHTML 8.00.6001.18876">
<div><font color="#000000" face="Arial" size="2">Is it possible to
generate uniform random numbers in a specific range in matrix mode?
For example, if I want to create a vector (i=100, j=1) of random
numbers between 3 and 10, there doesn't seem to be a solution. If
n=100 and I use compute x=trunc(uniform(100,1)*n), I get numbers
between 1 and 10. If I use x=trunc(uniform(100,1)*n+2), I get numbers
between 3 and 12. So in one case I get the desired top of the range,
and in the other I get the desired bottom of the range. Any assistance
is appreciated. Thanks.</font></div>
<div> </div>
<div><font face="Arial" size="2">Brian</font></div>
</blockquote>
</body>
</html>
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
|