hey guys, i've been following this discussion about the simulation, and being a beginner myself, im really unsure of the best method.
I hve the same problem as the initial one, except i need 1000 samples of size 15, and my distribution is Exp(1). I've adjusted some of the loop formulas for my n=15, but im unsure how to proceed in the quickest way. Can someone please help? Much appreciated :) > From: r.tur...@auckland.ac.nz > Date: Thu, 14 May 2009 10:26:38 +1200 > To: c...@witthoft.com > CC: r-help@r-project.org > Subject: Re: [R] Simulation > > > 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}} > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. _________________________________________________________________ [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.