Date: Wed, 8 Jun 2011 14:26:03 -0600
Reply-To: Jon K Peck <peck@us.ibm.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jon K Peck <peck@us.ibm.com>
Subject: Re: Generating random 'constants'
In-Reply-To: <1307563872864-4470810.post@n5.nabble.com>
Content-Type: multipart/alternative;
I interpreted the request as asking for a column of constant values, so
something like this would be required.
DO IF $casenum = 1.
COMPUTE RV = rv.normal(0,1).
END IF.
LEAVE RV.
Jon Peck
Senior Software Engineer, IBM
peck@us.ibm.com
new phone: 720-342-5621
From: David Marso <david.marso@gmail.com>
To: SPSSX-L@LISTSERV.UGA.EDU
Date: 06/08/2011 02:20 PM
Subject: Re: [SPSSX-L] Generating random 'constants'
Sent by: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
dk,
DO IF $CASENUM=1.
COMPUTE #RV=NORMAL(0,.1).
END IF.
* If you want a permanent copy *.
COMPUTE RV=#RV.
'--------
Note use of scratch variable.
Read up on scratch variables.
--
drewk wrote:
>
> I'm attempting to generate random 'constant' variables. I mean random as
> in randomly generated, and constant as in constant across all
> observations. I intend this to be used as a multiplier of sorts which is
> randomly generated when the syntax is run to introduce a little
variation.
>
> For example, I have a probability for a certain event, and I am running
> multiple 'trials' of this event and recording the outcome. For
theoretical
> reasons, I want to add or subtract a randomly generated value (something
> like RV.Normal(0,.1)) from this probability for each observation.
However,
> just generating a variable such as:
>
> compute randomadjustment = RV.Normal(0,.1).
>
> will create a unique random number for each observation. However, I want
> this adjustment to be constant across all observations. This way, every
> time the syntax is run, every observation's probability has the same
> random number added or subtracted from it. Is it possible to generate a
> 'random constant variable'?
>
> I hope all of this makes sense. Thanks for any help,
> -dk
>
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Generating-random-constants-tp4470695p4470810.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
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
[text/html]