You are on page 1of 13

SS 2864b Exam

Name:

ID:

Department of Statistical and Actuarial Sciences

SS 2864b Jan-Apr 2010
Instructor: D. Murdoch
Final Exam, April 27, 1-4 PM
Instructions
A basic calculator is allowed; no other aids are allowed. Cell phones, pagers and other
wireless devices must be left with the proctors.
Answer all multiple choice questions in the space below. Answer all short and long
answer questions on the question sheet. All questions give partial marks if left blank;
The question sheet has 12 pages; put your name on page 1 and on the short and long
answer pages. There are also blank pages at the end for rough work.

Marks(Code 333 )
116
17
18
19
20
21
Total

/16
/5
/5
/4
/5
/5
/40

1

10

11

12

13

14

15

16

SS 2864b Exam

sheet (page 1). The correct answer is worth 1 mark. A blank is
worth 0.25 marks. Some questions involve random numbers, so
more than one answer is possible, but one will be much more
likely than the others, and that one will be marked as correct.
For questions 1 to 6, assume that R has been started with an empty workspace just
before each question, i.e. the calculations in one question dont have any effect on the other
questions. Each question lists some R input along with the R prompt > ; you should
provide the output.
1) > set.seed(217)
> x <- rbinom(100000, size=10, prob=0.25)
> c(mean(x), median(x))
(A) [1] 2.498490 1.866756
(B) [1] 8.00000 7.49557
(C) [1] 7.49557 8.00000
(D) [1] 2.49849 2.00000
(E) [1] 2.00000 2.49849

2) > x <- rep(c(TRUE, FALSE), 2)

> y <- rep(c(TRUE, FALSE), each=2)
> x & !y
(A) [1]

(B) [1] TRUE

(C) [1] FALSE FALSE

TRUE FALSE

(D) [1] FALSE

(E) [1]

TRUE

TRUE

TRUE FALSE

SS 2864b Exam
3) >
>
>
>

set.seed(123)
u <- runif(1000)
x <- as.numeric(u < 0.1)
hist(u, xlab="x")

0.8

0.0

0.4

(C)

(D)

0.4

0.8

10

0.00

0.04

(A)

> y <- 1e90
> (x + y) == x
(A) [1] Inf
(B) [1] TRUE
(C) [1] FALSE
(D) [1] NA
(E) [1] NaN

0.8

0 600
0.0

0 60

Frequency
0.4

Frequency

0.0

Frequency

(B)

0 600

Frequency

(A)

0.08

(B)

(C)

(D)

SS 2864b Exam

> b <- c(2, 6)
> A %*% b
(A)
[1,]
[2,]
(B)

[,1]
-2
24

[,1]
[1,]
22
[2,]
16

(D)
[1,]
[2,]
(E) [1]

1.555556

[,1] [,2]
4
6
-6
18
4 -6

6 18

> B <- A + 1
> B
(A)

[,1] [,2]
[1,]
4
3
[2,]
1
2

(B)
[1,]
[2,]

[,1] [,2]
4
1
3
2

(C) Error: "1" is not a matrix

(D)

[,1] [,2]
[1,]
4
2
[2,]
0
1

(E)
[1,]
[2,]

[,1] [,2]
4
0
2
1

SS 2864b Exam

the answer sheet on page 1.
7) What is the binary representation of 114?
(A) 100111
(B) 1110010
(C) 1.11001
(D) 1.00111
(E) 11020

8) In human vision, the cone cells are mainly responsible for colour vision. How many
kinds of cone cells do people with normal vision have?
(A) 1
(B) 4
(C) 2
(D) 5
(E) 3

9) The central limit theorem tells us that:

(A) Large numbers have a large number of digits.
(B) The sample mean will never exactly equal the population mean.
(C) Zero is the central limit of the normal distribution.
(D) The sample mean has close to a Normal distribution in a large sample
(E) The sample variance is close to the population variance in a large sample.

SS 2864b Exam

10) The determinant of a matrix measures the amount by which it changes the volume of
sets that it acts upon. That is, if we multiply all the points in a sphere of volume 1
by a matrix, the resulting ellipsoids volume will be equal to the absolute value of the
determinant of the matrix.
Let A be a 3 3 square matrix with condition number 145. Which of the following
could be its determinant?
(A) 0.0069
(B) 145
(C) 12.04
(D) 1
(E) Any of these; there is not enough information to tell which.

11) The bisection search is

(A) A method of optimizing a single parameter function with no derivative.
(B) A geometric construction that was proven impossible by Pierre Wantzel in 1837.
(C) A method of optimizing a multi-parameter function using partial derivatives.
(D) A method of finding a zero of a multi-parameter function.
(E) A method of finding a zero of a single parameter function.

