Re: [R] Problems with sample variance

2009-05-20 Thread milton ruser
20, 2009 10:02 PM > > To: milton ruser; Chloe Smith > > Cc: r-help@r-project.org > > Subject: Re: [R] Problems with sample variance > > > > Thanks Milton - I misread Chloe's original question. > > > > nSims <- 1000 > > sampSiz <- 15 > > my

Re: [R] Problems with sample variance

2009-05-20 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Alspach > Sent: Wednesday, May 20, 2009 10:02 PM > To: milton ruser; Chloe Smith > Cc: r-help@r-project.org > Subject: Re: [R] Problems with sample

Re: [R] Problems with sample variance

2009-05-20 Thread Peter Alspach
-boun...@r-project.org] On Behalf Of milton ruser > Sent: Thursday, 21 May 2009 4:30 p.m. > To: Chloe Smith > Cc: r-help@r-project.org > Subject: Re: [R] Problems with sample variance > > Hi Chloe, > > Try this: > > NUMBER.OF.RUNS<-10 #change here > for (NR in 1:

Re: [R] Problems with sample variance

2009-05-20 Thread milton ruser
Hi Chloe, Try this: NUMBER.OF.RUNS<-10 #change here for (NR in 1:NUMBER.OF.RUNS) { number.simulation<-1000 sample.size=15; variance.list<-NULL for(i in 1:number.simulation) { mysample<-rnorm(sample.size) variance.list<- c(variance.list, var(mysample)) } #i hist(variance.list) } #NR

Re: [R] Problems with sample variance

2009-05-20 Thread Peter Alspach
t.org] On Behalf Of Chloe Smith > Sent: Thursday, 21 May 2009 12:33 p.m. > To: r-help@r-project.org > Subject: [R] Problems with sample variance > > > Dear R users, > > I am a beginner to R. I generated 1000 samples with 15 data > in each sample > > I tried f

[R] Problems with sample variance

2009-05-20 Thread Chloe Smith
Dear R users, I am a beginner to R. I generated 1000 samples with 15 data in each sample I tried finding the variance for each sample I used the code: m=1000;n=15 > r<-rnorm(15000) > for(i in 1:m){ x=data[,i] v=var(x)} what I got was just the variance for the last sample i.e. the 1000th sampl

Re: [R] Problems with sample variance

2009-05-20 Thread Ben Bolker
Chloe Smith wrote: > > > [snip] > > what I got was just the variance for the last sample i.e. the 1000th > sample > > but what I want is 1000 variance. > > m=1000;n=15 r<-matrix(rnorm(m*n),nrow=m) apply(r,1,var) -- View this message in context: http://www.nabble.com/Problems-with-samp