
Dan Patiño
AI Strategy & Innovation at Coderhouse
Data
Sampling bias happens when the group of people, records, or events you analyze does not represent the larger population you want to draw conclusions about. Some members of the population are more likely to end up in your data than others, so your averages, rates, and trends drift away from reality—even if every calculation you run is technically correct.
Why it matters now: analysts rarely work with complete data. They work with survey responses, app users who accepted tracking, customers who left a review, or leads that reached the CRM. Each of those is a sample, and each comes with its own filter. When dashboards and AI models are built on top of a skewed sample, the bias scales with them. Understanding how samples are drawn is the difference between a confident insight and a confident mistake.
Population, sample, and sampling frame
Three terms make sampling bias easier to spot:
Population: everyone or everything you want to make claims about, such as all active customers or all transactions last quarter.
Sampling frame: the list or source you actually draw from, such as the email list, the app event table, or a panel of survey respondents.
Sample: the subset that ends up in your analysis.
Bias can enter at each step. If the frame leaves out part of the population (customers without email, users on an old app version), no amount of careful selection inside the frame will fix it.
Common types of sampling bias
Selection bias
The method used to pick the sample favors certain groups. Surveying only customers who visited the website this week, for example, over-represents your most engaged users. Sampling bias is often described as a specific form of selection bias.
Self-selection (voluntary response) bias
People choose whether to participate. Product reviews, NPS surveys, and social media polls attract people with strong opinions, often very happy or very unhappy ones, while the quiet middle stays silent.
Undercoverage
Part of the population has little or no chance of being included. Phone-only surveys miss people without phones; web analytics misses visitors who block cookies.
Non-response bias
You selected a fair sample, but certain groups answer far less than others. If busy executives ignore your survey, the results tell you more about everyone else.
Survivorship bias
You only see the cases that made it through some filter. Studying only successful startups, or only customers who are still active, hides the reasons others failed or churned. The classic World War II aircraft example is covered in the survivorship bias entry.
Convenience sampling
You use whatever data is easiest to collect: coworkers, a single region, the last 1,000 rows. It is quick, but rarely representative.
Probability vs. non-probability sampling
Statistical agencies split sampling methods into two families. In probability sampling, every unit in the population has a known, non-zero chance of selection, which lets you estimate how far your results might be from the truth. In non-probability sampling, selection depends on judgment or convenience, so you cannot calculate that uncertainty the same way.
The most common probability methods are:
Simple random sampling: every unit has an equal chance, like drawing user IDs at random.
Stratified sampling: split the population into groups (country, plan type, device) and sample from each, so small but important segments are not lost.
Cluster sampling: randomly select whole groups, such as stores or schools, then analyze units inside them.
Systematic sampling: pick every k-th record from an ordered list, which works well as long as the list has no hidden pattern.
How sampling bias shows up in everyday analytics
A/B tests: if traffic is not randomly split, or one variant loads slower and loses users before tracking fires, the comparison is biased before you read a single metric. Proper randomization is what makes A/B testing and statistical significance meaningful.
Customer research: interviewing only power users leads to roadmaps that ignore new or struggling customers.
Machine learning: a model trained on data from one region, age group, or device type can perform poorly on everyone else, which is one root cause of unfair or unreliable AI.
Executive dashboards: metrics based only on logged-in users or completed orders can look healthier than the business really is.
How analysts detect and reduce sampling bias
Define the population first. Write down exactly who or what your conclusion should apply to.
Compare the sample to known totals. Check the mix of countries, plans, devices, or ages against your full customer base or official statistics.
Randomize whenever you control selection. Random assignment and random sampling are the strongest protections available.
Stratify small segments. Make sure groups you care about have enough observations to say something.
Weight the results. If a segment is under-represented, survey weighting can rebalance it, as long as the segment is present at all.
Size the sample properly. Bigger samples reduce random error, not bias. The NIST handbook section on selecting sample sizes explains how precision and sample size relate.
Report the limits. State how the data was collected and who might be missing, alongside your confidence intervals.
Sampling bias vs. random error
Random error comes from chance: two random samples from the same population will give slightly different results, and that spread shrinks as samples grow. Sampling bias is systematic: it pushes results in one direction, and collecting more of the same skewed data only makes you more confident in the wrong answer. That is why a huge but biased dataset can be less useful than a small, well-designed random sample.
FAQ
Is a bigger sample always better?
A bigger sample reduces random error, but it does not fix bias. If the way you collect data excludes certain groups, adding more rows from the same source keeps the same blind spot.
Can weighting completely remove sampling bias?
Weighting helps when under-represented groups are present in the sample and you know their true share of the population. It cannot recover groups that were never sampled, and heavy weights increase uncertainty.
How is sampling bias related to correlation vs. causation?
A biased sample can create patterns that do not exist in the population, which makes it easier to mistake a coincidence for a cause. Thinking about who is in the data is a key part of avoiding correlation vs. causation mistakes.
Does AI make sampling bias worse?
Models learn from the data they are given. If training data under-represents certain users or situations, the model inherits that gap and can repeat it at scale, so data checks matter even more in AI projects.
Build analysis you can trust with live practice
If you want hands-on experience designing samples, running experiments, and building reliable data and AI products, Coderhouse offers live online courses:
Data Analytics Course: for career switchers, analysts, and data-driven professionals who want to master metrics, SQL, Python, visualization, and experimentation.
AI Engineering Course: for developers moving into AI engineering, covering LLM applications, retrieval, agents, evaluation, and deployment.
I'm Dan Patiño, head of AI Strategy & Innovation at Coderhouse. My day-to-day work involves merging the tactical management of e-commerce (CRO, Email Marketing and SEO) with the development of disruptive solutions. I specialize in building internal AI-powered apps to automate tasks and boost innovation within the team. I firmly believe that technology is strategy's best ally. To dive deeper into my professional journey, I'll be waiting for you on my LinkedIn profile.