s-news
[Top] [All Lists]

Re: How S chooses the .Random.seed

To: roula tsonaka <rtsonaka@yahoo.gr>
Subject: Re: How S chooses the .Random.seed
From: Patrick Burns <pburns@pburns.seanet.com>
Date: Mon, 01 Sep 2003 09:36:28 +0100
Cc: s-news@lists.biostat.wustl.edu
References: <20030901081813.62088.qmail@web41411.mail.yahoo.com>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.0.1) Gecko/20020823 Netscape/7.0
Not updating the random seed when an error occurs is
done on purpose -- and is a good thing.  That way if an
error only happens with some random seeds, you have
an opportunity to fix your function.

If you want to change the seed, you can use "set.seed".

S Poetry has some other cautions on random seeds.

Patrick Burns

Burns Statistics
patrick@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

roula tsonaka wrote:

Dear S-PLUS users,

I have made a function that is based on an iterative
algorithm which uses randomly chosen initial values
from a distribution. After many trials I realized that
when an error occurs and the procedures stops, the
re-running of the function starts from the same
initial values. In order to check out if this is a
defect of my function I tried the following function:

ff <- function(n){
 x <- rnorm(n)
 print(x)
stop("problem") }

ff(10)

which shows that every time the same values are
simulated after the procedure has stopped. Thus, I
would like to ask whether such a problem has something
to do with how S chooses the .Random.seed or is due to
something else
and how it can be overcome. I am using S-PLUS 6.1
Release 1
in Windows XP Home.

Thanks in advance for your suggestions.
Roula

=====
-----------------------------------------------------------
Spyridoula I. Tsonaka
Graduate Student
Department of Statistics
Athens University of Economics and Business (http://www.stat-athens.aueb.gr)

____________________________________________________________
Do You Yahoo!?
Αποκτήστε τη δωρεάν @yahoo.gr διεύθυνση σας στο http://www.otenet.gr
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news






<Prev in Thread] Current Thread [Next in Thread>