STA 410/2102: Statistical Computation (Sep-Dec 2014)


Radford Neal, Office: SS6026A, Email:

Office hours:Wednesdays, 1:10-2:00pm, in SS6026A.


Geof H. Givens and Jennifer A. Hoeting, Computational Statistics, 2nd edition, Wiley.

The textbook webpage has datasets, R code, and errata.


60% Three assignments (20% each), tentatively due Oct 16, Nov 13, and Dec 2.
40% Two 110-minute tests (20% each), held in lecture time on Oct 16 and Nov 27.

Graduate students in STA 2102 may have some additional questions to do on tests or assignments (which will be bonus questions for undergraduates).


Assignments will be done in R. Statistics Graduate students will use the Statistics research computing system. Undergraduates and graduate students from other departments will use CQUEST. You will probably automatically have an account on CQUEST if you're an undergraduate student in this course (you need to fill out a form if you're a grad student).

You can also use R on your laptop or home computer by downloading it for free from I'll be trying out the idea of doing some in-class (non-credit) exercises, for which you may wish to bring your laptop, though I'll provide some laptops for those who don't have one with them. If you don't bring a laptop, you may wish to at least bring a USB memory stick or a SD memory card so you can take away what you did (I don't know whether wifi will be available).

At the site, there is an Introduction to R. You can also look at Hadley Wickham's online book on Advanced R.

You might also be interested in trying out my faster implementation of R, called pqR, available from, although, it currently is distributed only in source form, and hence is easily installed only on Linux/Unix systems. (Installing from source on a Mac is straightforward if you're already familiar with how to do that for other R versions (and in particular, you have installed Apple's Xcode deveopment software), but installing on Microsoft Windows is experimental.) A new version of 2014-11-16 is now there!

What to read:

You should have read Chapters 2, 4, and 5 of the textbook.

You should now be reading Chapters 6 and 7. We will not be covering the material in Sections 6.2.3, 6.3.1, 6.3.2, 6.4.2, 6.4.3, and 6.4.4, though you might want to read it anyway.


Assignment 1: handout.
Solution: R functions, R script, output, plot 1, plot 2, discussion.

Assignment 2: handout. There's an error in the handout. The argument X for bvn_likelihood should be an nx2 matrix, not a 2xn matrix.
Solution: 1st problem code, 1st problem output, 2nd problem code, 2nd problem output, 2nd problem plot, discussion.

Assignment 3: handout.
Solution: R functions, R script, output, plots, discussion.

Practice problems for tests:

Practice problems for test 1: handout.

Practice problems for test 2: handout.

Example R programs:

Demonstration of rounding in floting-point computations

Maximum likelihood estimation of n for binomial data

Two functions for finding zeros using bisection.

Two functions for finding zeros using Newton iteration.

Maximum likelihood estimation of Poisson mean from interval data

Multivariate Newton iteration.

MLE for absolute normal data using nlm and deriv. Now fixed to correctly handle the gradient and hessian attributes. (However, I notice that it seems to actually be fastest when it's modified to use the gradient but not the hessian.)

Sunspot example using deriv and nlm.

EM for mixture of exponential distributions.

EM for multivariate normal with missing data.

Bayesian inference for a simple model using the midpoint rule.

Example of nested integration over a circle.

Examples of ways to pass information to a local function.

Demo of simple Monte Carlo and importance sampling.

Demo of Metropolis sampling for a simple Bayesian model.

Demo of Gibbs sampling.

Web pages for past versions of the course:

Spring 2004 - Spring 2003 - Spring 2002 - Fall 2000 - Spring 2000