August 30, 2003 1. Does the equation sin(x) = x - 1 have a solution? (x is in radians). If so, write two programs to find a solution. The first program should be based on a binary-search technique. Note, however, that the function may not be monotone. The second program should be based on Newton's method for solving nonlinear equations. 2. Dr. Smith wants to find the area under the curve f(x) = abs(sin(cos(x))), where 0 <= x <= 4. Dr. Smith knows that f(x) is always between 0 and 1. How might the area be approximated by a simulation technique? Can you think of a simulation technique to approximate the area of an ellipse with equation x^2 + 3*y^2 = 16? A spiral has equation (in polar coordinates) r = sqrt(theta). How might you estimate the length of the spiral from theta = 0 to theta = 10? Graph the spiral just described using either Splus or SAS. 3. The probability of an event in a single trial is p. Suppose a sequence of independent trials T1, T2, ..., Tn, ... is performed until the event is observed. If X represents the number of trials required for n events to be observed, X is said to have the negative binomial distribution with parameters n and p. a) How might you simulate the distribution of X? b) Write a program that estimates the mean and variance of X. 4. A linear transformation T is represented by the matrix A, where | 4 -2 | A = | | | -2 4 | a) Sketch the image under T of the unit circle. b) What are the eigenvalues and eigenvectors of A ? c) Can A be the covariance matrix of a bivariate normal distribution? d) Same questions for | 4 -2 | A = | | | -2 1 |. e) Same questions for | 4 5 | A = | | | 5 4 | 5. To compute the median of a set of numbers X1, X2, ..., Xn, you first order the numbers from lowest to highest.. If n is odd, the median is the middle number. If n is even, the median is defined to be the average of the two middle numbers. Write a SAS macro which computes the median of a set of numbers. A call to the macro should look like %xmedian (dataset, x, xmed) where dataset is a SAS dataset which includes the variable x and xmed is the output variable from the macro. Your macro should not make use of any SAS procedures. Note that x might have some missing values, but these should not enter into the computation of the median. 6. Two different datasets include the systolic blood pressure for two different random samples of the population. Write a SAS program which prints the following on an output file, outsbp.med: Median SBP for population 1: XXX Median SBP for population 2: YYY Difference, pop. 1 - pop. 2: ZZZ 7. Problem 26, notes.024. 8. Questions on p. 21.3 of notes.021: Do all nonsingular 3 x 3 matrices have at least one eigenvector? Find (a) an algebraic reason for this, and (b) a geometric reason. 9. Write a macro that computes sample size for a two-group study with a binary outcome (like death). The call to the macro should look like %sampsize (p1, p2, alpha, beta, n) ; where p1 = expected event rate for group 1 under the alternative hypothesis p2 = expected event rate for group 2 under the alternative hypothesis alpha = desired (two-sided) significance level beta = desired level of Type II error (or: beta = 1 - power) n = sample size for each of the two groups (output variable). Write an Splus function that does the same thing. The form of the call to this function should be n <- sampsize(p1, p2, alpha, beta) 10. Suppose X1, X2, and X3 are independently and binomially distributed with parameters (N, p), (N, p), and (N, p). You want to test the hypothesis that p = .50 with a two-sided significance level of alpha = 0.05. Assuming the null hypothesis is true, what is the probability that you would reject the null hypothesis in at least one of three independent samples? Find a way to estimate this probability using simulation. 11. How can you use the SAS function PROBHYPR and a random number generator to simulate observations from the hypergeometric distribution? Write a program to do this. Given a 2 x 2 table with fixed margins as shown, --------------- | | | | | | n1 | | | --------------- | | | | | | n2 | | | --------------- m1 m2 simulate random observations which fill in the cells of the table.
Web address of this page: http://www.biostat.umn.edu/~john-c/review2.s2003.html
Most recent update: December 10, 2004.