Re: [R] bootstrap for confidence intervals of the mean

From: Robert A LaBudde <>
Date: Tue, 22 Apr 2008 13:52:16 -0400

See the help for boot().

The function in the 2nd argument has to be of a special form.

You need to define such a form, as in:

fmean<- function (x, i) mean(x[i]) #use data x[] and indices i

and then

boot.out<- boot(d, fmean, R=1000, sim='permutation')

At 12:59 PM 4/22/2008, stephen sefick wrote:
>d = c(0L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0L, 0L, 7375L,
>NA, NA, 17092L, 0L, 0L, 32390L, 2326L, 22672L, 13550L, 18285L)
>boot.out <-boot(d, mean, R=1000, sim="permutation")
>Error in mean.default(data, original, ...) :
> 'trim' must be numeric of length one
>I know that I am missing something but I can't figure it out.
>Let's not spend our time and resources thinking about things that are so
>little or so large that all they really do for us is puff us up and make us
>feel like gods. We are mammals, and have not exhausted the annoying little
>problems of being mammals.
>-K. Mullis
> [[alternative HTML version deleted]]
> mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail:
Least Cost Formulations, Ltd.            URL:
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire" mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Apr 2008 - 18:25:33 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 22 Apr 2008 - 18:30:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive