Re: [R] bootstrap sampling

From: sigalit mangut-leiba <smangut_at_gmail.com>
Date: Tue, 15 Jan 2008 22:55:24 +0200

 I used sample like you suggested.
Thank you,
Sigalit.

On 1/15/08, Zhengyang Sun <kirsten1209_at_gmail.com> wrote:
>
> Hi Sigalit,
> use ?sample. hope the example below answers your question:
> > aa<-rnorm(20,3,0.6)
> > aa
> [1] 2.348048 2.535320 2.773491 3.051137 2.574342 3.636812 3.267405
> 2.475192
> [9] 3.327903 3.539000 1.962290 2.423167 2.604629 2.929914 3.110048
> 3.673091
> [17] 3.316083 3.545558 3.103457 2.551673
> > sample(aa,30,replace=TRUE)
> [1] 2.475192 2.551673 2.535320 3.545558 3.673091 3.316083 2.348048
> 3.636812
> [9] 2.574342 3.051137 2.574342 2.574342 3.539000 2.535320 3.539000
> 3.545558
> [17] 3.051137 3.636812 2.475192 2.348048 3.051137 2.535320 3.316083
> 2.348048
> [25] 2.929914 3.539000 3.110048 2.773491 1.962290 2.475192
>
> then you can do the rest, eg, take mean, sum, etc of the resampled data
>
>
> 2008/1/15, sigalit mangut-leiba <smangut_at_gmail.com>:
> >
> > Hello,
> > How do I sample observations with replacement from a normal distribution
> > with a specific mean and s.d?
> > (I want to see the sample, not only the statistic.)
> > Thank you,
> > Sigalit.
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_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<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Tue 15 Jan 2008 - 20:58:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Jan 2008 - 21:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive