Some R facilities needed for Assignment 2: dbinom(i,n,p) Computes P(X=i) for a r.v. X with binomial(n,p) distribution pbinom(i,n,p) Computes P(X<=i) for a r.v. X with binomial(n,p) distribution c(x,y,z) Creates a vector with elements x, y, and z (similarly for more) 1:n Creates a vector consisting of the integers from 1 to n rep(x,k) Creates a vector consisting of k copies of the value x sum(v) Computes the sum of all elements in the vector v mean(v) Computes the sample mean of the elements in the vector v var(v) Computes the sample variance of the elements in the vector v v[i] Refers to the i'th element of vector v. Indexes start at 1. sqrt(x) Computes the square root of x sample(v) Returns a random permutation of the vector v sample(n,1,prob=p) Returns a random integer from 1 to n, selected according to the probabilities in the vector p, which should have length n Remember that you can find out more about a function using the help function. For example, help(sample) will tell you more about the "sample" function. To print plots on CQUEST, do the following: > postscript("plots.ps") > plot( ... whatever ...) > plot( ... wahtever ...) > etc. > dev.off() > system("lpr plots.ps") The printout should show up on a printer in the CQUEST room you are in. To print at home, create plot on the screen, then click on it, and use the right button to bring up a menu with print options. Or you can do you can do the same as above, then print using Ghostview (if you have it), or do similar things using > pdf("plots.pdf") and then print using Acrobat Reader.