liveBook · Manning

Bootstrapping

As explained in Starting Data Analytics with Generative AI and Python

Bootstrapping is a resampling technique that estimates the variability of a statistic by repeatedly sampling observations with replacement from an observed dataset.

Bootstrapping estimates the variability of a statistic by repeatedly resampling an observed dataset. It can help estimate confidence intervals when the underlying data distribution is unknown or difficult to determine analytically. section 3.4.4

To build a bootstrap distribution:

  • Draw a random sample with replacement from the observed data, using the same number of observations as the original dataset. An observation can appear more than once in a sample. section 3.4.4
  • Calculate the statistic of interest, such as a mean, median, or regression coefficient, for that sample. section 3.4.4
  • Repeat the sampling and calculation. The resulting distribution of statistics can be used to estimate a confidence interval. section 3.4.4

Comparing sales and satisfaction

A retailer can use transaction data to estimate confidence intervals for average sales prices and review scores by state. The intervals show uncertainty that a point estimate alone does not. Their width depends on sample size, the selected confidence level, and variability in the data. section 3.4.4 section 4.8

Figure 4.6 Confidence intervals for (a) average sales price and (b) average review scores, for transactions in the “health and beauty” category of products
figure

Compare the intervals for average sales prices and review scores across states; uncertain estimates can make a state comparison inconclusive. section 4.8

First ask what population you want to describe. If the data are only a subset of transactions, an interval can express uncertainty about the wider population. If they contain every transaction in the population of interest, you can calculate that population’s average directly. Repeated resampling can also be computationally intensive, so check execution time when scaling the analysis. section 4.8 section 7.1

How Starting Data Analytics with Generative AI and Python covers it

How deep it goes
Explains resampling and bootstrap distributions, then interprets intervals and discusses computational cost.
Examples
Uses destructive equipment testing and Brazilian state-level sales prices and review scores as examples.
What you can do after
Evaluate and understand confidence intervals when comparing sampled sales and customer-satisfaction data.
How it connects
Connects bootstrap distributions to confidence intervals, sample size, data variability, and statistical inference.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Starting Data Analytics with Generative AI and Python. The section links point to the parts of the book it draws on.