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
> -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
-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:
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
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
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
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
7 matches
Mail list logo