Calculating Confidence Interval with Bootstrapping

Calculating Confidence Interval with Bootstrapping

How can we calculate the confidence interval with bootstrapping?

Hi everyone,

In this article, I will attempt to explain how we can find a confidence interval by using Bootstrap Method. Statistics and Python knowledge are needed for better understanding.

Before diving into the method, let’s remember some statistical concepts.

*Variance: *It is obtained by the sum of squared distances between a data point and the mean for each data point divided by the number of data points.

Image for post

Sample variance

Standard Deviation: It is a measurement that shows us how our data points spread out from the mean. It is obtained by taking the square root of the variance

Image for post

Sample standard deviation

Cumulative Distribution Function: It can be used on any kind of variable X(discrete, continuous, etc.). It shows us the probability distribution of a variable. Therefore allowing us to interpret the probability of a value less than or equal to x from a given probability distribution

Empirical Cumulative Distribution Function: Also known as Empirical Distribution Function. The only difference between CDF and ECDF is, while the former shows us the hypothetical distribution of any given population, the latter is based on our observed data.

Image for post

For example, how can we interpret the ECDF of the data shown on the chart above? We can say that 40% of heights are less than or equal to 160cm. Likewise, the percentage of people with heights of less than or equal to 180 cm is 99.3%

Probability Density Function: It shows us the distribution of continuous variables. The area under the curve gives us the probability so that the area must always be equal to 1

Normal Distribution: Also known as Gaussian Distribution. It is the most important probability distribution function in statistics which is bell-shaped and symmetric.

Image for post

Normal (Gaussian) Distribution

_Confidence Interval: _It is the range in which the values likely to exist in the population. It is estimated from the original sample and usually defined as 95% confidence but it may differ. You can consider the figure below which indicates a 95% confidence interval. The lower and upper limits of confidence interval defined by the values corresponding to the first and last 2.5th percentiles.

Image for post

95% Confidence Interval, Image by author

What is Bootstrap Method?

Bootstrap Method is a resampling method that is commonly used in Data Science. It has been introduced by Bradley Efron in 1979. Mainly, it consists of the resampling our original sample with replacement (Bootstrap Sample) and generating Bootstrap replicates by using Summary Statistics.

Confidence Interval of people heights

In this article, we are going to work with one of the datasets in Kaggle. It is Weight-Height data sets. It contains height (in inches) and weight (in pounds) information of 10.000 people separated by gender.

If you would like to see the whole code, you can find the IPython notebook via this _[**_link**](

We are going to use only heights of 500 randomly selected people and compute a 95% confidence interval by using Bootstrap Method

Let’s start with importing the libraries that we will need.

bootstrap bootstrapping calculating

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Bootstrap Tutorial 2020 - Getting Started

In this video, I'll be showing you how to quickly get started with Bootstrap. 🔴 Subscribe for more

Volt - Free Bootstrap 5 Admin Dashboard

Volt is a free and open source Bootstrap 5 Admin Dashboard featuring 11 example pages, 100 components and 3 plugins with Vanilla JS.

How to create a calculator using javascript - Pure JS tutorials |Web Tutorials

### In this video I will tell you How to create a calculator using javascript very easily. <iframe width="560" height="315" src="" frameborder="0" allow="accelerometer; autoplay; clipboard-write;...

Bootstrap Tutorial 2020 - Badges

In this video, I'll be showing you how to quickly get started with bootstrap badges. 🔴 Subscribe for more

Bootstrap Cards Design | Bootstrap 4 Tutorial for Beginners

Bootstrap Cards Design | Bootstrap 4 Tutorial for Beginners Source Code: -------------------------------------------------------------...