I am going to teach statistics as a teaching assistant for the second half of this semester to CS-oriented undergraduate students. Most of the students took the class has no incentive to learn the subject and only took it for major requirements. I want to make the subject interesting and useful, not just a class they learn to get a B+ to pass.

As a pure-math PhD student I knew little on the real-life applied side. I want to ask for some real-life applications of undergraduate statistics. Examples I am looking for are ones (in spirit) like:

1) Showing central limit theorem is useful for certain large sample data.

2) Provide a counter-example that central limit theorem is not applicable (say, the ones following Cauchy distribution).

3) Showing how hypothesis testing works in famous real life examples using Z-test, t-test or something.

4) Showing how overfitting or wrong initial hypothesis could give to wrong results.

5) Showing how p-value and confidence interval worked in (well known) real life cases and where they do not work so well.

6) Similarly type I, type II errors, statistical power, rejection level $\alpha$, etc.

My trouble is that while I do have many examples on probability side (coin toss, dice toss, gambler's ruin, martingales, random walk, three prisoner's paradox, monty hall problem, probability methods in algorithm design, etc), I do not know as many canonical examples on the statistics side. What I mean is serious, interesting examples that has some pedagogical value, and it is not extremely artificially made up that seems very detached from real life. I do not want to give students the false impression that Z-test and t-test is everything. But because of my pure math background I do not know enough examples to make the class interesting and useful to them. So I am looking for some help.

