Simulating the Effects of Non-Representative Sampling and Sample Size

What I find exhilarating about constructing Python simulations is that they can bring to life concepts and frameworks of how we understand the world in a creative, tangible way.

Today, I’ll run through a two simulations. The purpose of the first is to demonstrate the effect of a non-representative sample, one of many types of sampling bias. In real life, this could include over/underrepresentation of subgroups, voluntary bias, or non-response bias, and is common when looking to make sampling more convenient and economical (e.g., surveying people on the way out of the store or on the street, web-intercept surveys, club or class members, etc.). The purpose of the second is to illustrate sample size effect by simulating subsampling of a real health dataset. My analysis includes basic for loops, generating random normal distributions using random.normal and random.choice, generating histograms using seaborn, and drawing statistical observations.

My code, explanatory notes, observations, and visualizations are below if you’d like to try it yourself.

Next time, I’ll explore Gapminder’s global development dataset and recreate the bubble plot from Hans Rosling’s famous TED talk.

As always, if you’re curious about exploring or understanding something about the world using data, reach out to info@crawstat.com.

Here’s to a good sample,

Rish

Leave a Reply

Discover more from crawstat.

Subscribe now to keep reading and get access to the full archive.

Continue reading