December 17, 2005 page 1 of 5 SPH 7460 Final Examination Name: ________________________________________ ================================================================================= 1. [This problem is based on a real study.] A study was conducted with 1002 participants. There were three drug groups, with 334 participants in each group. After the study was over, it was found that a rare illness, Syndrome X, had occurred in 3 participants. All three cases occurred in the same drug group. The probability that a person in the general population will have Syndrome X is 1/2000. Write a computer program which can simulate the probability of observing the outcome that 3 or more people in one of the three groups will have Syndrome X, while none of the people in the other groups will. You can write the program in SAS, R, or Splus. [30] December 17, 2005 page 2 of 5 SPH 7460 Final Examination Name: ________________________________________ ================================================================================= 2. Write a program in proc iml or R or Splus to find the minimum value of the function: f(x, y) = exp(x^2 + sin(x)) + exp(y^2 - y). Include a check that the value (x, y) found by the program represent a relative minimum. [30] December 17, 2005 page 3 of 5 SPH 7460 Final Examination Name: ________________________________________ ================================================================================= 3. One way to find an approximately largest eigenvalue (and the corresponding eigenvector) for a linear transformation A: R^2 ---> R^2 is the following: 1. Pick a random vector X = (X1, X2)'. 2. 'Normalize' X, that is, divide it by its length to get a vector Y = (Y1, Y2)' such that Y1^2 + Y2^2 = 1. 3. Compute A(Y). 4. Set the result from step 4 equal to X, and go back to step 2. 5. Stop the process if two successive Y's are very close to each other. The eigenvector is then (approximately) Y. What is the eigenVALUE ? Write a program in PROC IML which implements this algorithm. [30] December 17, 2005 page 4 of 5 SPH 7460 Final Examination Name: ________________________________________ ================================================================================= 4. Write a macro which does the following: Given a datafile X, and the names of several variables on that datafile, find and print the value of the 90th percentile observation for each variable. How the first line of the macro should look: %macro var90(datafile, xvars = , x90th = ); Here "xvars = " is the input, and "x90th = " is the output. [30] December 17, 2005 page 5 of 5 SPH 7460 Final Examination Name: ________________________________________ ================================================================================= 5. Write a PROC NLIN analysis of data for which the following model is specified: Y = outcome variable X = predictor Y = a - X * sin(a - b) + error if X < 0. Y = a + X * cos(a - b) + error if X >= 0, where error ~ N(0, sig^2). Also, how do you use the PROC NLIN output to estimate sig^2 ? [30]