My student's level is around calculus I and calculus II. They cannot even show the standard normal's variance is 1 by definition as they do not know how to evaluate the Gaussian kernel. So anything slightly theoretical or hands-on computational (like hypergeometric distribution, arcsin law in 1D random walk) is not going to work. I want to show some examples that they can understand not just "how", but also "why". Otherwise I am not sure if I will be proving what I said by intimidation.

  • 2
    $\begingroup$ As this stands it seems a little broad and not very focused "some real-life applications of undergraduate statistics" isn't especially suited for QA format. At best it's a 'big-list' question. If (3) alone may be too broad and unfocused, but might be a goer with a little rephrasing, and (4) might stand alone well enough with a little more focus. (1) cannot succeed in any case, since the central limit theorem really tells us nothing about what happens at $n=100$ or $n=1000$ or $n=10^{10}$. It's not a finite-sample result. $\endgroup$
    – Glen_b
    Commented Mar 28, 2015 at 4:02
  • 3
    $\begingroup$ The Berry-Esseen theorem (which I expect you don't teach at that level) could be used with finite samples. Informally of course, sample means of particular distributions do become more and more normal as sample sizes increase, but we can't really say "that's the central limit theorem", since the CLT doesn't actually say anything about that. In addition, to show things getting steadily closer to a normal distribution, you need a sequence of sample sizes. In real world data collection that's common only in data collected over time (so if you're assuming iid, you may have some difficulty). $\endgroup$
    – Glen_b
    Commented Mar 28, 2015 at 4:13
  • 2
    $\begingroup$ There's a real data (from an experiment - if a somewhat artificial one) set - 40000 coin tosses - linked from here $\endgroup$
    – Glen_b
    Commented Mar 28, 2015 at 4:48
  • 1
    $\begingroup$ You can show them something about how sample means behave in particular situations with increasing sample size -- that's quite useful; it's just not strictly accurate to attribute it to the CLT. The coin-toss data may be useful for that (as might data they generate themselves in similar fashion). You might want to read the information at the link before you get the data though, because there's an important feature of the data (which is also the motivation for collecting it in the first place). $\endgroup$
    – Glen_b
    Commented Mar 28, 2015 at 4:54
  • 1
    $\begingroup$ Examples of almost every thing you list are provided in good intro stats texts, such as Freedman, Pisani, & Purves. (I linked to the Third Edition, which you can easily find used for under \$10 US. Any edition will do fine; the latest edition may have more up-to-date examples.) $\endgroup$
    – whuber
    Commented Mar 30, 2015 at 20:09

6 Answers 6


I started by typing a comment but it became too lengthy...

Keep in mind that they are CS student. You won't please them the way you please mathematicians (with $\sigma$ algebras) or biologist, physicians (with biological or medical data, and classical recipes for testing good old null hypotheses). If you have enough freedom to decide the orientation of the lecture, if the point is that they learn basic concepts, my advice is to make a radical change of orientation. Of course, if other teachers want them to be able to perform some predefined tasks, you are a bit stuck.

So, in my opinion, they will like it if you present inference from a "learning" point of view, and if you present tests from a "decision theory" or "classification" point of view -- in short, they're supposed to like algorithms. To grok algorithms!

Also, try to find CS related datasets ; e.g. the duration of connections and the number of request per unit of time to an html server can help to illustrate many concepts.

They will love to learn simulation techniques. Lehmer generators are easy to implement. Show them how to simulate other distributions by inverting the cdf. If you're into this, show them Marsaglia's Ziggurat algorithm. Oh, and the MWC256 generator by Marsaglia is a little gem. The Diehard tests by Marsaglia (tests for fairness of uniform generators) can help to illustrate many concepts of probability and statistics. You can even chose to present probability theory based on "(independent) streams of random doubles, oups, I mean reals" -- this is a bit cheeky, but it can be grand.

Also, remember that page rank is based on a Markov chain. This is not easy matter but following the presentation from Arthur Engel (I think the reference is the probabilistic abacus -- if you read French, this book is absolutely a must read), you can easily present a few toy examples that they'll like. I think that CS science student will like Discrete Markov chains much more than $t$-tests, even if it seems more difficult material (Engel's presentation makes it very easy).

If you master your subject enough, don't hesitate to be original. "Classical" lectures are ok when you teach something you are not fully familiar with. Good luck, and if you release some lecture notes please let me know!


One good way can be to install R (http://www.r-project.org/) and use its examples for teaching. You can access the help in R with commands "?t.test" etc. At end of each help file are examples. For t.test, for example:

> t.test(extra ~ group, data = sleep)

        Welch Two Sample t-test

data:  extra by group
t = -1.8608, df = 17.776, p-value = 0.07939
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -3.3654832  0.2054832
sample estimates:
mean in group 1 mean in group 2 
           0.75            2.33 

>  plot(extra ~ group, data = sleep)

enter image description here


I suggest an application of the central limit theorem for pre-determination of a sample size and finding an answer to questions like "did I send out enough questionnaires" etc.

http://web.as.uky.edu/statistics/users/pbreheny/580-F10/notes/9.pdf provides a fine real-world example of how to apply the central limit theorem. A didactic strategy might be:

A) theory

*make clear the difference between a sampling distribution and the distribution of an estimate, e.g. by the "flat" distribution of rolling a die versus the distribution of the mean of N dice (use R or let the students even play themselves with Excel drawing single-value distributions versus distribution of means)

*show the formula-based calculation of percentiles for the distribution of the mean (as you are deep into maths, you might want to derive the formula) -- this point corresponds to slides 10-17 in the presentation linked above

and then (as in slide 20 from the presentation linked above):

B) application

*show how the central limit theorem helps to determine sample sizes for a desired exactnes in estimates of the mean

This application B) is what in my experience non-statisticians expect from a statistician - answering questions of the type "do I have enough data?"


Since you are teaching CS students, a nice application of the Central Limit Theorem may be to estimate the mean from a massive datasets (i.e. > 100 millions of records). It might be instructive to show that it's not necessary to calculate the mean for the entire dataset, but instead to sample from the dataset and use the sample mean to estimate the mean from the entire dataset/database. You could take this a step further if you wanted and simulate a datatset that has drastically different values for different subgroups. You could then have the students explore stratified sampling to obtain more accurate estimates.

Again, since there are CS students, you may want to do some bootstrapping to obtain confidence intervals as well or to estimate the variances of more complex statistics. This is a nice intersection of statistics and computer since, in my opinion and might lead to greater interest in the subject matter.


You say this is computer-science students. What are their interests, is this mainly theoretical computer science, or students mainly motivated by preparing for jobs? You could also tell us what is the course description!

But, whatever your answer to those questions, you could start with some practical statistics occurring in informatics contexts, such as (for example) web design. This site from time to time has questions about this, such as Conversion rates over time or https://stats.stackexchange.com/questions/96853/comparing-sales-person-conversion-rates or AB Testing other factors besides conversion rate .

There are lots of questions here such as these, seemingly from people involved in web design. The situation is that you have some web page (say, you sell something). The "conversion rate", as I understand it, is the percentage of visitors which go on to some preferred task (such as buying, or some other goal you have for your visitors). Then you, as web designer, ask if your layout of the page influence this behavior. So you program two (or more) versions of the web page, choose randomly which version to present to some new customer, and can so compare the conversion rates, and finally choose to implement the version with highest conversion rate.

This is a problem of design of a comparison experiment, and you need statistical methods to compare percentages, or maybe directly the contingency table of designs versus convert/no convert. That example could show them that statistics could actually be useful for them in some web development job! And, from the statistical side, it opens for a lot of interesting questions about validity of assumptions ...

To connect to what you say about central limit theorem, you can ask how many observations you need before you can treat the percentages as normally distributed, and have them study that using simulation ...

You can search this site for other stats questions posed by programmer types ...


I suggest that, before any good examples, it is better to focus on clear-definitions. In my experience, undergraduate probability and statistics is a course filled with words that none of the students understand. As an experiment, ask students who just finished a probability course what a "random variable" is. They might give you examples, but I doubt that most will give you a clear definition of it. What exactly is "probability"? What is a "distribution"? The terminology in statistics is even more confusing. Most undergraduate books I seen do a very bad job as explaining this. Examples and computations are nice, but without clear definitions it is not as helpful as one would think. Speaking from my experience, this was exactly why I hated probability theory as an undergraduate. Even though my interests as far as removed from probability as one can have, I now appreciate the subject, because I eventually taught myself what all the terminology really means. I apologize that this is not exactly what you asked, but given that you are teaching such a class I thought that this would be useful advice.

  • 1
    $\begingroup$ I'm not sure that I agree--at least not in most/all cases. For some, the conceptual understanding may, as you suggest, precede the application to particular examples, but for other students, conceptual understanding (especially for complicated topics) may come about only through the use of a particularly illuminating example. $\endgroup$
    – jsakaluk
    Commented Mar 28, 2015 at 4:15
  • $\begingroup$ When I was an undergraduate I generally had not much difficultly reading graduate mathematics and solving the problems there. I knew what I was doing and what I had to do. Probability theory, or statistics, is "easier" than the subjects I was learning. But I had no idea what I was doing or why I had to do. The textbooks themselves were completely unhelpful to me. After reading them I did not really understand the vocabulary. Sure, I can do the computations but at the end of the day, I just saw it as an empty subject. If I had this confusion, al fortiorti, the non-math inclined students do too. $\endgroup$ Commented Mar 28, 2015 at 4:21
  • 5
    $\begingroup$ I wonder if this might be more helpful advice for teaching probably to very bright students on a pure mathematics degree than for teaching applied statistics to CS majors. $\endgroup$
    – Silverfish
    Commented Mar 28, 2015 at 9:05
  • $\begingroup$ @Silverfish I am not sure if my advice is only applicable to students of mathematics. One can develop the language of measure theory and show how probability is expressed in it, without going into the theory. This is really not any different from basic calculus. Most books at least define their terms but they do not go into the theory of them. If the students understood that statistics is the inverse problem of probability, and that, for instance, we "care" about the mean because it approximates the expected value of a random variable, then they may appreciate it much more. $\endgroup$ Commented Apr 5, 2015 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.