STA 247 - Probability with Computer Applications (Sept-Dec 2011)

This course is an introduction to probability with an emphasis on topics relevant to computer science. Small programming assignments will be used to illustrate applications in computer science and to reinforce concepts of probability.

The follow-on course to STA 247 is STA 248, which will cover statistical inference. Together, STA 247 plus STA 248 are accepted as prerequisites to most higher-level statistics courses (eg, STA 302).

ANNOUNCEMENTS: You can collect marked term work on January 25 from 1:10 to 2:00, in SS6026A.


Radford Neal, Office: SS6026A, Phone: (416) 978-4970, Email:,

Office hours: Tuesdays, 2:10-3:30, starting September 20, in SS 6026A.

Prerequisites: MAT135/137/157, CSC 108/148. Exclusions: ECO227/STA255/STA257


Mondays 3:10 to 5:00 and Fridays 3:10 to 4:00, in WB 116, from September 12 to December 6. There is no lecture on October 10 (Thanksgiving) or November 7 (Fall break). There will not be a Thanskgiving makeup lecture on December 7.

Stat aid centre hours: Thursdays 11:00 to 12:30, in SS 1091.


24% Four in-class quizes (6% each)
31% Four assignments (worth 6%, 9%, 9%, 7%)
45% Final exam, scheduled by the Faculty

All assignments are to be done by each student individually.

Requests for assignments or quizes to be remarked must be made in writing to the instructor (not the TAs) within one month of the work being returned.

Accomodating illness and other special circumstances:

If due to illness or other serious personal difficulties, you are unable to complete an assignment on time, or unable to write one of the quizes, you should contact the instructor as soon as possible. For quizes, accomodation will be by taking that portion of the mark from other work. For assignments, you may be allowed to hand in the assignment up to one week late; if that is not possible, that portion of the mark will be taken from other work.

Note that for the final exam, accomodation for illness or other difficulties is handled officially through your college/faculty, not by the instructor.


Parts of the assignments will involve writing programs in the R language. You can download R for free there for your own computer, and look at documentation, including an Introduction to R.

You can also use R on the CQUEST computer system for this; you should be able to request an account here. CQUEST can be accessed from various locations on campus, or from home.


There is no paper text for this course. I will be posting lecture summaries, and will sometimes refer to sections of the following on-line books:
Introduction to Probability and Statistics Using R, G. Jay Kerns.
A PDF of the version I will refer to, with added annotations (errata) by myself, is here.

You can also get just individual chapters (with annotations) related to the course below:

Chapter 2: Introduction to R

Chapter 4: Probability

Chapter 5: Discrete distributions

Chapter 6: Continuous distributions

Introduction to Probability, Charles M. Grinstead and J. Laurie Snell.
The PDF of the version I will refer to is here.
Quiz 1 with answers. Quiz marks will be adjusted from the mark m on the quiz paper to 100-(100-m)2/100. For example, 50 is adjusted to 75.

Quiz 2. Marks will be adjusted in the same way as for Quiz 1.

Quiz 3. Marks will be adjusted in the same way as for Quiz 1.

Quiz 4. Marks will be adjusted from the mark m on the quiz paper to 100-100(1-m/100)1.5.


Assignment 1: handout. Due in class on October 7. Clarification: In question 2, when it says that events A, B, C, and D are independent, it is meant that they are mutually independent. An explanation of mutual independence has been added to the end of the week3 lecture notes below. Here are the solutions.

Assignment 2: handout. Due in class on October 28. Here are the solutions. Note: In the program for the solution to Question 3, the call b<-sample(0:5,prob=B.given.A.table[a,]) should be b<-sample(0:5,1,prob=B.given.A.table[a,]). The program actually works anyway! (But the effect of the random seed selection is different.)

Assignment 3: handout, R hints. Due in class on November 21.

Assignment 4: handout. Due in class on December 5. Solution: program, output.

Final Exam:

Time and place scheduled by the Faculty of Arts and Science - see here. Note that there are two locations, with division by student name.

There will be no books, notes, or calculators allowed for the final exam. A sheet will be provided containing facts about some standard distributions. You can see this sheet here. The exam will be on all the material that has been covered. You may need to write simple R commands, such as in Question 2 of Assigment 2, but marks will not be taken off for minor misunderstandings of R.

Here are the old final exams from 2004 and 2006.

Marks on the final exam will be adjusted from the mark m on the paper to 100-(100-m)2/100. For example, 50 is adjusted to 75.

Practice problems:

Practice problem set 1: problems, answers.

Practice problem set 2: problems, answers.

Practice problem set 3: problems, answers.

Practice problem set 4: problems, answers.

Tentative schedule:
  Week       Monday                  Friday                Lecture
            lectures                 lectures              summaries

Sep 12:  intro: probability,        more on R and          week1
         applications, and R,       probability
         probability basics

    19:  conditional prob,          independence,          week2
         interpretations,           A1 handed out

    26:  Bayes' rule, odds,         Quiz 1                 week3
         when to consider outcomes
         equally likely, R function

Oct  3:  random variables,          joint distributions,   week4
         expectation                independence of r.v.
                                    A1 due

    10:       -----                 binomial distribution, week5
                                    A2 handed out

    17:  variance, properties of    Quiz 2                 week6
         expectation and variance,
         Chebyshev's inequality

    24:  i.i.d. random variables,   graphical models,      week7
         law of large numbers       A2 due

    31:  geometric distribution,    cumulative dist fns,   week8
         continuous random vars,    uniform distribution
         probability density fns    A3 out

Nov  7:       -----                 Quiz 3                 -----

    14:  exponential distributions, Mixture distributions  week10 
         normal distributions,
         Central Limit Theorem

    21:  Bayes' Rule when random    Quiz 4                 week11 
         variables are continuous,
         Markov chains              
         A3 due

    28:  Markov chains and          Poisson distribution   week12
         matrices, equilibrium
         A4 out
Dec  5:  Formulas for variance,     ----                   week13 
         brief intro to statistical
         inference, application
         A4 due

         Final exam scheduled by the Faculty
Past version of the course: