Biostatistics 2017


Grader: Yingxin Cao <>

Office hours every Tuesday 1pm to 4pm on the forth floor where the open space is. 

Recommend Text Books:

Statistics for Engineers and Scientists (2nd edition)
William Navidi MGraw Hill

Purchase second-hand at sites such as Amazon, abebooks and alibris

OpenIntro Statistics 3rd Edition, Deiz et al



Binomial Tables Download

z-table (Standard Normal Cumulative Probability Table Download


Python Information:

As part of the biostatistics class, you will be using Python (at a basic level) to do some assignments. One of the things I hope to do on Thursday is to introduce Python and make sure you have Python set up on whatever computer you have (even the humble iphone)

For Windows and Mac (and probably linux) you can use either:




or our own distribution (Get the IDE version, if you happened to like notebooks, get the notebook version, the notebook version works well on Linux)


What is common with all of them is they use a front-end called Spyder which givens the development environment a Matlab like look.

For the iPad and in theory the iPhone, you can install (costs you $10, there are also free ones but I don’t know if they have all the bits)

Pythonista 3:

If you’re using an Android device you can try:

but I don’t know how good it is, I think it has all the plotting bits we’ll need.

Finally, you’ll see references to Python 2.7 or Python 3.5, doesn’t matter really which one you use but Python 3.5 is the most modern.

Week 0:

Introduction to Python and plotting

Here is zip file that contains all the Python examples

Assignment (Due the following Thursday, 5th October)

  1. Write a small python script that  plots the running average of uniformly generated random numbers. Show that as
    the number of averaged random numbers increases, the mean tends to a value of 0.5. Details of how to compute a running average can be found at the Wikipedia page: On the page find the section “Cumulative Running Average”, the second equation can be used to compute the moving average.Provide a commented script as well as the results of your runs.
  2. Studying the sample variance.a) Create a population of random uniform numbers between 0 and 1, a hundred numbers will be sufficient.
    b) Compute the population mean and variance.
    c) Sample 10 randomly chosen numbers from this population. Compute the mean and variance of the sample using the (1/n-1) correction for the variance
    d) Do c) n times and average the sample mean and variance.
    e) Compute the relative error between the averaged sample mean and variance and the population mean and variance
    f) Sample 10 randomly chosen numbers from the population. Compute the mean and variance of the sample using the equations for computing the population means and variance, ie use n in the denominator of the variance equation rather than n-1.
    g) Do f) n times and average the sample mean and variance
    h) Compute the relative error between the averaged sample mean and variance and the population mean and varianceIn the section d) and g), vary n from 100 to 1000,000 and plot the relative error as a function of n
    i) Finally, write your own function to compute the variance but make sure you use the population mean rather than the sample mean to compute the variance. Does this make any difference to the relative error? What do you conclude from these studies? What issue is the n-1 correction (also know as Bessel’s correction) fixing?

Requirements for assignment:

1. Correct program, no matter how it is written

I don’t care if it’s the simplest way, what’s more important is that
the logic it uses is clear.

2. Good commenting
3. Examples of output to show the program works as expected
4. Brief introduction to the problem (i.e. I don’t just want a Python
listing, needs an intro), the intro doesn’t have to be long, just long
enough to explain the problem at hand. In question two, it asks:

What do you conclude from these studies?
What is issue is the n-1 correction (also know as Bessel’s
correction) fixing?

Answer these after you’ve presented the introduction.

Week 1:


Reading Material. For those who want a gentler start, read Diez first.

Diez Chapter 2: sections, 2.1 (Intro), 2.4 (Random Variables)

Navidi Chapter 2: sections, 2.1 (Intro), 2.2 (Counting methods), 2.4 (Random Variables), 2.5 (Linear Functions of Random Variables)

 Introduction to Probability Slides

Assignment 1

Key for Assignment 1

Week 2:

Random Variables and Intro to Probability Distributions

Linear Combinations

Counting Rules

Assignment 2

Key for Assignment 2

Week 3:

Discrete Distributions

Bernoulli and Binomial Distributions

Possion Distribution

Continuous Distributions

Normal Distribution

Assignment 3

Key for Assignment 3

Week 4:

Exponential Distribution

Confidence Limits

Topic for Midterm

Assignment 4 

Midterm will be on Thursday November 2nd.

Key for Assignment 4

Week 5:

Hypothessis Testing


Midterm Key

Week 6:

Chi-Square Test

Topics for the Remaining 5 Weeks

End of Term roject for Graduates

Assignment 5

Assignment 5 Key

Week 7:

Error Propagation

Analysis Of Variance

Assignment 6 (Updated)

Assignment 6 – Key

Week 8:

Linear Regression

No Assignment – Thanksgiving

Week 9:

For those interested in doing linear regression using Excel, I found this useful article. Excel does a reasonable job if you can figure out how to do it:

Obtaining Uncertainty Measures on Slope and Intercept of a Least Squares Fit with Excel’s LINEST

Review on assumptions in linear regression for medical researchers. 

Class Slides

Assumptions in Linear Regression

Analysis of Variance and Linear Regression


Assignment 7

Assignment 7 Key

Week 10:

Multiple Regression 

DataSet for Thursday Lab

Graduate Project Due on last Friday  of Week 10 or if need be, Monday of Week 11.

Week 11:

Exam Week: Topics for Exam