On Wed, Aug 18, 2010 at 7:46 PM, Philip Wong <tombfigh...@mysinamail.com> wrote: > > well to be honest, it is a assignment for the Bayesian statistic paper I wish > to take later in the academic year. But I'm a slow learner, so I'm going to > try out some of the assignments posted in the university forum hoping to get > some practice in advance. > > Could you please elaborate more on the set.seed() function, I understood > from the ?set.seed the general idea of set.seed (if I didn't misunderstood > it). I could stimulate a six side dice by set.seed(1:6) with n number of > runs using runif(), does that meant if I use set.seed() I don't need to use > the prob=c(1,1,2,3,2,1)/10) to create my bias dice?
I cannot seem to put a nice definition of what set.seed() does into words, but if you run this code, I think it should be clear. It sort of ensures that the 'same' 'random' numbers are generated. When creating examples for others to use, it is nice to know that they will see the same thing the creator sees. # these are different runif(1) runif(1) # these are the same set.seed(1) runif(1) set.seed(1) runif(1) You are correct about the warnings having to do with using runif(1000). The first argument to runif() is n, the number of observations required. The result was 1000 observations being passed to a logical test designed to work on 1. > -- > View this message in context: > http://r.789695.n4.nabble.com/ifelse-command-tp2329538p2330591.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ 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.