Bootstrapping does not assumed any knowledge of the form of the underlying parent distribution from which the sample arose. Traditional classical statistical parameter estimates are based on the normality assumption. Bootstrap deals with non-normality and is more accurate in practice than the classical methods.
Bootstrapping substitutes computers’ raw computing power for rigorous theoretical analysis. It is an estimate for the sampling distribution of a data set error term. Bootstrapping includes: re-sampling the data set a specified number of times, calculating the mean from each sample and finding the standard error of the mean.
The following “R” code demonstrates the concept:
This practical example demonstrates the usefulness of bootstrapping and estimates the standard error. The standard error is required to calculate confidence interval.
Let us assume you have a skewed data set "a":
a<-rexp(395, rate=0.1) # Create skewed data
visualization of the skewed data set
plot(a,type="l") # Scatter plot of the skewed data
boxplot(a,type="l") # Box plot of the skewed data
hist(a) # Histogram plot of the skewed data
Perform the bootstrapping procedure:
n <- length(a) # the number of bootstrap samples should equal the original data set
xbarstar <- c() # Declare the empty set “xbarstar” variable which will be holding the mean of every bootstrap iteration
for (i in 1:1000) { # Perform 1000 bootstrap iteration
boot.samp <- sample(a, n, replace=TRUE) #”Sample” generates the same number of elements as the original data set
xbarstar[i] <- mean(boot.samp)} # “xbarstar” variable collects 1000 averages of the original data set
##
plot(xbarstar) # Scatter plot of the bootstrapped data
boxplot(xbarstar) # Box plot of the bootstrapped data
hist(xbarstar) # Histogram plot of the bootstrapped data
meanOfMeans <- mean(xbarstar)
standardError <- sd(xbarstar) # the standard error is the standard deviation of the mean of means
confidenceIntervalAboveTheMean <- meanOfMeans + 1.96 * standardError # for 2 standard deviation above the mean
confidenceIntervalBelowTheMean <- meanOfMeans - 1.96 * standardError # for 2 standard deviation above the mean
confidenceInterval <- confidenceIntervalAboveTheMean + confidenceIntervalBelowTheMean
confidenceInterval