[R] Percentile bootstrap for the median : error message

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sat Jan 8 18:08:08 CET 2022


I see no error message.

Bert Gunter



On Sat, Jan 8, 2022 at 9:04 AM varin sacha via R-help <r-help using r-project.org>
wrote:

> Dear R-experts,
>
> Here below my R code for the percentile bootstrap confidence intervals
> with an error message.
> Is there a way to make my R code work ?
> Many thanks for your help and time.
>
> ############################################
> library(boot)
>
> s=rnorm(100000,0,1)
> (m<-median(s))
>
> N <- 100
> n<-5
> out <- replicate(N, {
>
> dat<-data.frame(sample(s,size=n))
> med<-function(d,i) {
> median(d[i, ])
> }
>
>   boot.out <- boot(data = dat, statistic = med, R = 10000)
>
>   boot.ci(boot.out, type = "per")$per[, 4:5]
>
> })
>
> mean(out[1, ] < m & m < out[2, ])
> ############################################
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list