Skip to content
Back to formatted view

Raw Message

Message-ID: <73881598-CBCA-4B39-BFEB-8D371EEAFC18@auckland.ac.nz>
Date: 2009-05-13T22:26:38Z
From: Rolf Turner
Subject: Simulation
In-Reply-To: <4A0B43E8.2020908@witthoft.com>

On 14/05/2009, at 10:04 AM, Carl Witthoft wrote:

> So far nobody seems to have warned the OP about seeding.
>
> Presumably Debbie wants 1000 different sets of samples, but as we all
> know there are ways to get the same sequence (initial seed) every  
> time.
>   If there's a starting seed for one of the "generate a single giant
> matrix" methods proposed, the whole matrix will be the same for a  
> given
> seed.
> If rnorm is called 1000 times (hopefully w/ different random (oops)
> seeds), the entire set of samples will be different.
>
> and so on.

I really don't get this.  The OP wanted 1000 independent samples,
each of size 100.  Whether she does

set.seed(42)
M <- matrix(rnorm(100*1000),nrow=1000) # Each row is a sample.

or

L <- list()
set.seed(42)
for(i in 1:1000) L[[i]] <- rnorm(100) # Each list entry is a sample.

she gets this, i.e. the desired result.  Setting a seed serves to make
the results reproducible.  This works via either approach.  Making  
results
reproducible in this manner is advisable, but seed-setting is nothing  
that the OP
needs to be *warned* about.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}