Questions tagged [statistics-bootstrap]

In statistics, a bootstrap is a resampling technique based on random sampling with replacement.

The bootstrap was introduced by Brad Efron in the Late 1970s. It is a computer‐intensive method that enables enables researchers to estimate the sample statistics (such as medians, variances, percentiles) by drawing randomly with replacement from a set of available data.

See also:

  1. The Wikipedia page on Bootstrapping
  2. Bootstrapping using boot package in R
  3. Brad Efron's paper on bootstrap
  4. Review on bootstrap methods in econometrics
602 questions
7
votes
5 answers

R Mediation Analysis -- Bootstrapping

I am attempting to do a mediation analysis in R using the mediate package. I have looked at the documentation on how to do this, and have read through the examples provided by R (i.e., I've already run "example(mediate)"). Despite this, I cannot get…
Jess A.
  • 85
  • 1
  • 5
7
votes
1 answer

function works (boot.stepAIC ) but throws an error inside another function - environment issue?

I realized a strange behavior today with in my R code. I tried a package {boot.StepAIC} which includes a bootstrap function for the results of the stepwise regression with the AIC. However I do not think the statistical background is here the…
Sebastian
  • 633
  • 2
  • 6
  • 16
6
votes
2 answers

R: Remove nested for loops in order to make a custom bootstrap more efficient

I am trying to gather some bootstrapped estimates for summary statistics from a dataset, but I want to resample parts of the dataset at different rates, which has led me to lean on nested for loops. Specifically, suppose there are two groups in my…
dw0914
  • 63
  • 3
6
votes
0 answers

Why no speed up with parallel using boot.ci to get BCa confidence intervals?

The bottom of the answer in this question (Calculating CIs of fixed effects using confint in R) suggests one should see user time > elapsed time when parallel works. Despite specifying parallel = "multicore", ncpus = 4 when running boot.ci I don't…
RGecon
  • 115
  • 2
  • 10
6
votes
6 answers

Add a progress bar to boot function in R

I am trying to add a progress bar to a bootstrap function in R. I tried to make the example function as simple as possible (hence i'm using mean in this example). library(boot) v1 <- rnorm(1000) rep_count = 1 m.boot <- function(data, indices) { d…
fzara
  • 107
  • 7
6
votes
3 answers

Bootstrapping to compare two groups

In the following code I use bootstrapping to calculate the C.I. and the p-value under the null hypothesis that two different fertilizers applied to tomato plants have no effect in plants yields (and the alternative being that the "improved"…
gd047
  • 29,749
  • 18
  • 107
  • 146
6
votes
2 answers

Bootstrap Multinomial regression in R

I am trying to bootstrap a simple multinomial regression in R, and I am getting an error: Error in is.data.frame(data) : object 'd' not found What is really strange is that I am using the same code (adjusted to this particular problem) as in a…
striatum
  • 1,428
  • 3
  • 14
  • 31
6
votes
1 answer

txtProgressBar for parallel bootstrap not displaying properly

Below is a MWE of my problem: I have programmed a progress bar for some function using the bootstrap (via the boot function from the boot package). This works fine as long as I don't use parallel processing (res_1core below). If I want to use…
5
votes
1 answer

Bootstrap Confidence Intervals in R

I am a new R user, and am having trouble using the boot package. All I want to do is use bootstrapping to produce confidence intervals around a mean for a vector of numbers, such as: x <- rnorm(100, 1, .5) Any tips?
mike
  • 22,931
  • 31
  • 77
  • 100
5
votes
1 answer

Adding confidence intervals to plot from simulation data in R

I've created a probit simulation based on a likelihood function and simulation, all of which can be replicated with the code below. This is the likelihood function: probit.ll <- function(par,ytilde,x) { a <- par[1] b <- par[2] return( -sum(…
Captain Murphy
  • 855
  • 3
  • 15
  • 23
5
votes
1 answer

Boot package in R simple assistance

If I want to use the the boot() function from R's boot package for calculating the significance of the Pearson correlation coefficient between two vectors, should I do it like this: boot(re1, cor, R = 1000) where re1 is a two column matrix for…
Fedja Blagojevic
  • 813
  • 1
  • 10
  • 18
5
votes
1 answer

Bootstrap variables correlation in R

My intention was to write several functions aimed at finding the overall similarity between two covariance matrices, either by multiplying them with random vectors and correlating the response vectors or by bootstrapping one of the matrices to…
Fedja Blagojevic
  • 813
  • 1
  • 10
  • 18
5
votes
2 answers

R: Bootstrap percentile confidence interval

library(boot) set.seed(1) x=sample(0:1000,1000) y=function(u,i) sum(x[i]) o=boot(x,y,1000) theta1=NULL theta1=cbind(theta1,o$t) b=theta1[order(theta1)] bp1=c(b[25], b[975]) ci=boot.ci(o,type="perc") I am using two method to construct bootstrap…
yap
  • 61
  • 6
5
votes
1 answer

Plot the median, confidence interval of a bootstrap output in ggplot2

I have a dataframe df (see below) dput(df) structure(list(x = c(49, 50, 51, 52, 53, 54, 55, 56, 1, 2, 3, 4, 5, 14, 15, 16, 17, 2, 3, 4, 5, 6, 10, 11, 3, 30, 64, 66, 67, 68, 69, 34, 35, 37, 39, 2, 17, 18, 99, 100, 102, 103, 67, 70, …
SimonB
  • 670
  • 1
  • 10
  • 25
5
votes
2 answers

How do I replace the bootstrap step in the package randomForest r

First some background info, which is probably more interesting on stats.stackexchange: In my data analysis I try to compare the performance of different machine learning methods on time series data (regression, not classification). So for example I…
DaReal
  • 597
  • 3
  • 10
  • 24
1
2
3
40 41