12) I wish to draw one random sample X from the density function f (x) = kx2 , 0 < x < 1,
where k is chosen as the appropriate normalizing constant. Which of the following
schemes will work?
(A) Draw U Unif(0, 1) and return X = U 1/3 .
(B) Draw U Unif(0, 1), V Unif(0, 1); if V < U 2 return X = V . Otherwise repeat.
(C) Draw U Unif(0, 1) and return X = U with weight w = (1/3)U 3 .
(D) Draw U Unif(0, 1), V Unif(0, 1); if V < (1/3)U 3 return X = U . Otherwise
repeat.
(E) Draw U Unif(0, 1) and return X = U with weight w = U 2 .

SS 2864b Exam

1 0 0

(A)
0 1 0
0 0 1

(B)

1
1
1
1
1 1
1 1
1
1 1 1
!

(C)

1 1
1 1

(D)

1 0 0
0 1 0

(E) All of the above.

14) I have drawn U Unif(0, 1) and calculated X = ln(1 U ). What is the distribution
of X?
(A) Binomial(1, 1/e)
(B) Unif(0, )
(C) Poisson(1)
(D) N (0, 1)
(E) Exponential(1)

SS 2864b Exam

15) A number is a perfect number if it is equal to the sum of its divisors that are less
than itself. For example, 6 is perfect because 6 = 1 + 2 + 3, and 1, 2, and 3 are the
only divisors of 6 other than 6 itself. Which of the following functions returns TRUE
for a perfect number x > 1 and FALSE for other positive integers? Assume only single
integers are passed as arguments, not vectors.
(A) perfect <- function(x) { y <- 1:(x-1); x == sum(y[x %% y == 0]) }
(B) perfect <- function(x) { y <- 1:(x-1); x == sum(x[x %% y == 0]) }
(C) perfect <- function(x) { y <- 1:(x-1); x == all(x %% y == 0) }
(D) perfect <- function(x) { y <- 1:(x-1); x == sum(x %% y == 0) }
(E) None of the above

16) Given any 5 5 matrix H stored in your R workspace, which of the following will print
and x to solve the equation (H I)x = 0?
(A) eigen(H)\$values[1]; eigen(H)\$vectors[,1]
(B) list(lambda=1, x=c(0,0,0,0,0))
(C) eigen(H)\$lambda; eigen(H)\$values
(D) solve(H - lambda*I, 0)
(E) solve(H - I, 0)

SS 2864b Exam

Name:

provided. Each error or missing entry loses a mark (minimum
score zero on each question). A completely blank response to any
question will score 1 mark.

1 0

17) Let A = 0 2
0 0

0
0
. Find a singular value decomposition of A.
-0.5

U

/5

VT

1)

2)

3)

4)

5)

/5

SS 2864b Exam

Name:

10

19) Let
A=

1 3
2 4

10
14

Find a solution to the equation

Ax=

for the vector x. You will get full marks for the right answer regardless of the method
used. You will get part marks if you use the LU decomposition method but make an
arithmetic mistake, or if you leave the question blank. If you use any other method
and dont get the right answer, you get zero.
/4

x=

SS 2864b Exam

Name:

11

provided. A completely blank response to any question scores
20% of full marks.
20) Newtons method for root finding is based on the formula
xn = xn1 f (xn1 )/f 0 (xn1 )
Write an R function to use Newtons method to find the solution to
f (x) = 0
where the function f is supplied by the user. Your function should have header
function(x0, f, fprime, tolerance=1.0e-5)
and take as input a starting value x0, a function f where f(x) returns f (x), a function
fprime where fprime(x) returns f 0 (x), and a value tolerance. It should return a
value x such that |f (x)| is less than tolerance.
/5

SS 2864b Exam

Name:

12

21) In class we worked with the golden(f, a, b, tol=0.000001) function to do a golden

section search. This function is hard to use because it requires us to specify the values
a and b that bracket the minimizer, i.e. we need a < x < b where f(x) is the
minimum.
(a) Describe a method to find a and b to bracket the minimizer, given only a function
f and a starting value start. You may assume that the function is decreasing
to the left of the minimum, and is increasing to the right of it. At the end, you
should be certain that the minimizer lies between a and b, both of which need to
be finite values, but they dont need to be close to the minimum. Your method
should be something you could implement in an R function.
/2
(b) Write a function with header bracketmin(f, start) that uses your method to
search for a and b to bracket the minimizer of f(x) and outputs them as the two
elements of a numeric vector.
/3

SS 2864b Exam

Name: