UNIVERSITY OF DUBLIN TRINITY COLLEGE

Faculty of Engineering, Mathematics and Science

School of Computer Science & Statistics

BA (Mod) Maths, TSM Trinity Term 2014 SF and JS

ST2352 Probability and Theoretical Statistics

Professor John Haslett

Date Venue Time

Instructions to Candidates:

Answer any 2 questions. All questions carry equal marks

Materials permitted for this examination:

Non-programmable calculators may be used

Mathematical Tables and Cambridge Statistical Tables are available from the invigilator. A table of formulae for useful distributions is appended.

Page 1 of 11 Question 1

The first spreadsheet on the left below illustrates the Acceptance Rejection algorithm for a pair of very simple discrete distributions with pmf fX (x) and fY (y) as shown.

a) Illustrate the algorithm by completing the empty boxes at the bottom right (transferring your answers to the exam booklet). Explain the logic of each step.

b) Explain the theoretical basis for the algorithm in terms of general pmf fX (x) and

fY (y).

c) Extend this theory to continuous multivariate random variables with pdf fX (x) and

fY (y).

d) Illustrate the continuous multivariate case using the second spreadsheet, below on the right, where the initial sample pairs have been drawn independently from the U(0,1) distribution. Complete the entries in the box (transferring your answers to the exam answer booklet). What is the theoretical acceptance rate in this case?

e) Derive by calculus the theoretical equivalents of the sample summaries shown.

Spreadsheet for Question (a) Spreadsheet for Question(d)

Page 2 of 11 y1 y2 Avg 0.60 0.58 SD 0.26 0.29 4 Target pdf /5(y1+y2+y1y2 ) on (0,1) Corr -0.02

x1 x2 ratio r(x) Z for ARAcc y1 y2 1 0.401 0.974 1.412 0.589 0.513 TRUE 0.401 0.974 2 0.358 0.298 0.610 0.254 0.420 FALSE 3 0.230 0.054 0.237 0.099 0.960 FALSE 4 0.325 0.119 0.385 0.161 0.144 TRUE 0.325 0.119

fX For fY Prob VLOOKUP Max Acc Y=x Y=x Poss cum 2.50 |X=x &Acc |Acc vals X dist 0 1 Y Dist ratio r 1 0.5 0.5 2 0.2 0.4 0.16 0.08 0.20 2 0.2 0.7 3 0.5 2.5 1.00 0.20 0.50 3 0.3 1.0 0.3 1.0 0.40 0.12 0.30

Pr(Acc) 0.4

Z for scaled Z for X x ratio AR Acc? Y by AR 1 0.653 2 1.00 0.270 TRUE 2 2 0.437 1 0.16 0.922 FALSE Rej 3 0.001 1 0.16 0.369 FALSE Rej 4 0.542 2 1.00 0.206 TRUE 2 5 0.395 1 0.16 0.571 FALSE Rej 6 0.764 3 0.40 0.559 FALSE Rej

Page 3 of 11 Question 2

The continuous random variable Y follows triangular distribution on (0,2).

a) Write down and sketch the pdf and the cdf for Y.

b) Explain in general the inverse cdf method for sampling from a continuous distribution.

c) Illustrate your theory by reference to the triangular distribution. Draws from the U(0,1) distribution yield values 0.215, 0.912 and 0.643. What are the corresponding values of Y?

d) Contrast with the inverse – cdf method for a discrete distribution. Illustrate using the Binomial distribution with parameters p and n =2 , that is B(2,p)

e) Show theoretically by convolution that an alternative way to sample from Y is to form the sum of two independent random draws from U(0,1).

Page 4 of 11

Page 5 of 11 Question 3 muT S 2 1 5 6 a) Samples Y from the Bivariate Normal distribution 6 8 can be simulated as linear combinations of pairs of independent standard univariate Normal Cholesky A S=AAT 0.707 2.121 T T T T random variables Y =μ +A X , as in the example 0.000 2.828 to the left. Explain the implementation of the iid N(0,1) algorithm by completing the blank cells X1 X2 Y1 Y2 (transferring your answers to the exam answer 1 -0.619 -0.898 -0.3426 -1.5399 2 0.819 0.612 3.8780 2.7320 booklet). 3 0.922 -0.039 4 0.871 -0.881 . b) Explain why the given matrix A generates samples corresponding to the variance matrix  shown.

c) Provide the theoretical basis for this algorithm by considering the joint pdf of the vector X and hence that of the vector Y. The simplest form of the bivariate normal density is as shown below, as is the corresponding matrix A.

d) For the simplest case in (c) above, discuss the conditional distribution of Y1 given

that Y1 has the specific value y1. You may note the identity below.

e) Extend the result in (d) to the general Bivariate Normal case discussed in (a).

Page 6 of 11 Page 7 of 11 Question 4

Certain mushrooms are fatal to squirrels if (and only if) more Simple: both uniform: p1= z1, p2 = z2 than half is consumed. One squirrel consumed a proportion avg 0.49 0.25 P1 of such a mushroom; a second consumed a proportion of var 0.08 0.05 what remained, that is a proportion P2 =Q(1- P1 ) of the mushroom. We are here concerned with the distributions of cov p1 p2 -0.04 P1 and P2 and the probability of death for either squirrel. In the simplest case P1 and Q are independently distributed as Theory E[] 0.50 0.25 Var 0.08 0.05 a) Explain the study of the simple case by Monte Carlo Cov -0.04 methods. Use the spreadsheet framework shown. Illustrate using some of the calculations.

Z1 Z2 P1 P2 b) The joint pdf can be written as the product of the 1 0.268 0.894 0.268 0.655 conditional distribution P2 given P1 and the marginal distribution 2of .0.442 Use the0.844 simple0.442 0.471 uniform distributions above to derive from this: 3 0.210 0.198 0.210 0.156 4 0.381 0.297 0.381 0.183 (i) the marginal distributions of P and P 1 2 5 0.909 0.044 0.909 0.004 (ii) the corresponding expected values and variances; 6 0.452 0.048 0.452 0.026

(iii) the correlation between P1 and P2 ; and

(iv) the conditional distribution of P1 given the value of P2. You may find it useful to note that:

Sampling from cond dist by SIR c) To simulate from the conditional distribution P1 Sample P1; resample with wts prop to given that P2 takes the specific value p2 it is 1/(1-p1) for p1<1-p2; else zero wt sufficient: to first simulate from P1 and hence by Importance Re-sampling to use the conditional Given P2= 0.1 distribution of P2 given P1., as in the spreadsheet shown. Explain, relating to your sum= 2166.5 answer in part a. wt prop rescale cum wts P1 to 0 0.465 0.465 1.870 9E-04 0.0009 0.812 0.812 5.332 0.002 0.0033 0.727 0.727 3.660 0.002 0.005 0.932 0.932 0.000 0 0.005 0.020

Page 8 of 11

Page 9 of 11 Page 10 of 11 Formulae for Discrete Dists in Exam Formulae for Continuous Dists in Exam

© UNIVERSITY OF DUBLIN 2014

Page 11 of 11