Set Seed for Random Number in v15

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

Set Seed for Random Number in v15

Meyer, Gregory J
Dear Listmembers,

In the process of running simulations as part of a teaching exercise I
noticed that the SET SEED command in v15.0.1 works the first time it is
run during a session but not again during the same session. i.e., once
it is run once, the seed cannot be reset until SPSS is restarted. In v11
and v17 the seed resets each time the SET SEED command is run. I checked
the archives and did not see any mention of this. However, I am curious
if this is a known bug.

Thanks,

Greg

=====================
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: Set Seed for Random Number in v15

Oliver, Richard
Set Seed for Random Number in v15
Make sure that the random number generator is set to MC (SET RNG MC). Then it should work. The following syntax produce the expected results in SPSS 15.0.1:
 
set rng mc seed 123456789.
data list free /x.
begin data
1 2 3
end data.
compute newvar=rv.normal(50,10).
execute.
show seed.
set seed 123456789.
show seed.


From: SPSSX(r) Discussion on behalf of Meyer, Gregory J
Sent: Thu 2/19/2009 6:19 PM
To: [hidden email]
Subject: Set Seed for Random Number in v15

Dear Listmembers,

In the process of running simulations as part of a teaching exercise I
noticed that the SET SEED command in v15.0.1 works the first time it is
run during a session but not again during the same session. i.e., once
it is run once, the seed cannot be reset until SPSS is restarted. In v11
and v17 the seed resets each time the SET SEED command is run. I checked
the archives and did not see any mention of this. However, I am curious
if this is a known bug.

Thanks,

Greg

=====================
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: Set Seed for Random Number in v15

Meyer, Gregory J
Set Seed for Random Number in v15
Thanks very much Richard. This fixed the "bug" (aka me). I knew there was now two random number generators but didn't realize that SEED was the keyword for MC only (which I thought I was using) and that MTINDEX was needed instead as the keyword to set the initialization value for MT.
 
Thanks again,
 
Greg


From: SPSSX(r) Discussion on behalf of Oliver, Richard
Sent: Thu 2/19/2009 8:34 PM
To: [hidden email]
Subject: Re: Set Seed for Random Number in v15

Make sure that the random number generator is set to MC (SET RNG MC). Then it should work. The following syntax produce the expected results in SPSS 15.0.1:
 
set rng mc seed 123456789.
data list free /x.
begin data
1 2 3
end data.
compute newvar=rv.normal(50,10).
execute.
show seed.
set seed 123456789.
show seed.


From: SPSSX(r) Discussion on behalf of Meyer, Gregory J
Sent: Thu 2/19/2009 6:19 PM
To: [hidden email]
Subject: Set Seed for Random Number in v15

Dear Listmembers,

In the process of running simulations as part of a teaching exercise I
noticed that the SET SEED command in v15.0.1 works the first time it is
run during a session but not again during the same session. i.e., once
it is run once, the seed cannot be reset until SPSS is restarted. In v11
and v17 the seed resets each time the SET SEED command is run. I checked
the archives and did not see any mention of this. However, I am curious
if this is a known bug.

Thanks,

Greg

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